Forminator Payment, Quiz and Contact Form Plugin - Version 1.15.7

Version Description

  • Improvement: Update out of date libraries
  • Improvement: Remove duplicate libraries that already in core
  • Fix: Data must be Sanitised, Escaped and Validated
  • Fix: Stripping HTML tags
  • Fix: Sanitised Custom HTML email notifications.
  • Fix: Compatibility with PHP 7.3
Download this release

Release Info

Developer Dency
Plugin Icon 128x128 Forminator Payment, Quiz and Contact Form Plugin
Version 1.15.7
Comparing to
See all releases

Code changes from version 1.15.4 to 1.15.7

Files changed (250) hide show
  1. addons/class-addon-autoload.php +7 -7
  2. addons/class-addon-default-holder.php +2 -2
  3. addons/pro/activecampaign/class-forminator-addon-activecampaign-form-hooks.php +55 -55
  4. addons/pro/activecampaign/class-forminator-addon-activecampaign-form-settings.php +11 -11
  5. addons/pro/activecampaign/class-forminator-addon-activecampaign-quiz-hooks.php +55 -55
  6. addons/pro/activecampaign/class-forminator-addon-activecampaign-quiz-settings.php +12 -12
  7. addons/pro/activecampaign/class-forminator-addon-activecampaign.php +16 -16
  8. addons/pro/activecampaign/lib/class-forminator-addon-activecampaign-wp-api.php +17 -17
  9. addons/pro/activecampaign/views/form-settings/map-fields.php +1 -1
  10. addons/pro/activecampaign/views/form-settings/pick-name.php +1 -1
  11. addons/pro/activecampaign/views/form-settings/select-list.php +1 -1
  12. addons/pro/activecampaign/views/form-settings/setup-options.php +1 -1
  13. addons/pro/activecampaign/views/quiz-settings/map-fields.php +1 -1
  14. addons/pro/activecampaign/views/quiz-settings/pick-name.php +1 -1
  15. addons/pro/activecampaign/views/quiz-settings/select-list.php +1 -1
  16. addons/pro/activecampaign/views/quiz-settings/setup-options.php +1 -1
  17. addons/pro/activecampaign/views/settings/setup-api.php +1 -1
  18. addons/pro/aweber/class-forminator-addon-aweber-form-hooks.php +84 -84
  19. addons/pro/aweber/class-forminator-addon-aweber-form-settings.php +9 -9
  20. addons/pro/aweber/class-forminator-addon-aweber-quiz-hooks.php +84 -84
  21. addons/pro/aweber/class-forminator-addon-aweber-quiz-settings.php +10 -10
  22. addons/pro/aweber/class-forminator-addon-aweber.php +16 -16
  23. addons/pro/aweber/lib/class-forminator-addon-aweber-oauth.php +6 -6
  24. addons/pro/aweber/lib/class-forminator-addon-aweber-wp-api.php +22 -22
  25. addons/pro/aweber/views/form-settings/map-fields.php +1 -1
  26. addons/pro/aweber/views/form-settings/pick-name.php +1 -1
  27. addons/pro/aweber/views/form-settings/setup-list.php +1 -1
  28. addons/pro/aweber/views/form-settings/setup-options.php +3 -3
  29. addons/pro/aweber/views/quiz-settings/map-fields.php +1 -1
  30. addons/pro/aweber/views/quiz-settings/pick-name.php +1 -1
  31. addons/pro/aweber/views/quiz-settings/setup-list.php +1 -1
  32. addons/pro/aweber/views/quiz-settings/setup-options.php +3 -3
  33. addons/pro/aweber/views/sections/authorize.php +2 -2
  34. addons/pro/aweber/views/settings/authorize.php +1 -1
  35. addons/pro/aweber/views/settings/wait-authorize.php +1 -1
  36. addons/pro/campaignmonitor/class-forminator-addon-campaignmonitor-form-hooks.php +51 -51
  37. addons/pro/campaignmonitor/class-forminator-addon-campaignmonitor-form-settings.php +6 -6
  38. addons/pro/campaignmonitor/class-forminator-addon-campaignmonitor-quiz-hooks.php +51 -51
  39. addons/pro/campaignmonitor/class-forminator-addon-campaignmonitor-quiz-settings.php +7 -7
  40. addons/pro/campaignmonitor/class-forminator-addon-campaignmonitor.php +15 -15
  41. addons/pro/campaignmonitor/lib/class-forminator-addon-campaignmonitor-wp-api.php +16 -16
  42. addons/pro/campaignmonitor/views/form-settings/map-fields.php +1 -1
  43. addons/pro/campaignmonitor/views/form-settings/pick-name.php +1 -1
  44. addons/pro/campaignmonitor/views/form-settings/setup-list.php +1 -1
  45. addons/pro/campaignmonitor/views/form-settings/setup-options.php +1 -1
  46. addons/pro/campaignmonitor/views/quiz-settings/map-fields.php +1 -1
  47. addons/pro/campaignmonitor/views/quiz-settings/pick-name.php +1 -1
  48. addons/pro/campaignmonitor/views/quiz-settings/setup-list.php +1 -1
  49. addons/pro/campaignmonitor/views/quiz-settings/setup-options.php +1 -1
  50. addons/pro/campaignmonitor/views/settings/setup-api.php +1 -1
  51. addons/pro/fortressdb/fortressdb.php +1 -1
  52. addons/pro/googlesheet/class-forminator-addon-googlesheet-form-hooks.php +50 -50
  53. addons/pro/googlesheet/class-forminator-addon-googlesheet-form-settings.php +5 -5
  54. addons/pro/googlesheet/class-forminator-addon-googlesheet-poll-hooks.php +42 -42
  55. addons/pro/googlesheet/class-forminator-addon-googlesheet-poll-settings.php +5 -5
  56. addons/pro/googlesheet/class-forminator-addon-googlesheet-quiz-hooks.php +50 -50
  57. addons/pro/googlesheet/class-forminator-addon-googlesheet-quiz-settings.php +5 -5
  58. addons/pro/googlesheet/class-forminator-addon-googlesheet.php +16 -16
  59. addons/pro/googlesheet/googlesheet.php +1 -1
  60. addons/pro/googlesheet/lib/class-forminator-addon-wp-googlesheet-client-logger.php +1 -1
  61. addons/pro/googlesheet/lib/external/Google/Auth/AppIdentity.php +1 -1
  62. addons/pro/googlesheet/lib/external/Google/Auth/AssertionCredentials.php +1 -1
  63. addons/pro/googlesheet/lib/external/Google/Auth/OAuth2.php +20 -20
  64. addons/pro/googlesheet/lib/external/Google/Cache/File.php +4 -4
  65. addons/pro/googlesheet/lib/external/Google/Cache/Memcache.php +1 -1
  66. addons/pro/googlesheet/lib/external/Google/Client.php +3 -3
  67. addons/pro/googlesheet/lib/external/Google/Config.php +12 -12
  68. addons/pro/googlesheet/lib/external/Google/Http/Batch.php +1 -1
  69. addons/pro/googlesheet/lib/external/Google/Http/CacheParser.php +14 -14
  70. addons/pro/googlesheet/lib/external/Google/Http/MediaFileUpload.php +1 -1
  71. addons/pro/googlesheet/lib/external/Google/Http/REST.php +3 -3
  72. addons/pro/googlesheet/lib/external/Google/IO/Abstract.php +7 -7
  73. addons/pro/googlesheet/lib/external/Google/IO/Curl.php +6 -6
  74. addons/pro/googlesheet/lib/external/Google/IO/Stream.php +1 -1
  75. addons/pro/googlesheet/lib/external/Google/Model.php +1 -1
  76. addons/pro/googlesheet/lib/external/Google/Service/Resource.php +5 -5
  77. addons/pro/googlesheet/lib/external/Google/Signer/P12.php +6 -6
  78. addons/pro/googlesheet/lib/external/Google/Utils.php +11 -11
  79. addons/pro/googlesheet/lib/external/Google/Utils/URITemplate.php +7 -7
  80. addons/pro/googlesheet/views/form-settings/pick-name.php +1 -1
  81. addons/pro/googlesheet/views/form-settings/setup-sheet.php +1 -1
  82. addons/pro/googlesheet/views/poll-settings/pick-name.php +1 -1
  83. addons/pro/googlesheet/views/poll-settings/setup-sheet.php +1 -1
  84. addons/pro/googlesheet/views/quiz-settings/pick-name.php +1 -1
  85. addons/pro/googlesheet/views/quiz-settings/setup-sheet.php +1 -1
  86. addons/pro/googlesheet/views/sections/authorize.php +1 -1
  87. addons/pro/googlesheet/views/settings/authorize.php +1 -1
  88. addons/pro/googlesheet/views/settings/setup-client.php +1 -1
  89. addons/pro/googlesheet/views/settings/wait-authorize.php +1 -1
  90. addons/pro/gutenberg/gutenberg.php +4 -4
  91. addons/pro/gutenberg/library/blocks/class-forminator-gfblock-forms.php +7 -7
  92. addons/pro/gutenberg/library/blocks/class-forminator-gfblock-polls.php +5 -5
  93. addons/pro/gutenberg/library/blocks/class-forminator-gfblock-quizzes.php +9 -9
  94. addons/pro/gutenberg/library/class-forminator-gfblock-abstract.php +8 -8
  95. addons/pro/hubspot/class-forminator-addon-hubspot-form-hooks.php +46 -46
  96. addons/pro/hubspot/class-forminator-addon-hubspot-form-settings.php +5 -5
  97. addons/pro/hubspot/class-forminator-addon-hubspot-quiz-hooks.php +46 -46
  98. addons/pro/hubspot/class-forminator-addon-hubspot-quiz-settings.php +6 -6
  99. addons/pro/hubspot/class-forminator-addon-hubspot.php +20 -20
  100. addons/pro/hubspot/lib/class-forminator-addon-hubspot-wp-api.php +17 -17
  101. addons/pro/hubspot/views/form-settings/create-contact.php +1 -1
  102. addons/pro/hubspot/views/form-settings/create-ticket.php +2 -2
  103. addons/pro/hubspot/views/quiz-settings/create-contact.php +1 -1
  104. addons/pro/hubspot/views/quiz-settings/create-ticket.php +2 -2
  105. addons/pro/hubspot/views/sections/authorize.php +1 -1
  106. addons/pro/hubspot/views/settings/authorize.php +1 -1
  107. addons/pro/hubspot/views/settings/error-authorize.php +1 -1
  108. addons/pro/hubspot/views/settings/wait-authorize.php +1 -1
  109. addons/pro/mailchimp/class-forminator-addon-mailchimp-form-hooks.php +97 -97
  110. addons/pro/mailchimp/class-forminator-addon-mailchimp-form-settings.php +15 -15
  111. addons/pro/mailchimp/class-forminator-addon-mailchimp-quiz-hooks.php +97 -97
  112. addons/pro/mailchimp/class-forminator-addon-mailchimp-quiz-settings.php +17 -17
  113. addons/pro/mailchimp/class-forminator-addon-mailchimp.php +21 -21
  114. addons/pro/mailchimp/lib/class-forminator-addon-mailchimp-wp-api.php +21 -21
  115. addons/pro/slack/class-forminator-addon-slack-form-hooks.php +55 -55
  116. addons/pro/slack/class-forminator-addon-slack-form-settings.php +3 -3
  117. addons/pro/slack/class-forminator-addon-slack-poll-hooks.php +38 -38
  118. addons/pro/slack/class-forminator-addon-slack-poll-settings.php +3 -3
  119. addons/pro/slack/class-forminator-addon-slack-quiz-hooks.php +42 -42
  120. addons/pro/slack/class-forminator-addon-slack-quiz-settings.php +3 -3
  121. addons/pro/slack/class-forminator-addon-slack.php +19 -19
  122. addons/pro/slack/lib/class-forminator-addon-slack-wp-api.php +16 -16
  123. addons/pro/slack/views/form-settings/pick-name.php +1 -1
  124. addons/pro/slack/views/form-settings/select-target.php +1 -1
  125. addons/pro/slack/views/form-settings/select-type.php +1 -1
  126. addons/pro/slack/views/form-settings/setup-message.php +1 -1
  127. addons/pro/slack/views/poll-settings/pick-name.php +1 -1
  128. addons/pro/slack/views/poll-settings/select-target.php +1 -1
  129. addons/pro/slack/views/poll-settings/select-type.php +1 -1
  130. addons/pro/slack/views/poll-settings/setup-message.php +1 -1
  131. addons/pro/slack/views/quiz-settings/pick-name.php +1 -1
  132. addons/pro/slack/views/quiz-settings/select-target.php +1 -1
  133. addons/pro/slack/views/quiz-settings/select-type.php +1 -1
  134. addons/pro/slack/views/quiz-settings/setup-message.php +1 -1
  135. addons/pro/slack/views/sections/authorize.php +1 -1
  136. addons/pro/slack/views/settings/authorize.php +1 -1
  137. addons/pro/slack/views/settings/error-authorize.php +1 -1
  138. addons/pro/slack/views/settings/setup-client.php +1 -1
  139. addons/pro/slack/views/settings/wait-authorize.php +1 -1
  140. addons/pro/trello/class-forminator-addon-trello-form-hooks.php +66 -66
  141. addons/pro/trello/class-forminator-addon-trello-form-settings.php +9 -9
  142. addons/pro/trello/class-forminator-addon-trello-poll-hooks.php +54 -54
  143. addons/pro/trello/class-forminator-addon-trello-poll-settings.php +9 -9
  144. addons/pro/trello/class-forminator-addon-trello-quiz-hooks.php +46 -46
  145. addons/pro/trello/class-forminator-addon-trello-quiz-settings.php +9 -9
  146. addons/pro/trello/class-forminator-addon-trello.php +21 -21
  147. addons/pro/trello/lib/class-forminator-addon-trello-wp-api.php +16 -16
  148. addons/pro/trello/views/form-settings/setup-board.php +1 -1
  149. addons/pro/trello/views/form-settings/setup-card.php +1 -1
  150. addons/pro/trello/views/form-settings/setup-list.php +2 -2
  151. addons/pro/trello/views/form-settings/setup-name.php +1 -1
  152. addons/pro/trello/views/poll-settings/setup-board.php +1 -1
  153. addons/pro/trello/views/poll-settings/setup-card.php +1 -1
  154. addons/pro/trello/views/poll-settings/setup-list.php +2 -2
  155. addons/pro/trello/views/poll-settings/setup-name.php +1 -1
  156. addons/pro/trello/views/quiz-settings/setup-board.php +1 -1
  157. addons/pro/trello/views/quiz-settings/setup-card.php +1 -1
  158. addons/pro/trello/views/quiz-settings/setup-list.php +2 -2
  159. addons/pro/trello/views/quiz-settings/setup-name.php +1 -1
  160. addons/pro/trello/views/sections/authorize.php +2 -2
  161. addons/pro/trello/views/settings/authorize.php +1 -1
  162. addons/pro/trello/views/settings/wait-authorize.php +1 -1
  163. addons/pro/zapier/class-forminator-addon-zapier-form-hooks.php +37 -37
  164. addons/pro/zapier/class-forminator-addon-zapier-form-settings.php +13 -13
  165. addons/pro/zapier/class-forminator-addon-zapier-poll-hooks.php +27 -27
  166. addons/pro/zapier/class-forminator-addon-zapier-poll-settings.php +11 -11
  167. addons/pro/zapier/class-forminator-addon-zapier-quiz-hooks.php +33 -33
  168. addons/pro/zapier/class-forminator-addon-zapier-quiz-settings.php +12 -12
  169. addons/pro/zapier/class-forminator-addon-zapier.php +12 -12
  170. addons/pro/zapier/lib/class-forminator-addon-zapier-wp-api.php +19 -19
  171. addons/pro/zapier/views/poll-settings/setup-webhook.php +1 -1
  172. addons/pro/zapier/views/quiz-settings/setup-webhook.php +1 -1
  173. addons/pro/zapier/views/settings/setup-connect.php +1 -1
  174. admin/abstracts/class-admin-import-mediator.php +18 -18
  175. admin/abstracts/class-admin-module-edit-page.php +134 -164
  176. admin/abstracts/class-admin-module.php +7 -6
  177. admin/abstracts/class-admin-page.php +63 -16
  178. admin/abstracts/class-admin-view-page.php +60 -101
  179. admin/classes/class-addons-page.php +46 -40
  180. admin/classes/class-admin-ajax.php +284 -305
  181. admin/classes/class-admin-data.php +4 -5
  182. admin/classes/class-admin-l10n.php +185 -185
  183. admin/classes/class-admin.php +190 -188
  184. admin/classes/thirdparty-importers/class-importer-cf7.php +85 -83
  185. admin/classes/thirdparty-importers/class-importer-gravity.php +76 -74
  186. admin/classes/thirdparty-importers/class-importer-ninja.php +102 -96
  187. admin/locale.php +2 -0
  188. admin/pages/entries-page.php +17 -29
  189. admin/pages/integrations-page.php +7 -8
  190. admin/pages/settings-page.php +5 -4
  191. admin/pages/upgrade-page.php +1 -1
  192. admin/views/addons/action-button.php +25 -20
  193. admin/views/addons/addon-details.php +232 -224
  194. admin/views/addons/addons-activate-popup.php +49 -49
  195. admin/views/addons/addons-list.php +193 -191
  196. admin/views/addons/content-empty.php +55 -54
  197. admin/views/addons/content.php +197 -189
  198. admin/views/addons/header.php +1 -1
  199. admin/views/common/dashboard/widget.php +30 -30
  200. admin/views/common/entries/active_filters_row.php +1 -1
  201. admin/views/common/entries/content-none.php +8 -9
  202. admin/views/common/entries/content.php +18 -19
  203. admin/views/common/entries/filter.php +3 -3
  204. admin/views/common/entries/prompt.php +7 -6
  205. admin/views/common/list/chart_script.php +14 -14
  206. admin/views/common/list/empty_content.php +12 -10
  207. admin/views/common/list/main_content.php +3 -3
  208. admin/views/common/list/summary.php +16 -8
  209. admin/views/common/popup/export.php +6 -6
  210. admin/views/common/popup/import.php +1 -1
  211. admin/views/custom-form/entries/content.php +53 -47
  212. admin/views/custom-form/list/content.php +8 -12
  213. admin/views/custom-form/popup/import-cf7.php +50 -27
  214. admin/views/custom-form/popup/import-gravityforms.php +7 -6
  215. admin/views/custom-form/popup/import-ninjaforms.php +7 -6
  216. admin/views/custom-form/wizard/header.php +1 -1
  217. admin/views/dashboard/content.php +6 -3
  218. admin/views/dashboard/footer-free.php +2 -2
  219. admin/views/dashboard/footer.php +1 -1
  220. admin/views/dashboard/new-feature-notice.php +19 -19
  221. admin/views/dashboard/widgets/widget-cform.php +1 -1
  222. admin/views/dashboard/widgets/widget-create.php +7 -7
  223. admin/views/dashboard/widgets/widget-resume.php +3 -3
  224. admin/views/dashboard/widgets/widget-upgrade.php +3 -3
  225. admin/views/integrations/addon.php +5 -5
  226. admin/views/integrations/content.php +34 -34
  227. admin/views/integrations/main.php +3 -3
  228. admin/views/integrations/page-content.php +2 -2
  229. admin/views/poll/entries/content.php +3 -3
  230. admin/views/poll/list/content.php +8 -12
  231. admin/views/poll/wizard/header.php +1 -1
  232. admin/views/quiz/entries/content-leads-none.php +52 -52
  233. admin/views/quiz/entries/content-leads.php +65 -59
  234. admin/views/quiz/entries/content.php +39 -37
  235. admin/views/quiz/knowledge/header.php +1 -1
  236. admin/views/quiz/list/content.php +8 -12
  237. admin/views/quiz/nowrong/header.php +1 -1
  238. admin/views/settings/content.php +1 -1
  239. admin/views/settings/data/forms-privacy.php +7 -4
  240. admin/views/settings/payments/paypal.php +1 -1
  241. admin/views/settings/payments/section-stripe.php +2 -2
  242. admin/views/settings/payments/stripe.php +1 -1
  243. admin/views/settings/tab-accessibility.php +1 -1
  244. admin/views/settings/tab-dashboard.php +3 -3
  245. admin/views/settings/tab-data.php +1 -1
  246. admin/views/settings/tab-editor.php +2 -2
  247. admin/views/settings/tab-general.php +2 -2
  248. admin/views/settings/tab-import.php +1 -4
  249. admin/views/settings/tab-payments.php +1 -1
  250. admin/views/settings/tab-recaptcha.php +1 -1
addons/class-addon-autoload.php CHANGED
@@ -46,26 +46,26 @@ class Forminator_Addon_Autoload {
46
  *
47
  * @since 1.1
48
  *
49
- * @param string $pro_addons_dir current dir path of pro addons
50
  */
51
  $pro_addons_dir = apply_filters( 'forminator_addon_pro_addons_dir', $pro_addons_dir );
52
 
53
- // All of Forminator Official Addons must be registered here with fallback array
54
- // fallback array will be used to display pro addons on the list of addons, without files on `/pro` being available
55
  if ( empty( $pro_addons ) ) {
56
  $pro_addons = forminator_get_pro_addon_list();
57
  }
58
- // Load Available Pro Addon
59
  $directory = new DirectoryIterator( $pro_addons_dir );
60
  foreach ( $directory as $d ) {
61
  if ( $d->isDot() || $d->isFile() ) {
62
  continue;
63
  }
64
- // take directory name as addon name
65
  $addon_name = $d->getBasename();
66
 
67
  // new Addon !
68
- // valid addon is when addon have `addon_name.php` inside its addon directory
69
  $addon_initiator = $d->getPathname() . DIRECTORY_SEPARATOR . $addon_name . '.php';
70
  if ( ! file_exists( $addon_initiator ) ) {
71
  continue;
@@ -74,7 +74,7 @@ class Forminator_Addon_Autoload {
74
  include_once $addon_initiator;
75
  }
76
 
77
- // Load unavailable Pro Addons
78
  $pro_slugs = Forminator_Addon_Loader::get_instance()->get_addons()->get_slugs();
79
  $unavailable_pros = array_diff( array_keys( $pro_addons ), $pro_slugs );
80
 
46
  *
47
  * @since 1.1
48
  *
49
+ * @param string $pro_addons_dir current dir path of pro addons.
50
  */
51
  $pro_addons_dir = apply_filters( 'forminator_addon_pro_addons_dir', $pro_addons_dir );
52
 
53
+ // All of Forminator Official Addons must be registered here with fallback array.
54
+ // fallback array will be used to display pro addons on the list of addons, without files on `/pro` being available.
55
  if ( empty( $pro_addons ) ) {
56
  $pro_addons = forminator_get_pro_addon_list();
57
  }
58
+ // Load Available Pro Addon.
59
  $directory = new DirectoryIterator( $pro_addons_dir );
60
  foreach ( $directory as $d ) {
61
  if ( $d->isDot() || $d->isFile() ) {
62
  continue;
63
  }
64
+ // take directory name as addon name.
65
  $addon_name = $d->getBasename();
66
 
67
  // new Addon !
68
+ // valid addon is when addon have `addon_name.php` inside its addon directory.
69
  $addon_initiator = $d->getPathname() . DIRECTORY_SEPARATOR . $addon_name . '.php';
70
  if ( ! file_exists( $addon_initiator ) ) {
71
  continue;
74
  include_once $addon_initiator;
75
  }
76
 
77
+ // Load unavailable Pro Addons.
78
  $pro_slugs = Forminator_Addon_Loader::get_instance()->get_addons()->get_slugs();
79
  $unavailable_pros = array_diff( array_keys( $pro_addons ), $pro_slugs );
80
 
addons/class-addon-default-holder.php CHANGED
@@ -13,7 +13,7 @@ class Forminator_Addon_Default_Holder extends Forminator_Addon_Abstract {
13
 
14
  protected $_slug = '';
15
  protected $_version = '1.0';
16
- protected $_min_forminator_version = PHP_INT_MAX; // make it un-activable
17
  protected $_short_title = '';
18
  protected $_title = '';
19
  protected $_url = '';
@@ -31,7 +31,7 @@ class Forminator_Addon_Default_Holder extends Forminator_Addon_Abstract {
31
  */
32
  public static function get_instance() {
33
  if ( is_null( self::$_instance ) ) {
34
- self::$_instance = new self();// @codeCoverageIgnore
35
  }
36
 
37
  return self::$_instance;
13
 
14
  protected $_slug = '';
15
  protected $_version = '1.0';
16
+ protected $_min_forminator_version = PHP_INT_MAX; // make it un-activable.
17
  protected $_short_title = '';
18
  protected $_title = '';
19
  protected $_url = '';
31
  */
32
  public static function get_instance() {
33
  if ( is_null( self::$_instance ) ) {
34
+ self::$_instance = new self();// @codeCoverageIgnore.
35
  }
36
 
37
  return self::$_instance;
addons/pro/activecampaign/class-forminator-addon-activecampaign-form-hooks.php CHANGED
@@ -64,8 +64,8 @@ class Forminator_Addon_Activecampaign_Form_Hooks extends Forminator_Addon_Form_H
64
  * @since 1.2
65
  *
66
  * @param array $submitted_data
67
- * @param int $form_id current Form ID
68
- * @param Forminator_Addon_Activecampaign_Form_Settings $form_settings_instance ActiveCampaign Addon Form Settings instance
69
  */
70
  $submitted_data = apply_filters(
71
  'forminator_addon_activecampaign_form_submitted_data',
@@ -86,16 +86,16 @@ class Forminator_Addon_Activecampaign_Form_Hooks extends Forminator_Addon_Form_H
86
  *
87
  * @since 1.2
88
  *
89
- * @param int $form_id current Form ID
90
  * @param array $submitted_data
91
- * @param Forminator_Addon_Activecampaign_Form_Settings $form_settings_instance ActiveCampaign Addon Form Settings instance
92
  */
93
  do_action( 'forminator_addon_activecampaign_before_contact_sync', $form_id, $submitted_data, $form_settings_instance );
94
 
95
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
96
- // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to active campaign
97
  if ( $form_settings_instance->is_multi_form_settings_complete( $key ) ) {
98
- // exec only on completed connection
99
  $data[] = array(
100
  'name' => 'status-' . $key,
101
  'value' => $this->get_status_on_contact_sync( $key, $submitted_data, $addon_setting_value, $form_settings, $form_entry_fields ),
@@ -110,9 +110,9 @@ class Forminator_Addon_Activecampaign_Form_Hooks extends Forminator_Addon_Form_H
110
  * @since 1.2
111
  *
112
  * @param array $entry_fields
113
- * @param int $form_id current Form ID
114
  * @param array $submitted_data
115
- * @param Forminator_Addon_Activecampaign_Form_Settings $form_settings_instance ActiveCampaign Addon Form Settings instance
116
  */
117
  $data = apply_filters(
118
  'forminator_addon_activecampaign_entry_fields',
@@ -141,7 +141,7 @@ class Forminator_Addon_Activecampaign_Form_Hooks extends Forminator_Addon_Form_H
141
  * @return array `is_sent` true means its success send data to ActiveCampaign, false otherwise
142
  */
143
  private function get_status_on_contact_sync( $connection_id, $submitted_data, $connection_settings, $form_settings, $form_entry_fields ) {
144
- // initialize as null
145
  $ac_api = null;
146
 
147
  $form_id = $this->form_id;
@@ -157,7 +157,7 @@ class Forminator_Addon_Activecampaign_Form_Hooks extends Forminator_Addon_Form_H
157
  }
158
 
159
  $args[ 'p[' . $connection_settings['list_id'] . ']' ] = $connection_settings['list_id'];
160
- // subscribed
161
  $args[ 'status[' . $connection_settings['list_id'] . ']' ] = '1';
162
 
163
  $fields_map = $connection_settings['fields_map'];
@@ -170,7 +170,7 @@ class Forminator_Addon_Activecampaign_Form_Hooks extends Forminator_Addon_Form_H
170
  $email = strtolower( trim( $email ) );
171
  $args['email'] = $email;
172
 
173
- // processed
174
  unset( $fields_map['email'] );
175
 
176
  $common_fields = array(
@@ -181,7 +181,7 @@ class Forminator_Addon_Activecampaign_Form_Hooks extends Forminator_Addon_Form_H
181
  );
182
 
183
  foreach ( $common_fields as $common_field ) {
184
- // not setup
185
  if ( ! isset( $fields_map[ $common_field ] ) ) {
186
  continue;
187
  }
@@ -203,14 +203,14 @@ class Forminator_Addon_Activecampaign_Form_Hooks extends Forminator_Addon_Form_H
203
  }
204
  if ( isset( $element_value ) ) {
205
  $args[ $common_field ] = $element_value;
206
- unset( $element_value ); // unset for next loop
207
  }
208
  }
209
- // processed
210
  unset( $fields_map[ $common_field ] );
211
  }
212
 
213
- // process rest extra fields if available
214
  foreach ( $fields_map as $field_id => $element_id ) {
215
  if ( ! empty( $element_id ) ) {
216
  if ( self::element_is_calculation( $element_id ) ) {
@@ -228,19 +228,19 @@ class Forminator_Addon_Activecampaign_Form_Hooks extends Forminator_Addon_Form_H
228
 
229
  if ( isset( $element_value ) ) {
230
  $args[ 'field[' . $field_id . ',0]' ] = $element_value;
231
- unset( $element_value ); // unset for next loop
232
  }
233
  }
234
  }
235
 
236
- // process tags
237
  if ( isset( $connection_settings['tags'] ) && is_array( $connection_settings['tags'] ) ) {
238
  $tags = array();
239
  foreach ( $connection_settings['tags'] as $tag ) {
240
  if ( stripos( $tag, '{' ) === 0
241
  && stripos( $tag, '}' ) === ( strlen( $tag ) - 1 )
242
  ) {
243
- // translate to value
244
  $element_id = str_ireplace( '{', '', $tag );
245
  $element_id = str_ireplace( '}', '', $element_id );
246
  if ( self::element_is_calculation( $element_id ) ) {
@@ -258,7 +258,7 @@ class Forminator_Addon_Activecampaign_Form_Hooks extends Forminator_Addon_Form_H
258
 
259
  if ( isset( $element_value ) ) {
260
  $tags[] = $element_value;
261
- unset( $element_value ); // unset for next loop
262
  }
263
  } else {
264
  $tags[] = $tag;
@@ -294,12 +294,12 @@ class Forminator_Addon_Activecampaign_Form_Hooks extends Forminator_Addon_Form_H
294
  * @since 1.2
295
  *
296
  * @param array $args
297
- * @param int $form_id Current Form id
298
- * @param string $connection_id ID of current connection
299
  * @param array $submitted_data
300
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
301
- * @param array $form_settings Displayed Form settings
302
- * @param Forminator_Addon_Activecampaign_Form_Settings $form_settings_instance ActiveCampaign Addon Form Settings instance
303
  */
304
  $args = apply_filters(
305
  'forminator_addon_activecampaign_contact_sync_args',
@@ -362,8 +362,8 @@ class Forminator_Addon_Activecampaign_Form_Hooks extends Forminator_Addon_Form_H
362
  * @since 1.2
363
  *
364
  * @param array $addon_meta_data
365
- * @param int $form_id current Form ID
366
- * @param Forminator_Addon_Activecampaign_Form_Settings $form_settings_instance ActiveCampaign Addon Form Settings instance
367
  */
368
  $addon_meta_data = apply_filters(
369
  'forminator_addon_activecampaign_metadata',
@@ -451,7 +451,7 @@ class Forminator_Addon_Activecampaign_Form_Hooks extends Forminator_Addon_Form_H
451
  }
452
 
453
  if ( Forminator_Addon_Activecampaign::is_show_full_log() ) {
454
- // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_ACTIVECAMPAIGN_SHOW_FULL_LOG', true)`
455
  if ( isset( $status['url_request'] ) ) {
456
  $sub_entries[] = array(
457
  'label' => __( 'API URL', 'forminator' ),
@@ -476,7 +476,7 @@ class Forminator_Addon_Activecampaign_Form_Hooks extends Forminator_Addon_Form_H
476
 
477
  $additional_entry_item['sub_entries'] = $sub_entries;
478
 
479
- // return single array
480
  return $additional_entry_item;
481
  }
482
 
@@ -501,9 +501,9 @@ class Forminator_Addon_Activecampaign_Form_Hooks extends Forminator_Addon_Form_H
501
  *
502
  * @since 1.2
503
  *
504
- * @param array $export_headers headers to be displayed on export file
505
- * @param int $form_id current Form ID
506
- * @param Forminator_Addon_Activecampaign_Form_Settings $form_settings_instance Activecampaign Form Settings instance
507
  */
508
  $export_headers = apply_filters(
509
  'forminator_addon_activecampaign_export_headers',
@@ -538,8 +538,8 @@ class Forminator_Addon_Activecampaign_Form_Hooks extends Forminator_Addon_Form_H
538
  * @since 1.2
539
  *
540
  * @param array $addon_meta_data
541
- * @param int $form_id current Form ID
542
- * @param Forminator_Addon_Activecampaign_Form_Settings $form_settings_instance Activecampaign Form Settings instance
543
  */
544
  $addon_meta_data = apply_filters(
545
  'forminator_addon_activecampaign_metadata',
@@ -557,11 +557,11 @@ class Forminator_Addon_Activecampaign_Form_Hooks extends Forminator_Addon_Form_H
557
  *
558
  * @since 1.2
559
  *
560
- * @param array $export_columns column to be exported
561
- * @param int $form_id current Form ID
562
- * @param Forminator_Form_Entry_Model $entry_model Form Entry Model
563
- * @param array $addon_meta_data meta data saved by addon on entry fields
564
- * @param Forminator_Addon_Activecampaign_Form_Settings $form_settings_instance Activecampaign Form Settings instance
565
  */
566
  $export_columns = apply_filters(
567
  'forminator_addon_activecampaign_export_columns',
@@ -594,15 +594,15 @@ class Forminator_Addon_Activecampaign_Form_Hooks extends Forminator_Addon_Form_H
594
 
595
  $addon_meta_data = $addon_meta_data[0];
596
 
597
- // make sure its `status`, because we only add this
598
  if ( 'status' !== $addon_meta_data['name'] ) {
599
  if ( stripos( $addon_meta_data['name'], 'status-' ) === 0 ) {
600
  $meta_data = array();
601
  foreach ( $addon_meta_datas as $addon_meta_data ) {
602
- // make it like single value so it will be processed like single meta data
603
  $addon_meta_data['name'] = 'status';
604
 
605
- // add it on an array for next recursive process
606
  $meta_data[] = $this->get_from_addon_meta_data( array( $addon_meta_data ), $key, $default );
607
  }
608
 
@@ -642,7 +642,7 @@ class Forminator_Addon_Activecampaign_Form_Hooks extends Forminator_Addon_Form_H
642
  * @return bool
643
  */
644
  public function on_before_delete_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {
645
- // attach hook first
646
  $form_id = $this->form_id;
647
  $form_settings_instance = $this->form_settings_instance;
648
 
@@ -653,9 +653,9 @@ class Forminator_Addon_Activecampaign_Form_Hooks extends Forminator_Addon_Form_H
653
  * @since 1.1
654
  *
655
  * @param array $addon_meta_data
656
- * @param int $form_id current Form ID
657
- * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model
658
- * @param Forminator_Addon_Activecampaign_Form_Settings $form_settings_instance Activecampaign Form Settings instance
659
  */
660
  $addon_meta_data = apply_filters(
661
  'forminator_addon_activecampaign_metadata',
@@ -670,10 +670,10 @@ class Forminator_Addon_Activecampaign_Form_Hooks extends Forminator_Addon_Form_H
670
  *
671
  * @since 1.1
672
  *
673
- * @param int $form_id current Form ID
674
- * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model
675
- * @param array $addon_meta_data addon meta data
676
- * @param Forminator_Addon_Activecampaign_Form_Settings $form_settings_instance Activecampaign Form Settings instance
677
  */
678
  do_action(
679
  'forminator_addon_activecampaign_on_before_delete_submission',
@@ -726,9 +726,9 @@ class Forminator_Addon_Activecampaign_Form_Hooks extends Forminator_Addon_Form_H
726
  * @since 1.2
727
  *
728
  * @param array $subscriber_ids_to_delete
729
- * @param int $form_id current Form ID
730
- * @param array $addon_meta_data addon meta data
731
- * @param Forminator_Addon_Activecampaign_Form_Settings $form_settings_instance Activecampaign Form Settings instance
732
  *
733
  */
734
  $subscriber_ids_to_delete = apply_filters(
@@ -753,11 +753,11 @@ class Forminator_Addon_Activecampaign_Form_Hooks extends Forminator_Addon_Form_H
753
  return true;
754
 
755
  } catch ( Forminator_Addon_Activecampaign_Exception $e ) {
756
- // handle all internal addon exceptions with `Forminator_Addon_Activecampaign_Exception`
757
 
758
- // use wp_error, for future usage it can be returned to page entries
759
  $wp_error = new WP_Error( 'forminator_addon_activecampaign_delete_contact', $e->getMessage() );
760
- // handle this in addon by self, since page entries cant handle error messages on delete yet
761
  wp_die(
762
  esc_html( $wp_error->get_error_message() ),
763
  esc_html( $this->addon->get_title() ),
64
  * @since 1.2
65
  *
66
  * @param array $submitted_data
67
+ * @param int $form_id current Form ID.
68
+ * @param Forminator_Addon_Activecampaign_Form_Settings $form_settings_instance ActiveCampaign Addon Form Settings instance.
69
  */
70
  $submitted_data = apply_filters(
71
  'forminator_addon_activecampaign_form_submitted_data',
86
  *
87
  * @since 1.2
88
  *
89
+ * @param int $form_id current Form ID.
90
  * @param array $submitted_data
91
+ * @param Forminator_Addon_Activecampaign_Form_Settings $form_settings_instance ActiveCampaign Addon Form Settings instance.
92
  */
93
  do_action( 'forminator_addon_activecampaign_before_contact_sync', $form_id, $submitted_data, $form_settings_instance );
94
 
95
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
96
+ // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to active campaign.
97
  if ( $form_settings_instance->is_multi_form_settings_complete( $key ) ) {
98
+ // exec only on completed connection.
99
  $data[] = array(
100
  'name' => 'status-' . $key,
101
  'value' => $this->get_status_on_contact_sync( $key, $submitted_data, $addon_setting_value, $form_settings, $form_entry_fields ),
110
  * @since 1.2
111
  *
112
  * @param array $entry_fields
113
+ * @param int $form_id current Form ID.
114
  * @param array $submitted_data
115
+ * @param Forminator_Addon_Activecampaign_Form_Settings $form_settings_instance ActiveCampaign Addon Form Settings instance.
116
  */
117
  $data = apply_filters(
118
  'forminator_addon_activecampaign_entry_fields',
141
  * @return array `is_sent` true means its success send data to ActiveCampaign, false otherwise
142
  */
143
  private function get_status_on_contact_sync( $connection_id, $submitted_data, $connection_settings, $form_settings, $form_entry_fields ) {
144
+ // initialize as null.
145
  $ac_api = null;
146
 
147
  $form_id = $this->form_id;
157
  }
158
 
159
  $args[ 'p[' . $connection_settings['list_id'] . ']' ] = $connection_settings['list_id'];
160
+ // subscribed.
161
  $args[ 'status[' . $connection_settings['list_id'] . ']' ] = '1';
162
 
163
  $fields_map = $connection_settings['fields_map'];
170
  $email = strtolower( trim( $email ) );
171
  $args['email'] = $email;
172
 
173
+ // processed.
174
  unset( $fields_map['email'] );
175
 
176
  $common_fields = array(
181
  );
182
 
183
  foreach ( $common_fields as $common_field ) {
184
+ // not setup.
185
  if ( ! isset( $fields_map[ $common_field ] ) ) {
186
  continue;
187
  }
203
  }
204
  if ( isset( $element_value ) ) {
205
  $args[ $common_field ] = $element_value;
206
+ unset( $element_value ); // unset for next loop.
207
  }
208
  }
209
+ // processed.
210
  unset( $fields_map[ $common_field ] );
211
  }
212
 
213
+ // process rest extra fields if available.
214
  foreach ( $fields_map as $field_id => $element_id ) {
215
  if ( ! empty( $element_id ) ) {
216
  if ( self::element_is_calculation( $element_id ) ) {
228
 
229
  if ( isset( $element_value ) ) {
230
  $args[ 'field[' . $field_id . ',0]' ] = $element_value;
231
+ unset( $element_value ); // unset for next loop.
232
  }
233
  }
234
  }
235
 
236
+ // process tags.
237
  if ( isset( $connection_settings['tags'] ) && is_array( $connection_settings['tags'] ) ) {
238
  $tags = array();
239
  foreach ( $connection_settings['tags'] as $tag ) {
240
  if ( stripos( $tag, '{' ) === 0
241
  && stripos( $tag, '}' ) === ( strlen( $tag ) - 1 )
242
  ) {
243
+ // translate to value.
244
  $element_id = str_ireplace( '{', '', $tag );
245
  $element_id = str_ireplace( '}', '', $element_id );
246
  if ( self::element_is_calculation( $element_id ) ) {
258
 
259
  if ( isset( $element_value ) ) {
260
  $tags[] = $element_value;
261
+ unset( $element_value ); // unset for next loop.
262
  }
263
  } else {
264
  $tags[] = $tag;
294
  * @since 1.2
295
  *
296
  * @param array $args
297
+ * @param int $form_id Current Form id.
298
+ * @param string $connection_id ID of current connection.
299
  * @param array $submitted_data
300
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
301
+ * @param array $form_settings Displayed Form settings.
302
+ * @param Forminator_Addon_Activecampaign_Form_Settings $form_settings_instance ActiveCampaign Addon Form Settings instance.
303
  */
304
  $args = apply_filters(
305
  'forminator_addon_activecampaign_contact_sync_args',
362
  * @since 1.2
363
  *
364
  * @param array $addon_meta_data
365
+ * @param int $form_id current Form ID.
366
+ * @param Forminator_Addon_Activecampaign_Form_Settings $form_settings_instance ActiveCampaign Addon Form Settings instance.
367
  */
368
  $addon_meta_data = apply_filters(
369
  'forminator_addon_activecampaign_metadata',
451
  }
452
 
453
  if ( Forminator_Addon_Activecampaign::is_show_full_log() ) {
454
+ // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_ACTIVECAMPAIGN_SHOW_FULL_LOG', true)`.
455
  if ( isset( $status['url_request'] ) ) {
456
  $sub_entries[] = array(
457
  'label' => __( 'API URL', 'forminator' ),
476
 
477
  $additional_entry_item['sub_entries'] = $sub_entries;
478
 
479
+ // return single array.
480
  return $additional_entry_item;
481
  }
482
 
501
  *
502
  * @since 1.2
503
  *
504
+ * @param array $export_headers headers to be displayed on export file.
505
+ * @param int $form_id current Form ID.
506
+ * @param Forminator_Addon_Activecampaign_Form_Settings $form_settings_instance Activecampaign Form Settings instance.
507
  */
508
  $export_headers = apply_filters(
509
  'forminator_addon_activecampaign_export_headers',
538
  * @since 1.2
539
  *
540
  * @param array $addon_meta_data
541
+ * @param int $form_id current Form ID.
542
+ * @param Forminator_Addon_Activecampaign_Form_Settings $form_settings_instance Activecampaign Form Settings instance.
543
  */
544
  $addon_meta_data = apply_filters(
545
  'forminator_addon_activecampaign_metadata',
557
  *
558
  * @since 1.2
559
  *
560
+ * @param array $export_columns column to be exported.
561
+ * @param int $form_id current Form ID.
562
+ * @param Forminator_Form_Entry_Model $entry_model Form Entry Model.
563
+ * @param array $addon_meta_data meta data saved by addon on entry fields.
564
+ * @param Forminator_Addon_Activecampaign_Form_Settings $form_settings_instance Activecampaign Form Settings instance.
565
  */
566
  $export_columns = apply_filters(
567
  'forminator_addon_activecampaign_export_columns',
594
 
595
  $addon_meta_data = $addon_meta_data[0];
596
 
597
+ // make sure its `status`, because we only add this.
598
  if ( 'status' !== $addon_meta_data['name'] ) {
599
  if ( stripos( $addon_meta_data['name'], 'status-' ) === 0 ) {
600
  $meta_data = array();
601
  foreach ( $addon_meta_datas as $addon_meta_data ) {
602
+ // make it like single value so it will be processed like single meta data.
603
  $addon_meta_data['name'] = 'status';
604
 
605
+ // add it on an array for next recursive process.
606
  $meta_data[] = $this->get_from_addon_meta_data( array( $addon_meta_data ), $key, $default );
607
  }
608
 
642
  * @return bool
643
  */
644
  public function on_before_delete_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {
645
+ // attach hook first.
646
  $form_id = $this->form_id;
647
  $form_settings_instance = $this->form_settings_instance;
648
 
653
  * @since 1.1
654
  *
655
  * @param array $addon_meta_data
656
+ * @param int $form_id current Form ID.
657
+ * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model.
658
+ * @param Forminator_Addon_Activecampaign_Form_Settings $form_settings_instance Activecampaign Form Settings instance.
659
  */
660
  $addon_meta_data = apply_filters(
661
  'forminator_addon_activecampaign_metadata',
670
  *
671
  * @since 1.1
672
  *
673
+ * @param int $form_id current Form ID.
674
+ * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model.
675
+ * @param array $addon_meta_data addon meta data.
676
+ * @param Forminator_Addon_Activecampaign_Form_Settings $form_settings_instance Activecampaign Form Settings instance.
677
  */
678
  do_action(
679
  'forminator_addon_activecampaign_on_before_delete_submission',
726
  * @since 1.2
727
  *
728
  * @param array $subscriber_ids_to_delete
729
+ * @param int $form_id current Form ID.
730
+ * @param array $addon_meta_data addon meta data.
731
+ * @param Forminator_Addon_Activecampaign_Form_Settings $form_settings_instance Activecampaign Form Settings instance.
732
  *
733
  */
734
  $subscriber_ids_to_delete = apply_filters(
753
  return true;
754
 
755
  } catch ( Forminator_Addon_Activecampaign_Exception $e ) {
756
+ // handle all internal addon exceptions with `Forminator_Addon_Activecampaign_Exception`.
757
 
758
+ // use wp_error, for future usage it can be returned to page entries.
759
  $wp_error = new WP_Error( 'forminator_addon_activecampaign_delete_contact', $e->getMessage() );
760
+ // handle this in addon by self, since page entries cant handle error messages on delete yet.
761
  wp_die(
762
  esc_html( $wp_error->get_error_message() ),
763
  esc_html( $this->addon->get_title() ),
addons/pro/activecampaign/class-forminator-addon-activecampaign-form-settings.php CHANGED
@@ -48,7 +48,7 @@ class Forminator_Addon_Activecampaign_Form_Settings extends Forminator_Addon_For
48
  * @return array
49
  */
50
  public function form_settings_wizards() {
51
- // numerical array steps
52
  return array(
53
  array(
54
  'callback' => array( $this, 'pick_name' ),
@@ -330,11 +330,11 @@ class Forminator_Addon_Activecampaign_Form_Settings extends Forminator_Addon_For
330
  $multi_id = $submitted_data['multi_id'];
331
  unset( $submitted_data['multi_id'] );
332
 
333
- // find type of email
334
  $email_fields = array();
335
  $forminator_field_element_ids = array();
336
  foreach ( $this->form_fields as $form_field ) {
337
- // collect element ids
338
  $forminator_field_element_ids[] = $form_field['element_id'];
339
  if ( 'email' === $form_field['type'] ) {
340
  $email_fields[] = $form_field;
@@ -532,7 +532,7 @@ class Forminator_Addon_Activecampaign_Form_Settings extends Forminator_Addon_For
532
  }
533
  $tag_selected_fields = array();
534
  foreach ( $saved_tags as $key => $saved_tag ) {
535
- // using form data
536
  if ( stripos( $saved_tag, '{' ) === 0
537
  && stripos( $saved_tag, '}' ) === ( strlen( $saved_tag ) - 1 )
538
  ) {
@@ -547,10 +547,10 @@ class Forminator_Addon_Activecampaign_Form_Settings extends Forminator_Addon_For
547
  // let this go, its already selected.
548
  unset( $forminator_form_element_ids[ $element_id ] );
549
  } else {
550
- // no more exist on element ids let it go
551
  unset( $saved_tags[ $key ] );
552
  }
553
- } else { // free form type
554
  $tag_selected_fields[] = array(
555
  'element_id' => $saved_tag,
556
  'field_label' => $saved_tag,
@@ -590,7 +590,7 @@ class Forminator_Addon_Activecampaign_Form_Settings extends Forminator_Addon_For
590
  try {
591
  $input_exceptions = new Forminator_Addon_Activecampaign_Form_Settings_Exception();
592
 
593
- // possible different type intended
594
  // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
595
  if ( ! empty( $double_opt_form_id ) && ! in_array( $double_opt_form_id, array_keys( $forms ) ) ) {
596
  $input_exceptions->add_input_exception( __( 'Please pick valid ActiveCampaign Form', 'forminator' ), 'double_opt_form_id_error' );
@@ -660,7 +660,7 @@ class Forminator_Addon_Activecampaign_Form_Settings extends Forminator_Addon_For
660
  * @return bool
661
  */
662
  public function setup_options_is_completed( $submitted_data ) {
663
- // all settings here are optional, so it can be marked as completed
664
  return true;
665
  }
666
 
@@ -685,10 +685,10 @@ class Forminator_Addon_Activecampaign_Form_Settings extends Forminator_Addon_For
685
  $multi_ids = array();
686
  $form_settings_values = $this->get_form_settings_values();
687
  foreach ( $form_settings_values as $key => $value ) {
688
- // apply some sorting if applicable
689
  $multi_ids[] = array(
690
  'id' => $key,
691
- // use name that was added by user on creating connection
692
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
693
  );
694
  }
@@ -714,7 +714,7 @@ class Forminator_Addon_Activecampaign_Form_Settings extends Forminator_Addon_For
714
  * @param array $submitted_data
715
  */
716
  public function disconnect_form( $submitted_data ) {
717
- // only execute if multi_id provided on submitted data
718
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
719
  $addon_form_settings = $this->get_form_settings_values();
720
  unset( $addon_form_settings[ $submitted_data['multi_id'] ] );
48
  * @return array
49
  */
50
  public function form_settings_wizards() {
51
+ // numerical array steps.
52
  return array(
53
  array(
54
  'callback' => array( $this, 'pick_name' ),
330
  $multi_id = $submitted_data['multi_id'];
331
  unset( $submitted_data['multi_id'] );
332
 
333
+ // find type of email.
334
  $email_fields = array();
335
  $forminator_field_element_ids = array();
336
  foreach ( $this->form_fields as $form_field ) {
337
+ // collect element ids.
338
  $forminator_field_element_ids[] = $form_field['element_id'];
339
  if ( 'email' === $form_field['type'] ) {
340
  $email_fields[] = $form_field;
532
  }
533
  $tag_selected_fields = array();
534
  foreach ( $saved_tags as $key => $saved_tag ) {
535
+ // using form data.
536
  if ( stripos( $saved_tag, '{' ) === 0
537
  && stripos( $saved_tag, '}' ) === ( strlen( $saved_tag ) - 1 )
538
  ) {
547
  // let this go, its already selected.
548
  unset( $forminator_form_element_ids[ $element_id ] );
549
  } else {
550
+ // no more exist on element ids let it go.
551
  unset( $saved_tags[ $key ] );
552
  }
553
+ } else { // free form type.
554
  $tag_selected_fields[] = array(
555
  'element_id' => $saved_tag,
556
  'field_label' => $saved_tag,
590
  try {
591
  $input_exceptions = new Forminator_Addon_Activecampaign_Form_Settings_Exception();
592
 
593
+ // possible different type intended.
594
  // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
595
  if ( ! empty( $double_opt_form_id ) && ! in_array( $double_opt_form_id, array_keys( $forms ) ) ) {
596
  $input_exceptions->add_input_exception( __( 'Please pick valid ActiveCampaign Form', 'forminator' ), 'double_opt_form_id_error' );
660
  * @return bool
661
  */
662
  public function setup_options_is_completed( $submitted_data ) {
663
+ // all settings here are optional, so it can be marked as completed.
664
  return true;
665
  }
666
 
685
  $multi_ids = array();
686
  $form_settings_values = $this->get_form_settings_values();
687
  foreach ( $form_settings_values as $key => $value ) {
688
+ // apply some sorting if applicable.
689
  $multi_ids[] = array(
690
  'id' => $key,
691
+ // use name that was added by user on creating connection.
692
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
693
  );
694
  }
714
  * @param array $submitted_data
715
  */
716
  public function disconnect_form( $submitted_data ) {
717
+ // only execute if multi_id provided on submitted data.
718
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
719
  $addon_form_settings = $this->get_form_settings_values();
720
  unset( $addon_form_settings[ $submitted_data['multi_id'] ] );
addons/pro/activecampaign/class-forminator-addon-activecampaign-quiz-hooks.php CHANGED
@@ -64,8 +64,8 @@ class Forminator_Addon_Activecampaign_Quiz_Hooks extends Forminator_Addon_Quiz_H
64
  * @since 1.2
65
  *
66
  * @param array $submitted_data
67
- * @param int $quiz_id current Quiz ID
68
- * @param Forminator_Addon_Activecampaign_Quiz_Settings $quiz_settings_instance ActiveCampaign Addon Quiz Settings instance
69
  */
70
  $submitted_data = apply_filters(
71
  'forminator_addon_activecampaign_quiz_submitted_data',
@@ -93,16 +93,16 @@ class Forminator_Addon_Activecampaign_Quiz_Hooks extends Forminator_Addon_Quiz_H
93
  *
94
  * @since 1.2
95
  *
96
- * @param int $quiz_id current Quiz ID
97
  * @param array $submitted_data
98
- * @param Forminator_Addon_Activecampaign_Quiz_Settings $quiz_settings_instance ActiveCampaign Addon Quiz Settings instance
99
  */
100
  do_action( 'forminator_addon_activecampaign_before_contact_sync', $quiz_id, $submitted_data, $quiz_settings_instance );
101
 
102
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
103
- // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to active campaign
104
  if ( $quiz_settings_instance->is_multi_quiz_settings_complete( $key ) ) {
105
- // exec only on completed connection
106
  $data[] = array(
107
  'name' => 'status-' . $key,
108
  'value' => $this->get_status_on_contact_sync( $key, $submitted_data, $addon_setting_value, $quiz_settings, $form_entry_fields ),
@@ -117,9 +117,9 @@ class Forminator_Addon_Activecampaign_Quiz_Hooks extends Forminator_Addon_Quiz_H
117
  * @since 1.2
118
  *
119
  * @param array $entry_fields
120
- * @param int $quiz_id current Quiz ID
121
  * @param array $submitted_data
122
- * @param Forminator_Addon_Activecampaign_Quiz_Settings $quiz_settings_instance ActiveCampaign Addon Quiz Settings instance
123
  */
124
  $data = apply_filters(
125
  'forminator_addon_activecampaign_entry_fields',
@@ -148,7 +148,7 @@ class Forminator_Addon_Activecampaign_Quiz_Hooks extends Forminator_Addon_Quiz_H
148
  * @return array `is_sent` true means its success send data to ActiveCampaign, false otherwise
149
  */
150
  private function get_status_on_contact_sync( $connection_id, $submitted_data, $connection_settings, $quiz_settings, $form_entry_fields ) {
151
- // initialize as null
152
  $ac_api = null;
153
 
154
  $quiz_id = $this->quiz_id;
@@ -164,7 +164,7 @@ class Forminator_Addon_Activecampaign_Quiz_Hooks extends Forminator_Addon_Quiz_H
164
  }
165
 
166
  $args[ 'p[' . $connection_settings['list_id'] . ']' ] = $connection_settings['list_id'];
167
- // subscribed
168
  $args[ 'status[' . $connection_settings['list_id'] . ']' ] = '1';
169
 
170
  $fields_map = $connection_settings['fields_map'];
@@ -177,7 +177,7 @@ class Forminator_Addon_Activecampaign_Quiz_Hooks extends Forminator_Addon_Quiz_H
177
  $email = strtolower( trim( $email ) );
178
  $args['email'] = $email;
179
 
180
- // processed
181
  unset( $fields_map['email'] );
182
 
183
  $common_fields = array(
@@ -188,7 +188,7 @@ class Forminator_Addon_Activecampaign_Quiz_Hooks extends Forminator_Addon_Quiz_H
188
  );
189
 
190
  foreach ( $common_fields as $common_field ) {
191
- // not setup
192
  if ( ! isset( $fields_map[ $common_field ] ) ) {
193
  continue;
194
  }
@@ -204,14 +204,14 @@ class Forminator_Addon_Activecampaign_Quiz_Hooks extends Forminator_Addon_Quiz_H
204
  }
205
  if ( isset( $element_value ) ) {
206
  $args[ $common_field ] = $element_value;
207
- unset( $element_value ); // unset for next loop
208
  }
209
  }
210
- // processed
211
  unset( $fields_map[ $common_field ] );
212
  }
213
 
214
- // process rest extra fields if available
215
  foreach ( $fields_map as $field_id => $element_id ) {
216
  if ( ! empty( $element_id ) ) {
217
  if ( isset( $submitted_data[ $element_id ] ) && ( ! empty( $submitted_data[ $element_id ] ) || 0 === (int) $submitted_data[ $element_id ] ) ) {
@@ -223,19 +223,19 @@ class Forminator_Addon_Activecampaign_Quiz_Hooks extends Forminator_Addon_Quiz_H
223
 
224
  if ( isset( $element_value ) ) {
225
  $args[ 'field[' . $field_id . ',0]' ] = $element_value;
226
- unset( $element_value ); // unset for next loop
227
  }
228
  }
229
  }
230
 
231
- // process tags
232
  if ( isset( $connection_settings['tags'] ) && is_array( $connection_settings['tags'] ) ) {
233
  $tags = array();
234
  foreach ( $connection_settings['tags'] as $tag ) {
235
  if ( stripos( $tag, '{' ) === 0
236
  && stripos( $tag, '}' ) === ( strlen( $tag ) - 1 )
237
  ) {
238
- // translate to value
239
  $element_id = str_ireplace( '{', '', $tag );
240
  $element_id = str_ireplace( '}', '', $element_id );
241
  if ( isset( $submitted_data[ $element_id ] ) && ! empty( $submitted_data[ $element_id ] ) ) {
@@ -247,7 +247,7 @@ class Forminator_Addon_Activecampaign_Quiz_Hooks extends Forminator_Addon_Quiz_H
247
 
248
  if ( isset( $element_value ) ) {
249
  $tags[] = $element_value;
250
- unset( $element_value ); // unset for next loop
251
  }
252
  } else {
253
  $tags[] = $tag;
@@ -283,12 +283,12 @@ class Forminator_Addon_Activecampaign_Quiz_Hooks extends Forminator_Addon_Quiz_H
283
  * @since 1.2
284
  *
285
  * @param array $args
286
- * @param int $quiz_id Current Quiz id
287
- * @param string $connection_id ID of current connection
288
  * @param array $submitted_data
289
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
290
- * @param array $quiz_settings Displayed Quiz settings
291
- * @param Forminator_Addon_Activecampaign_Quiz_Settings $quiz_settings_instance ActiveCampaign Addon Quiz Settings instance
292
  */
293
  $args = apply_filters(
294
  'forminator_addon_activecampaign_contact_sync_args',
@@ -351,8 +351,8 @@ class Forminator_Addon_Activecampaign_Quiz_Hooks extends Forminator_Addon_Quiz_H
351
  * @since 1.2
352
  *
353
  * @param array $addon_meta_data
354
- * @param int $quiz_id current Quiz ID
355
- * @param Forminator_Addon_Activecampaign_Quiz_Settings $quiz_settings_instance ActiveCampaign Addon Quiz Settings instance
356
  */
357
  $addon_meta_data = apply_filters(
358
  'forminator_addon_activecampaign_metadata',
@@ -440,7 +440,7 @@ class Forminator_Addon_Activecampaign_Quiz_Hooks extends Forminator_Addon_Quiz_H
440
  }
441
 
442
  if ( Forminator_Addon_Activecampaign::is_show_full_log() ) {
443
- // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_ACTIVECAMPAIGN_SHOW_FULL_LOG', true)`
444
  if ( isset( $status['url_request'] ) ) {
445
  $sub_entries[] = array(
446
  'label' => __( 'API URL', 'forminator' ),
@@ -465,7 +465,7 @@ class Forminator_Addon_Activecampaign_Quiz_Hooks extends Forminator_Addon_Quiz_H
465
 
466
  $additional_entry_item['sub_entries'] = $sub_entries;
467
 
468
- // return single array
469
  return $additional_entry_item;
470
  }
471
 
@@ -490,9 +490,9 @@ class Forminator_Addon_Activecampaign_Quiz_Hooks extends Forminator_Addon_Quiz_H
490
  *
491
  * @since 1.2
492
  *
493
- * @param array $export_headers headers to be displayed on export file
494
- * @param int $quiz_id current Quiz ID
495
- * @param Forminator_Addon_Activecampaign_Quiz_Settings $quiz_settings_instance Activecampaign Quiz Settings instance
496
  */
497
  $export_headers = apply_filters(
498
  'forminator_addon_activecampaign_export_headers',
@@ -527,8 +527,8 @@ class Forminator_Addon_Activecampaign_Quiz_Hooks extends Forminator_Addon_Quiz_H
527
  * @since 1.2
528
  *
529
  * @param array $addon_meta_data
530
- * @param int $quiz_id current Quiz ID
531
- * @param Forminator_Addon_Activecampaign_Quiz_Settings $quiz_settings_instance Activecampaign Quiz Settings instance
532
  */
533
  $addon_meta_data = apply_filters(
534
  'forminator_addon_activecampaign_metadata',
@@ -546,11 +546,11 @@ class Forminator_Addon_Activecampaign_Quiz_Hooks extends Forminator_Addon_Quiz_H
546
  *
547
  * @since 1.2
548
  *
549
- * @param array $export_columns column to be exported
550
- * @param int $quiz_id current Quiz ID
551
- * @param Forminator_Form_Entry_Model $entry_model Form Entry Model
552
- * @param array $addon_meta_data meta data saved by addon on entry fields
553
- * @param Forminator_Addon_Activecampaign_Quiz_Settings $quiz_settings_instance Activecampaign Quiz Settings instance
554
  */
555
  $export_columns = apply_filters(
556
  'forminator_addon_activecampaign_export_columns',
@@ -583,15 +583,15 @@ class Forminator_Addon_Activecampaign_Quiz_Hooks extends Forminator_Addon_Quiz_H
583
 
584
  $addon_meta_data = $addon_meta_data[0];
585
 
586
- // make sure its `status`, because we only add this
587
  if ( 'status' !== $addon_meta_data['name'] ) {
588
  if ( stripos( $addon_meta_data['name'], 'status-' ) === 0 ) {
589
  $meta_data = array();
590
  foreach ( $addon_meta_datas as $addon_meta_data ) {
591
- // make it like single value so it will be processed like single meta data
592
  $addon_meta_data['name'] = 'status';
593
 
594
- // add it on an array for next recursive process
595
  $meta_data[] = $this->get_from_addon_meta_data( array( $addon_meta_data ), $key, $default );
596
  }
597
 
@@ -631,7 +631,7 @@ class Forminator_Addon_Activecampaign_Quiz_Hooks extends Forminator_Addon_Quiz_H
631
  * @return bool
632
  */
633
  public function on_before_delete_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {
634
- // attach hook first
635
  $quiz_id = $this->quiz_id;
636
  $quiz_settings_instance = $this->quiz_settings_instance;
637
 
@@ -642,9 +642,9 @@ class Forminator_Addon_Activecampaign_Quiz_Hooks extends Forminator_Addon_Quiz_H
642
  * @since 1.1
643
  *
644
  * @param array $addon_meta_data
645
- * @param int $quiz_id current Quiz ID
646
- * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model
647
- * @param Forminator_Addon_Activecampaign_Quiz_Settings $quiz_settings_instance Activecampaign Quiz Settings instance
648
  */
649
  $addon_meta_data = apply_filters(
650
  'forminator_addon_activecampaign_metadata',
@@ -659,10 +659,10 @@ class Forminator_Addon_Activecampaign_Quiz_Hooks extends Forminator_Addon_Quiz_H
659
  *
660
  * @since 1.1
661
  *
662
- * @param int $quiz_id current Quiz ID
663
- * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model
664
- * @param array $addon_meta_data addon meta data
665
- * @param Forminator_Addon_Activecampaign_Quiz_Settings $quiz_settings_instance Activecampaign Quiz Settings instance
666
  */
667
  do_action(
668
  'forminator_addon_activecampaign_on_before_delete_submission',
@@ -715,9 +715,9 @@ class Forminator_Addon_Activecampaign_Quiz_Hooks extends Forminator_Addon_Quiz_H
715
  * @since 1.2
716
  *
717
  * @param array $subscriber_ids_to_delete
718
- * @param int $quiz_id current Quiz ID
719
- * @param array $addon_meta_data addon meta data
720
- * @param Forminator_Addon_Activecampaign_Quiz_Settings $quiz_settings_instance Activecampaign Quiz Settings instance
721
  *
722
  */
723
  $subscriber_ids_to_delete = apply_filters(
@@ -742,11 +742,11 @@ class Forminator_Addon_Activecampaign_Quiz_Hooks extends Forminator_Addon_Quiz_H
742
  return true;
743
 
744
  } catch ( Forminator_Addon_Activecampaign_Exception $e ) {
745
- // handle all internal addon exceptions with `Forminator_Addon_Activecampaign_Exception`
746
 
747
- // use wp_error, for future usage it can be returned to page entries
748
  $wp_error = new WP_Error( 'forminator_addon_activecampaign_delete_contact', $e->getMessage() );
749
- // handle this in addon by self, since page entries cant handle error messages on delete yet
750
  wp_die(
751
  esc_html( $wp_error->get_error_message() ),
752
  esc_html( $this->addon->get_title() ),
64
  * @since 1.2
65
  *
66
  * @param array $submitted_data
67
+ * @param int $quiz_id current Quiz ID.
68
+ * @param Forminator_Addon_Activecampaign_Quiz_Settings $quiz_settings_instance ActiveCampaign Addon Quiz Settings instance.
69
  */
70
  $submitted_data = apply_filters(
71
  'forminator_addon_activecampaign_quiz_submitted_data',
93
  *
94
  * @since 1.2
95
  *
96
+ * @param int $quiz_id current Quiz ID.
97
  * @param array $submitted_data
98
+ * @param Forminator_Addon_Activecampaign_Quiz_Settings $quiz_settings_instance ActiveCampaign Addon Quiz Settings instance.
99
  */
100
  do_action( 'forminator_addon_activecampaign_before_contact_sync', $quiz_id, $submitted_data, $quiz_settings_instance );
101
 
102
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
103
+ // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to active campaign.
104
  if ( $quiz_settings_instance->is_multi_quiz_settings_complete( $key ) ) {
105
+ // exec only on completed connection.
106
  $data[] = array(
107
  'name' => 'status-' . $key,
108
  'value' => $this->get_status_on_contact_sync( $key, $submitted_data, $addon_setting_value, $quiz_settings, $form_entry_fields ),
117
  * @since 1.2
118
  *
119
  * @param array $entry_fields
120
+ * @param int $quiz_id current Quiz ID.
121
  * @param array $submitted_data
122
+ * @param Forminator_Addon_Activecampaign_Quiz_Settings $quiz_settings_instance ActiveCampaign Addon Quiz Settings instance.
123
  */
124
  $data = apply_filters(
125
  'forminator_addon_activecampaign_entry_fields',
148
  * @return array `is_sent` true means its success send data to ActiveCampaign, false otherwise
149
  */
150
  private function get_status_on_contact_sync( $connection_id, $submitted_data, $connection_settings, $quiz_settings, $form_entry_fields ) {
151
+ // initialize as null.
152
  $ac_api = null;
153
 
154
  $quiz_id = $this->quiz_id;
164
  }
165
 
166
  $args[ 'p[' . $connection_settings['list_id'] . ']' ] = $connection_settings['list_id'];
167
+ // subscribed.
168
  $args[ 'status[' . $connection_settings['list_id'] . ']' ] = '1';
169
 
170
  $fields_map = $connection_settings['fields_map'];
177
  $email = strtolower( trim( $email ) );
178
  $args['email'] = $email;
179
 
180
+ // processed.
181
  unset( $fields_map['email'] );
182
 
183
  $common_fields = array(
188
  );
189
 
190
  foreach ( $common_fields as $common_field ) {
191
+ // not setup.
192
  if ( ! isset( $fields_map[ $common_field ] ) ) {
193
  continue;
194
  }
204
  }
205
  if ( isset( $element_value ) ) {
206
  $args[ $common_field ] = $element_value;
207
+ unset( $element_value ); // unset for next loop.
208
  }
209
  }
210
+ // processed.
211
  unset( $fields_map[ $common_field ] );
212
  }
213
 
214
+ // process rest extra fields if available.
215
  foreach ( $fields_map as $field_id => $element_id ) {
216
  if ( ! empty( $element_id ) ) {
217
  if ( isset( $submitted_data[ $element_id ] ) && ( ! empty( $submitted_data[ $element_id ] ) || 0 === (int) $submitted_data[ $element_id ] ) ) {
223
 
224
  if ( isset( $element_value ) ) {
225
  $args[ 'field[' . $field_id . ',0]' ] = $element_value;
226
+ unset( $element_value ); // unset for next loop.
227
  }
228
  }
229
  }
230
 
231
+ // process tags.
232
  if ( isset( $connection_settings['tags'] ) && is_array( $connection_settings['tags'] ) ) {
233
  $tags = array();
234
  foreach ( $connection_settings['tags'] as $tag ) {
235
  if ( stripos( $tag, '{' ) === 0
236
  && stripos( $tag, '}' ) === ( strlen( $tag ) - 1 )
237
  ) {
238
+ // translate to value.
239
  $element_id = str_ireplace( '{', '', $tag );
240
  $element_id = str_ireplace( '}', '', $element_id );
241
  if ( isset( $submitted_data[ $element_id ] ) && ! empty( $submitted_data[ $element_id ] ) ) {
247
 
248
  if ( isset( $element_value ) ) {
249
  $tags[] = $element_value;
250
+ unset( $element_value ); // unset for next loop.
251
  }
252
  } else {
253
  $tags[] = $tag;
283
  * @since 1.2
284
  *
285
  * @param array $args
286
+ * @param int $quiz_id Current Quiz id.
287
+ * @param string $connection_id ID of current connection.
288
  * @param array $submitted_data
289
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
290
+ * @param array $quiz_settings Displayed Quiz settings.
291
+ * @param Forminator_Addon_Activecampaign_Quiz_Settings $quiz_settings_instance ActiveCampaign Addon Quiz Settings instance.
292
  */
293
  $args = apply_filters(
294
  'forminator_addon_activecampaign_contact_sync_args',
351
  * @since 1.2
352
  *
353
  * @param array $addon_meta_data
354
+ * @param int $quiz_id current Quiz ID.
355
+ * @param Forminator_Addon_Activecampaign_Quiz_Settings $quiz_settings_instance ActiveCampaign Addon Quiz Settings instance.
356
  */
357
  $addon_meta_data = apply_filters(
358
  'forminator_addon_activecampaign_metadata',
440
  }
441
 
442
  if ( Forminator_Addon_Activecampaign::is_show_full_log() ) {
443
+ // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_ACTIVECAMPAIGN_SHOW_FULL_LOG', true)`.
444
  if ( isset( $status['url_request'] ) ) {
445
  $sub_entries[] = array(
446
  'label' => __( 'API URL', 'forminator' ),
465
 
466
  $additional_entry_item['sub_entries'] = $sub_entries;
467
 
468
+ // return single array.
469
  return $additional_entry_item;
470
  }
471
 
490
  *
491
  * @since 1.2
492
  *
493
+ * @param array $export_headers headers to be displayed on export file.
494
+ * @param int $quiz_id current Quiz ID.
495
+ * @param Forminator_Addon_Activecampaign_Quiz_Settings $quiz_settings_instance Activecampaign Quiz Settings instance.
496
  */
497
  $export_headers = apply_filters(
498
  'forminator_addon_activecampaign_export_headers',
527
  * @since 1.2
528
  *
529
  * @param array $addon_meta_data
530
+ * @param int $quiz_id current Quiz ID.
531
+ * @param Forminator_Addon_Activecampaign_Quiz_Settings $quiz_settings_instance Activecampaign Quiz Settings instance.
532
  */
533
  $addon_meta_data = apply_filters(
534
  'forminator_addon_activecampaign_metadata',
546
  *
547
  * @since 1.2
548
  *
549
+ * @param array $export_columns column to be exported.
550
+ * @param int $quiz_id current Quiz ID.
551
+ * @param Forminator_Form_Entry_Model $entry_model Form Entry Model.
552
+ * @param array $addon_meta_data meta data saved by addon on entry fields.
553
+ * @param Forminator_Addon_Activecampaign_Quiz_Settings $quiz_settings_instance Activecampaign Quiz Settings instance.
554
  */
555
  $export_columns = apply_filters(
556
  'forminator_addon_activecampaign_export_columns',
583
 
584
  $addon_meta_data = $addon_meta_data[0];
585
 
586
+ // make sure its `status`, because we only add this.
587
  if ( 'status' !== $addon_meta_data['name'] ) {
588
  if ( stripos( $addon_meta_data['name'], 'status-' ) === 0 ) {
589
  $meta_data = array();
590
  foreach ( $addon_meta_datas as $addon_meta_data ) {
591
+ // make it like single value so it will be processed like single meta data.
592
  $addon_meta_data['name'] = 'status';
593
 
594
+ // add it on an array for next recursive process.
595
  $meta_data[] = $this->get_from_addon_meta_data( array( $addon_meta_data ), $key, $default );
596
  }
597
 
631
  * @return bool
632
  */
633
  public function on_before_delete_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {
634
+ // attach hook first.
635
  $quiz_id = $this->quiz_id;
636
  $quiz_settings_instance = $this->quiz_settings_instance;
637
 
642
  * @since 1.1
643
  *
644
  * @param array $addon_meta_data
645
+ * @param int $quiz_id current Quiz ID.
646
+ * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model.
647
+ * @param Forminator_Addon_Activecampaign_Quiz_Settings $quiz_settings_instance Activecampaign Quiz Settings instance.
648
  */
649
  $addon_meta_data = apply_filters(
650
  'forminator_addon_activecampaign_metadata',
659
  *
660
  * @since 1.1
661
  *
662
+ * @param int $quiz_id current Quiz ID.
663
+ * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model.
664
+ * @param array $addon_meta_data addon meta data.
665
+ * @param Forminator_Addon_Activecampaign_Quiz_Settings $quiz_settings_instance Activecampaign Quiz Settings instance.
666
  */
667
  do_action(
668
  'forminator_addon_activecampaign_on_before_delete_submission',
715
  * @since 1.2
716
  *
717
  * @param array $subscriber_ids_to_delete
718
+ * @param int $quiz_id current Quiz ID.
719
+ * @param array $addon_meta_data addon meta data.
720
+ * @param Forminator_Addon_Activecampaign_Quiz_Settings $quiz_settings_instance Activecampaign Quiz Settings instance.
721
  *
722
  */
723
  $subscriber_ids_to_delete = apply_filters(
742
  return true;
743
 
744
  } catch ( Forminator_Addon_Activecampaign_Exception $e ) {
745
+ // handle all internal addon exceptions with `Forminator_Addon_Activecampaign_Exception`.
746
 
747
+ // use wp_error, for future usage it can be returned to page entries.
748
  $wp_error = new WP_Error( 'forminator_addon_activecampaign_delete_contact', $e->getMessage() );
749
+ // handle this in addon by self, since page entries cant handle error messages on delete yet.
750
  wp_die(
751
  esc_html( $wp_error->get_error_message() ),
752
  esc_html( $this->addon->get_title() ),
addons/pro/activecampaign/class-forminator-addon-activecampaign-quiz-settings.php CHANGED
@@ -48,7 +48,7 @@ class Forminator_Addon_Activecampaign_Quiz_Settings extends Forminator_Addon_Qui
48
  * @return array
49
  */
50
  public function quiz_settings_wizards() {
51
- // numerical array steps
52
  return array(
53
  array(
54
  'callback' => array( $this, 'pick_name' ),
@@ -330,12 +330,12 @@ class Forminator_Addon_Activecampaign_Quiz_Settings extends Forminator_Addon_Qui
330
  $multi_id = $submitted_data['multi_id'];
331
  unset( $submitted_data['multi_id'] );
332
 
333
- // find type of email
334
  $email_fields = array();
335
  $forminator_quiz_element_ids = array();
336
  $forminator_field_element_ids = array();
337
  foreach ( $this->form_fields as $form_field ) {
338
- // collect element ids
339
  $forminator_field_element_ids[] = $form_field['element_id'];
340
  if ( 'email' === $form_field['type'] ) {
341
  $email_fields[] = $form_field;
@@ -348,7 +348,7 @@ class Forminator_Addon_Activecampaign_Quiz_Settings extends Forminator_Addon_Qui
348
  'quiz-name' => __( 'Quiz Name', 'forminator' ),
349
  );
350
  foreach ( $quiz_questions as $quiz_question ) {
351
- // collect element ids
352
  $forminator_quiz_element_ids[] = $quiz_question['slug'];
353
  $quiz_fields[ $quiz_question['slug'] ] = $quiz_question['title'];
354
  }
@@ -555,7 +555,7 @@ class Forminator_Addon_Activecampaign_Quiz_Settings extends Forminator_Addon_Qui
555
  }
556
  $tag_selected_fields = array();
557
  foreach ( $saved_tags as $key => $saved_tag ) {
558
- // using form data
559
  if ( stripos( $saved_tag, '{' ) === 0
560
  && stripos( $saved_tag, '}' ) === ( strlen( $saved_tag ) - 1 )
561
  ) {
@@ -570,10 +570,10 @@ class Forminator_Addon_Activecampaign_Quiz_Settings extends Forminator_Addon_Qui
570
  // let this go, its already selected.
571
  unset( $forminator_form_element_ids[ $element_id ] );
572
  } else {
573
- // no more exist on element ids let it go
574
  unset( $saved_tags[ $key ] );
575
  }
576
- } else { // free form type
577
  $tag_selected_fields[] = array(
578
  'element_id' => $saved_tag,
579
  'field_label' => $saved_tag,
@@ -613,7 +613,7 @@ class Forminator_Addon_Activecampaign_Quiz_Settings extends Forminator_Addon_Qui
613
  try {
614
  $input_exceptions = new Forminator_Addon_Activecampaign_Quiz_Settings_Exception();
615
 
616
- // possible different type intended
617
  // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
618
  if ( ! empty( $double_opt_form_id ) && ! in_array( $double_opt_form_id, array_keys( $forms ) ) ) {
619
  $input_exceptions->add_input_exception( __( 'Please pick valid ActiveCampaign Quiz', 'forminator' ), 'double_opt_form_id_error' );
@@ -683,7 +683,7 @@ class Forminator_Addon_Activecampaign_Quiz_Settings extends Forminator_Addon_Qui
683
  * @return bool
684
  */
685
  public function setup_options_is_completed( $submitted_data ) {
686
- // all settings here are optional, so it can be marked as completed
687
  return true;
688
  }
689
 
@@ -708,10 +708,10 @@ class Forminator_Addon_Activecampaign_Quiz_Settings extends Forminator_Addon_Qui
708
  $multi_ids = array();
709
  $quiz_settings_values = $this->get_quiz_settings_values();
710
  foreach ( $quiz_settings_values as $key => $value ) {
711
- // apply some sorting if applicable
712
  $multi_ids[] = array(
713
  'id' => $key,
714
- // use name that was added by user on creating connection
715
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
716
  );
717
  }
@@ -737,7 +737,7 @@ class Forminator_Addon_Activecampaign_Quiz_Settings extends Forminator_Addon_Qui
737
  * @param array $submitted_data
738
  */
739
  public function disconnect_form( $submitted_data ) {
740
- // only execute if multi_id provided on submitted data
741
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
742
  $addon_quiz_settings = $this->get_quiz_settings_values();
743
  unset( $addon_quiz_settings[ $submitted_data['multi_id'] ] );
48
  * @return array
49
  */
50
  public function quiz_settings_wizards() {
51
+ // numerical array steps.
52
  return array(
53
  array(
54
  'callback' => array( $this, 'pick_name' ),
330
  $multi_id = $submitted_data['multi_id'];
331
  unset( $submitted_data['multi_id'] );
332
 
333
+ // find type of email.
334
  $email_fields = array();
335
  $forminator_quiz_element_ids = array();
336
  $forminator_field_element_ids = array();
337
  foreach ( $this->form_fields as $form_field ) {
338
+ // collect element ids.
339
  $forminator_field_element_ids[] = $form_field['element_id'];
340
  if ( 'email' === $form_field['type'] ) {
341
  $email_fields[] = $form_field;
348
  'quiz-name' => __( 'Quiz Name', 'forminator' ),
349
  );
350
  foreach ( $quiz_questions as $quiz_question ) {
351
+ // collect element ids.
352
  $forminator_quiz_element_ids[] = $quiz_question['slug'];
353
  $quiz_fields[ $quiz_question['slug'] ] = $quiz_question['title'];
354
  }
555
  }
556
  $tag_selected_fields = array();
557
  foreach ( $saved_tags as $key => $saved_tag ) {
558
+ // using form data.
559
  if ( stripos( $saved_tag, '{' ) === 0
560
  && stripos( $saved_tag, '}' ) === ( strlen( $saved_tag ) - 1 )
561
  ) {
570
  // let this go, its already selected.
571
  unset( $forminator_form_element_ids[ $element_id ] );
572
  } else {
573
+ // no more exist on element ids let it go.
574
  unset( $saved_tags[ $key ] );
575
  }
576
+ } else { // free form type.
577
  $tag_selected_fields[] = array(
578
  'element_id' => $saved_tag,
579
  'field_label' => $saved_tag,
613
  try {
614
  $input_exceptions = new Forminator_Addon_Activecampaign_Quiz_Settings_Exception();
615
 
616
+ // possible different type intended.
617
  // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
618
  if ( ! empty( $double_opt_form_id ) && ! in_array( $double_opt_form_id, array_keys( $forms ) ) ) {
619
  $input_exceptions->add_input_exception( __( 'Please pick valid ActiveCampaign Quiz', 'forminator' ), 'double_opt_form_id_error' );
683
  * @return bool
684
  */
685
  public function setup_options_is_completed( $submitted_data ) {
686
+ // all settings here are optional, so it can be marked as completed.
687
  return true;
688
  }
689
 
708
  $multi_ids = array();
709
  $quiz_settings_values = $this->get_quiz_settings_values();
710
  foreach ( $quiz_settings_values as $key => $value ) {
711
+ // apply some sorting if applicable.
712
  $multi_ids[] = array(
713
  'id' => $key,
714
+ // use name that was added by user on creating connection.
715
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
716
  );
717
  }
737
  * @param array $submitted_data
738
  */
739
  public function disconnect_form( $submitted_data ) {
740
+ // only execute if multi_id provided on submitted data.
741
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
742
  $addon_quiz_settings = $this->get_quiz_settings_values();
743
  unset( $addon_quiz_settings[ $submitted_data['multi_id'] ] );
addons/pro/activecampaign/class-forminator-addon-activecampaign.php CHANGED
@@ -44,7 +44,7 @@ final class Forminator_Addon_Activecampaign extends Forminator_Addon_Abstract {
44
  * @since 1.0 Activecampaign Addon
45
  */
46
  public function __construct() {
47
- // late init to allow translation
48
  $this->_description = __( 'Get awesome by your form.', 'forminator' );
49
  $this->_activation_error_message = __( 'Sorry but we failed to activate Activecampaign Integration, don\'t hesitate to contact us', 'forminator' );
50
  $this->_deactivation_error_message = __( 'Sorry but we failed to deactivate Activecampaign Integration, please try again', 'forminator' );
@@ -85,12 +85,12 @@ final class Forminator_Addon_Activecampaign extends Forminator_Addon_Abstract {
85
  */
86
  public function is_connected() {
87
  try {
88
- // check if its active
89
  if ( ! $this->is_active() ) {
90
  throw new Forminator_Addon_Activecampaign_Exception( __( 'ActiveCampaign is not active', 'forminator' ) );
91
  }
92
 
93
- // if user completed api setup
94
  $is_connected = $this->is_api_completed();
95
 
96
  } catch ( Forminator_Addon_Activecampaign_Exception $e ) {
@@ -130,7 +130,7 @@ final class Forminator_Addon_Activecampaign extends Forminator_Addon_Abstract {
130
  throw new Forminator_Addon_Activecampaign_Exception( __( 'Invalid Form Settings of ActiveCampaign', 'forminator' ) );
131
  }
132
 
133
- // Mark as active when there is at least one active connection
134
  if ( false === $form_settings_instance->find_one_active_connection() ) {
135
  throw new Forminator_Addon_Activecampaign_Exception( __( 'No active ActiveCampaign connection found in this form', 'forminator' ) );
136
  }
@@ -148,8 +148,8 @@ final class Forminator_Addon_Activecampaign extends Forminator_Addon_Abstract {
148
  * @since 1.2
149
  *
150
  * @param bool $is_form_connected
151
- * @param int $form_id Current Form ID
152
- * @param Forminator_Addon_Activecampaign_Form_Settings|null $form_settings_instance Instance of form settings, or null when unavailable
153
  *
154
  */
155
  $is_form_connected = apply_filters( 'forminator_addon_activecampaign_is_form_connected', $is_form_connected, $form_id, $form_settings_instance );
@@ -279,7 +279,7 @@ final class Forminator_Addon_Activecampaign extends Forminator_Addon_Abstract {
279
  }
280
 
281
  if ( $is_submit ) {
282
- $api_url = isset( $submitted_data['api_url'] ) ? $submitted_data['api_url'] : '';
283
  $api_key = isset( $submitted_data['api_key'] ) ? $submitted_data['api_key'] : '';
284
  $identifier = isset( $submitted_data['identifier'] ) ? $submitted_data['identifier'] : '';
285
 
@@ -298,7 +298,7 @@ final class Forminator_Addon_Activecampaign extends Forminator_Addon_Abstract {
298
  }
299
 
300
  if ( ! $has_errors ) {
301
- // validate api
302
  try {
303
 
304
  $this->validate_api( $api_url, $api_key );
@@ -317,7 +317,7 @@ final class Forminator_Addon_Activecampaign extends Forminator_Addon_Abstract {
317
  );
318
  $this->save_settings_values( $settings_values );
319
 
320
- // no form_id its on global settings
321
  if ( empty( $form_id ) ) {
322
  $show_success = true;
323
  }
@@ -368,7 +368,7 @@ final class Forminator_Addon_Activecampaign extends Forminator_Addon_Abstract {
368
  public function is_api_completed() {
369
  $setting_values = $this->get_settings_values();
370
 
371
- // check api_key and and api_url set up
372
  return isset( $setting_values['api_key'] ) && $setting_values['api_key'] && isset( $setting_values['api_url'] ) && ! empty( $setting_values['api_url'] );
373
  }
374
 
@@ -508,7 +508,7 @@ final class Forminator_Addon_Activecampaign extends Forminator_Addon_Abstract {
508
  throw new Forminator_Addon_Activecampaign_Exception( __( 'Invalid Quiz Settings of ActiveCampaign', 'forminator' ) );
509
  }
510
 
511
- // Mark as active when there is at least one active connection
512
  if ( false === $quiz_settings_instance->find_one_active_connection() ) {
513
  throw new Forminator_Addon_Activecampaign_Exception( __( 'No active ActiveCampaign connection found in this quiz', 'forminator' ) );
514
  }
@@ -526,8 +526,8 @@ final class Forminator_Addon_Activecampaign extends Forminator_Addon_Abstract {
526
  * @since 1.2
527
  *
528
  * @param bool $is_quiz_connected
529
- * @param int $quiz_id Current Quiz ID
530
- * @param Forminator_Addon_Activecampaign_Quiz_Settings|null $quiz_settings_instance Instance of quiz settings, or null when unavailable
531
  *
532
  */
533
  $is_quiz_connected = apply_filters( 'forminator_addon_activecampaign_is_quiz_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
@@ -548,7 +548,7 @@ final class Forminator_Addon_Activecampaign extends Forminator_Addon_Abstract {
548
  public function is_quiz_lead_connected( $quiz_id ) {
549
 
550
  try {
551
- // initialize with null
552
  $quiz_settings_instance = null;
553
  if ( ! $this->is_connected() ) {
554
  throw new Forminator_Addon_Activecampaign_Exception( __( ' ActiveCampaign is not connected', 'forminator' ) );
@@ -578,8 +578,8 @@ final class Forminator_Addon_Activecampaign extends Forminator_Addon_Abstract {
578
  * @since 1.1
579
  *
580
  * @param bool $is_quiz_connected
581
- * @param int $quiz_id Current Form ID
582
- * @param Forminator_Addon_Activecampaign_Quiz_Settings|null $quiz_settings_instance Instance of quiz settings, or null when unavailable
583
  *
584
  */
585
  $is_quiz_connected = apply_filters( 'forminator_addon_activecampaign_is_quiz_lead_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
44
  * @since 1.0 Activecampaign Addon
45
  */
46
  public function __construct() {
47
+ // late init to allow translation.
48
  $this->_description = __( 'Get awesome by your form.', 'forminator' );
49
  $this->_activation_error_message = __( 'Sorry but we failed to activate Activecampaign Integration, don\'t hesitate to contact us', 'forminator' );
50
  $this->_deactivation_error_message = __( 'Sorry but we failed to deactivate Activecampaign Integration, please try again', 'forminator' );
85
  */
86
  public function is_connected() {
87
  try {
88
+ // check if its active.
89
  if ( ! $this->is_active() ) {
90
  throw new Forminator_Addon_Activecampaign_Exception( __( 'ActiveCampaign is not active', 'forminator' ) );
91
  }
92
 
93
+ // if user completed api setup.
94
  $is_connected = $this->is_api_completed();
95
 
96
  } catch ( Forminator_Addon_Activecampaign_Exception $e ) {
130
  throw new Forminator_Addon_Activecampaign_Exception( __( 'Invalid Form Settings of ActiveCampaign', 'forminator' ) );
131
  }
132
 
133
+ // Mark as active when there is at least one active connection.
134
  if ( false === $form_settings_instance->find_one_active_connection() ) {
135
  throw new Forminator_Addon_Activecampaign_Exception( __( 'No active ActiveCampaign connection found in this form', 'forminator' ) );
136
  }
148
  * @since 1.2
149
  *
150
  * @param bool $is_form_connected
151
+ * @param int $form_id Current Form ID.
152
+ * @param Forminator_Addon_Activecampaign_Form_Settings|null $form_settings_instance Instance of form settings, or null when unavailable.
153
  *
154
  */
155
  $is_form_connected = apply_filters( 'forminator_addon_activecampaign_is_form_connected', $is_form_connected, $form_id, $form_settings_instance );
279
  }
280
 
281
  if ( $is_submit ) {
282
+ $api_url = isset( $submitted_data['api_url'] ) ? trim( $submitted_data['api_url'] ) : '';
283
  $api_key = isset( $submitted_data['api_key'] ) ? $submitted_data['api_key'] : '';
284
  $identifier = isset( $submitted_data['identifier'] ) ? $submitted_data['identifier'] : '';
285
 
298
  }
299
 
300
  if ( ! $has_errors ) {
301
+ // validate api.
302
  try {
303
 
304
  $this->validate_api( $api_url, $api_key );
317
  );
318
  $this->save_settings_values( $settings_values );
319
 
320
+ // no form_id its on global settings.
321
  if ( empty( $form_id ) ) {
322
  $show_success = true;
323
  }
368
  public function is_api_completed() {
369
  $setting_values = $this->get_settings_values();
370
 
371
+ // check api_key and and api_url set up.
372
  return isset( $setting_values['api_key'] ) && $setting_values['api_key'] && isset( $setting_values['api_url'] ) && ! empty( $setting_values['api_url'] );
373
  }
374
 
508
  throw new Forminator_Addon_Activecampaign_Exception( __( 'Invalid Quiz Settings of ActiveCampaign', 'forminator' ) );
509
  }
510
 
511
+ // Mark as active when there is at least one active connection.
512
  if ( false === $quiz_settings_instance->find_one_active_connection() ) {
513
  throw new Forminator_Addon_Activecampaign_Exception( __( 'No active ActiveCampaign connection found in this quiz', 'forminator' ) );
514
  }
526
  * @since 1.2
527
  *
528
  * @param bool $is_quiz_connected
529
+ * @param int $quiz_id Current Quiz ID.
530
+ * @param Forminator_Addon_Activecampaign_Quiz_Settings|null $quiz_settings_instance Instance of quiz settings, or null when unavailable.
531
  *
532
  */
533
  $is_quiz_connected = apply_filters( 'forminator_addon_activecampaign_is_quiz_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
548
  public function is_quiz_lead_connected( $quiz_id ) {
549
 
550
  try {
551
+ // initialize with null.
552
  $quiz_settings_instance = null;
553
  if ( ! $this->is_connected() ) {
554
  throw new Forminator_Addon_Activecampaign_Exception( __( ' ActiveCampaign is not connected', 'forminator' ) );
578
  * @since 1.1
579
  *
580
  * @param bool $is_quiz_connected
581
+ * @param int $quiz_id Current Form ID.
582
+ * @param Forminator_Addon_Activecampaign_Quiz_Settings|null $quiz_settings_instance Instance of quiz settings, or null when unavailable.
583
  *
584
  */
585
  $is_quiz_connected = apply_filters( 'forminator_addon_activecampaign_is_quiz_lead_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
addons/pro/activecampaign/lib/class-forminator-addon-activecampaign-wp-api.php CHANGED
@@ -88,7 +88,7 @@ class Forminator_Addon_Activecampaign_Wp_Api {
88
  *
89
  * @since 1.1
90
  *
91
- * @param string $user_agent current user agent
92
  */
93
  $user_agent = apply_filters( 'forminator_addon_activecampaign_api_user_agent', $user_agent );
94
 
@@ -109,7 +109,7 @@ class Forminator_Addon_Activecampaign_Wp_Api {
109
  * @throws Forminator_Addon_Activecampaign_Wp_Api_Not_Found_Exception
110
  */
111
  private function request( $verb, $path, $args = array() ) {
112
- // Adding extra user agent for wp remote request
113
  add_filter( 'http_headers_useragent', array( $this, 'filter_user_agent' ) );
114
 
115
  $url = trailingslashit( $this->_endpoint ) . $path;
@@ -120,10 +120,10 @@ class Forminator_Addon_Activecampaign_Wp_Api {
120
  *
121
  * @since 1.1
122
  *
123
- * @param string $url full url with scheme
124
- * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`
125
- * @param string $path requested path resource
126
- * @param array $args argument sent to this function
127
  */
128
  $url = apply_filters( 'forminator_addon_activecampaign_api_url', $url, $verb, $path, $args );
129
 
@@ -139,9 +139,9 @@ class Forminator_Addon_Activecampaign_Wp_Api {
139
  * @since 1.1
140
  *
141
  * @param array $headers
142
- * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`
143
- * @param string $path requested path resource
144
- * @param array $args argument sent to this function
145
  */
146
  $headers = apply_filters( 'forminator_addon_activecampaign_api_request_headers', $headers, $verb, $path, $args );
147
 
@@ -156,9 +156,9 @@ class Forminator_Addon_Activecampaign_Wp_Api {
156
  *
157
  * @since 1.1
158
  *
159
- * @param array $request_data it will be `http_build_query`-ed when `GET` or `wp_json_encode`-ed otherwise
160
- * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`
161
- * @param string $path requested path resource
162
  */
163
  $args = apply_filters( 'forminator_addon_activecampaign_api_request_data', $request_data, $verb, $path );
164
 
@@ -201,11 +201,11 @@ class Forminator_Addon_Activecampaign_Wp_Api {
201
 
202
  $body = wp_remote_retrieve_body( $res );
203
 
204
- // probably silent mode
205
  if ( ! empty( $body ) ) {
206
  $res = json_decode( $body );
207
 
208
- // auto validate
209
  if ( ! empty( $res ) ) {
210
  if ( ! isset( $res->result_code ) || 1 !== $res->result_code ) {
211
  $message = '';
@@ -224,9 +224,9 @@ class Forminator_Addon_Activecampaign_Wp_Api {
224
  *
225
  * @since 1.1
226
  *
227
- * @param mixed $response original wp remote request response or decoded body if available
228
- * @param string $body original content of http response's body
229
- * @param array|WP_Error $wp_response original wp remote request response
230
  */
231
  $res = apply_filters( 'forminator_addon_activecampaign_api_response', $response, $body, $wp_response );
232
 
88
  *
89
  * @since 1.1
90
  *
91
+ * @param string $user_agent current user agent.
92
  */
93
  $user_agent = apply_filters( 'forminator_addon_activecampaign_api_user_agent', $user_agent );
94
 
109
  * @throws Forminator_Addon_Activecampaign_Wp_Api_Not_Found_Exception
110
  */
111
  private function request( $verb, $path, $args = array() ) {
112
+ // Adding extra user agent for wp remote request.
113
  add_filter( 'http_headers_useragent', array( $this, 'filter_user_agent' ) );
114
 
115
  $url = trailingslashit( $this->_endpoint ) . $path;
120
  *
121
  * @since 1.1
122
  *
123
+ * @param string $url full url with scheme.
124
+ * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`.
125
+ * @param string $path requested path resource.
126
+ * @param array $args argument sent to this function.
127
  */
128
  $url = apply_filters( 'forminator_addon_activecampaign_api_url', $url, $verb, $path, $args );
129
 
139
  * @since 1.1
140
  *
141
  * @param array $headers
142
+ * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`.
143
+ * @param string $path requested path resource.
144
+ * @param array $args argument sent to this function.
145
  */
146
  $headers = apply_filters( 'forminator_addon_activecampaign_api_request_headers', $headers, $verb, $path, $args );
147
 
156
  *
157
  * @since 1.1
158
  *
159
+ * @param array $request_data it will be `http_build_query`-ed when `GET` or `wp_json_encode`-ed otherwise.
160
+ * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`.
161
+ * @param string $path requested path resource.
162
  */
163
  $args = apply_filters( 'forminator_addon_activecampaign_api_request_data', $request_data, $verb, $path );
164
 
201
 
202
  $body = wp_remote_retrieve_body( $res );
203
 
204
+ // probably silent mode.
205
  if ( ! empty( $body ) ) {
206
  $res = json_decode( $body );
207
 
208
+ // auto validate.
209
  if ( ! empty( $res ) ) {
210
  if ( ! isset( $res->result_code ) || 1 !== $res->result_code ) {
211
  $message = '';
224
  *
225
  * @since 1.1
226
  *
227
+ * @param mixed $response original wp remote request response or decoded body if available.
228
+ * @param string $body original content of http response's body.
229
+ * @param array|WP_Error $wp_response original wp remote request response.
230
  */
231
  $res = apply_filters( 'forminator_addon_activecampaign_api_response', $response, $body, $wp_response );
232
 
addons/pro/activecampaign/views/form-settings/map-fields.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'multi_id' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'multi_id' => '',
addons/pro/activecampaign/views/form-settings/pick-name.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
addons/pro/activecampaign/views/form-settings/select-list.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'list_id' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'list_id' => '',
addons/pro/activecampaign/views/form-settings/setup-options.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'multi_id' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'multi_id' => '',
addons/pro/activecampaign/views/quiz-settings/map-fields.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'multi_id' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'multi_id' => '',
addons/pro/activecampaign/views/quiz-settings/pick-name.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
addons/pro/activecampaign/views/quiz-settings/select-list.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'list_id' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'list_id' => '',
addons/pro/activecampaign/views/quiz-settings/setup-options.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'multi_id' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'multi_id' => '',
addons/pro/activecampaign/views/settings/setup-api.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // Defaults
3
  $vars = array(
4
  'identifier' => '',
5
  'error_message' => '',
1
  <?php
2
+ // Defaults.
3
  $vars = array(
4
  'identifier' => '',
5
  'error_message' => '',
addons/pro/aweber/class-forminator-addon-aweber-form-hooks.php CHANGED
@@ -63,8 +63,8 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
63
  * @since 1.3
64
  *
65
  * @param array $submitted_data
66
- * @param int $form_id current Form ID
67
- * @param Forminator_Addon_Aweber_Form_Settings $form_settings_instance AWeber Addon Form Settings instance
68
  */
69
  $submitted_data = apply_filters(
70
  'forminator_addon_aweber_form_submitted_data',
@@ -82,16 +82,16 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
82
  *
83
  * @since 1.3
84
  *
85
- * @param int $form_id current Form ID
86
  * @param array $submitted_data
87
- * @param Forminator_Addon_Aweber_Form_Settings $form_settings_instance AWeber Addon Form Settings instance
88
  */
89
  do_action( 'forminator_addon_aweber_before_add_subscriber', $form_id, $submitted_data, $form_settings_instance );
90
 
91
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
92
- // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to aweber
93
  if ( $form_settings_instance->is_multi_form_settings_complete( $key ) ) {
94
- // exec only on completed connection
95
  $data[] = array(
96
  'name' => 'status-' . $key,
97
  'value' => $this->get_status_on_add_subscriber( $key, $submitted_data, $addon_setting_value, $form_entry_fields ),
@@ -106,9 +106,9 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
106
  * @since 1.3
107
  *
108
  * @param array $entry_fields
109
- * @param int $form_id current Form ID
110
  * @param array $submitted_data
111
- * @param Forminator_Addon_Aweber_Form_Settings $form_settings_instance AWeber Addon Form Settings instance
112
  */
113
  $data = apply_filters(
114
  'forminator_addon_aweber_entry_fields',
@@ -135,7 +135,7 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
135
  * @return array `is_sent` true means its success send data to AWeber, false otherwise
136
  */
137
  private function get_status_on_add_subscriber( $connection_id, $submitted_data, $connection_settings, $form_entry_fields ) {
138
- // initialize as null
139
  $api = null;
140
 
141
  $form_id = $this->form_id;
@@ -173,13 +173,13 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
173
  * @since 1.3
174
  *
175
  * @param array $args
176
- * @param int $form_id Current Form id
177
- * @param string $connection_id ID of current connection
178
  * @param array $submitted_data
179
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
180
- * @param array $form_entry_fields default entry fields of form
181
- * @param array $form_settings Displayed Form settings
182
- * @param Forminator_Addon_Aweber_Form_Settings $form_settings_instance AWeber Addon Form Settings instance
183
  */
184
  $args = apply_filters(
185
  'forminator_addon_aweber_find_subscriber_args',
@@ -205,7 +205,7 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
205
  $existing_subscriber = $existing_subscriber_entries[0];
206
  if ( isset( $existing_subscriber->id ) ) {
207
  $subscriber_is_exist = true;
208
- // https://labs.aweber.com/docs/reference/1.0#subscriber_entry
209
  // you can not modify or delete Subscribers with a status of 'unconfirmed'.
210
  if ( isset( $existing_subscriber->status ) && 'unconfirmed' === $existing_subscriber->status ) {
211
  throw new Forminator_Addon_Aweber_Exception( __( 'Unconfirmed subscriber can\'t be modified.', 'forminator' ) );
@@ -214,7 +214,7 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
214
  }
215
  }
216
 
217
- // processed
218
  unset( $fields_map['default_field_email'] );
219
 
220
  $name_element_id = $connection_settings['fields_map']['default_field_name'];
@@ -234,11 +234,11 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
234
  $args['name'] = $name;
235
  }
236
 
237
- // processed
238
  unset( $fields_map['default_field_name'] );
239
 
240
  $custom_fields = array();
241
- // process rest extra fields if available
242
  foreach ( $fields_map as $field_id => $element_id ) {
243
  if ( ! empty( $element_id ) ) {
244
 
@@ -256,8 +256,8 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
256
  }
257
 
258
  if ( isset( $fields_mapper[ $field_id ] ) && isset( $element_value ) ) {
259
- $custom_fields[ $fields_mapper[ $field_id ] ] = (string) $element_value; // custom value must be string
260
- unset( $element_value ); // unset for next loop
261
  }
262
  }
263
  }
@@ -268,7 +268,7 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
268
  if ( isset( $connection_settings['ad_tracking'] ) && ! empty( $connection_settings['ad_tracking'] ) ) {
269
  $ad_tracking = $connection_settings['ad_tracking'];
270
 
271
- // disable all_fields here
272
  $ad_tracking = str_ireplace( '{all_fields}', '', $ad_tracking );
273
  $ad_tracking = forminator_addon_replace_custom_vars( $ad_tracking, $submitted_data, $this->custom_form, $form_entry_fields, false );
274
 
@@ -278,13 +278,13 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
278
  * @since 1.2
279
  *
280
  * @param string $card_name
281
- * @param int $form_id Current Form id
282
- * @param string $connection_id ID of current connection
283
  * @param array $submitted_data
284
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
285
- * @param array $form_entry_fields default entry fields of form
286
- * @param array $form_settings Displayed Form settings
287
- * @param Forminator_Addon_Aweber_Form_Settings $form_settings_instance AWeber Addon Form Settings instance
288
  */
289
  $ad_tracking = apply_filters(
290
  'forminator_addon_aweber_subscriber_ad_tracking',
@@ -300,7 +300,7 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
300
 
301
  if ( ! empty( $ad_tracking ) && is_string( $ad_tracking ) ) {
302
  if ( strlen( $ad_tracking ) > 20 ) {
303
- // 20 chars max
304
  $ad_tracking = substr( $ad_tracking, 0, 20 );
305
  }
306
  $args['ad_tracking'] = $ad_tracking;
@@ -313,7 +313,7 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
313
  if ( stripos( $tag, '{' ) === 0
314
  && stripos( $tag, '}' ) === ( strlen( $tag ) - 1 )
315
  ) {
316
- // translate to value
317
  $element_id = str_ireplace( '{', '', $tag );
318
  $element_id = str_ireplace( '}', '', $element_id );
319
  if ( self::element_is_calculation( $element_id ) ) {
@@ -330,8 +330,8 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
330
  }
331
 
332
  if ( isset( $element_value ) ) {
333
- $tags[] = strtolower( (string) $element_value ); // tag must be string
334
- unset( $element_value ); // unset for next loop
335
  }
336
  } else {
337
  $tags[] = strtolower( $tag );
@@ -344,13 +344,13 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
344
  * @since 1.2
345
  *
346
  * @param string $card_name
347
- * @param int $form_id Current Form id
348
- * @param string $connection_id ID of current connection
349
  * @param array $submitted_data
350
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
351
- * @param array $form_entry_fields default entry fields of form
352
- * @param array $form_settings Displayed Form settings
353
- * @param Forminator_Addon_Aweber_Form_Settings $form_settings_instance AWeber Addon Form Settings instance
354
  */
355
  $tags = apply_filters(
356
  'forminator_addon_aweber_subscriber_tags',
@@ -378,13 +378,13 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
378
  * @since 1.2
379
  *
380
  * @param string $card_name
381
- * @param int $form_id Current Form id
382
- * @param string $connection_id ID of current connection
383
  * @param array $submitted_data
384
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
385
- * @param array $form_entry_fields default entry fields of form
386
- * @param array $form_settings Displayed Form settings
387
- * @param Forminator_Addon_Aweber_Form_Settings $form_settings_instance AWeber Addon Form Settings instance
388
  */
389
  $ip_address = apply_filters(
390
  'forminator_addon_aweber_subscriber_ip_address',
@@ -407,13 +407,13 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
407
  * @since 1.3
408
  *
409
  * @param array $args
410
- * @param int $form_id Current Form id
411
- * @param string $connection_id ID of current connection
412
  * @param array $submitted_data
413
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
414
- * @param array $form_entry_fields default entry fields of form
415
- * @param array $form_settings Displayed Form settings
416
- * @param Forminator_Addon_Aweber_Form_Settings $form_settings_instance AWeber Addon Form Settings instance
417
  */
418
  $args = apply_filters(
419
  'forminator_addon_aweber_add_subscriber_args',
@@ -433,7 +433,7 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
433
  * subscribed, unconfirmed, unsubscribed status wont be updated
434
  * use hooks @see forminator_addon_aweber_update_subscriber_args, if needed
435
  */
436
- // update if exist
437
  $current_tags = array();
438
  if ( isset( $existing_subscriber->tags ) && is_array( $existing_subscriber->tags ) ) {
439
  $current_tags = $existing_subscriber->tags;
@@ -462,13 +462,13 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
462
  * @since 1.3
463
  *
464
  * @param array $args
465
- * @param int $form_id Current Form id
466
- * @param string $connection_id ID of current connection
467
  * @param array $submitted_data
468
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
469
- * @param array $form_entry_fields default entry fields of form
470
- * @param array $form_settings Displayed Form settings
471
- * @param Forminator_Addon_Aweber_Form_Settings $form_settings_instance AWeber Addon Form Settings instance
472
  */
473
  $args = apply_filters(
474
  'forminator_addon_aweber_update_subscriber_args',
@@ -491,7 +491,7 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
491
  'data_sent' => $api->get_last_data_sent(),
492
  'data_received' => $api->get_last_data_received(),
493
  'url_request' => $api->get_last_url_request(),
494
- 'list_id' => $list_id, // for delete reference
495
  );
496
 
497
  } catch ( Forminator_Addon_Aweber_Exception $e ) {
@@ -531,8 +531,8 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
531
  * @since 1.3
532
  *
533
  * @param array $addon_meta_data
534
- * @param int $form_id current Form ID
535
- * @param Forminator_Addon_Aweber_Form_Settings $form_settings_instance AWeber Addon Form Settings instance
536
  */
537
  $addon_meta_data = apply_filters(
538
  'forminator_addon_aweber_metadata',
@@ -620,7 +620,7 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
620
  }
621
 
622
  if ( Forminator_Addon_Aweber::is_show_full_log() ) {
623
- // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_AWEBER_SHOW_FULL_LOG', true)`
624
  if ( isset( $status['url_request'] ) ) {
625
  $sub_entries[] = array(
626
  'label' => __( 'API URL', 'forminator' ),
@@ -645,7 +645,7 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
645
 
646
  $additional_entry_item['sub_entries'] = $sub_entries;
647
 
648
- // return single array
649
  return $additional_entry_item;
650
  }
651
 
@@ -670,9 +670,9 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
670
  *
671
  * @since 1.3
672
  *
673
- * @param array $export_headers headers to be displayed on export file
674
- * @param int $form_id current Form ID
675
- * @param Forminator_Addon_Aweber_Form_Settings $form_settings_instance AWeber Addon Form Settings instance
676
  */
677
  $export_headers = apply_filters(
678
  'forminator_addon_aweber_export_headers',
@@ -707,8 +707,8 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
707
  * @since 1.3
708
  *
709
  * @param array $addon_meta_data
710
- * @param int $form_id current Form ID
711
- * @param Forminator_Addon_Aweber_Form_Settings $form_settings_instance AWeber Form Settings instance
712
  */
713
  $addon_meta_data = apply_filters(
714
  'forminator_addon_aweber_metadata',
@@ -726,11 +726,11 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
726
  *
727
  * @since 1.3
728
  *
729
- * @param array $export_columns column to be exported
730
- * @param int $form_id current Form ID
731
- * @param Forminator_Form_Entry_Model $entry_model Form Entry Model
732
- * @param array $addon_meta_data meta data saved by addon on entry fields
733
- * @param Forminator_Addon_Aweber_Form_Settings $form_settings_instance AWeber Addon Form Settings instance
734
  */
735
  $export_columns = apply_filters(
736
  'forminator_addon_aweber_export_columns',
@@ -763,15 +763,15 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
763
 
764
  $addon_meta_data = $addon_meta_data[0];
765
 
766
- // make sure its `status`, because we only add this
767
  if ( 'status' !== $addon_meta_data['name'] ) {
768
  if ( stripos( $addon_meta_data['name'], 'status-' ) === 0 ) {
769
  $meta_data = array();
770
  foreach ( $addon_meta_datas as $addon_meta_data ) {
771
- // make it like single value so it will be processed like single meta data
772
  $addon_meta_data['name'] = 'status';
773
 
774
- // add it on an array for next recursive process
775
  $meta_data[] = $this->get_from_addon_meta_data( array( $addon_meta_data ), $key, $default );
776
  }
777
 
@@ -800,13 +800,13 @@ class Forminator_Addon_Aweber_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
800
  return $default;
801
  }
802
 
803
- // /**
804
- // * DELETE NOT SUPPORTED HERE, BECAUSE AWEBER API NOT RETURNING SUBSCRIBER ID ON CREATE SUBSCRIBER
805
- // *
806
- // * @param Forminator_Form_Entry_Model $entry_model
807
- // * @param $addon_meta_data
808
- // */
809
- // public function on_before_delete_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {
810
- // parent::on_before_delete_entry( $entry_model, $addon_meta_data );
811
- // }
812
  }
63
  * @since 1.3
64
  *
65
  * @param array $submitted_data
66
+ * @param int $form_id current Form ID.
67
+ * @param Forminator_Addon_Aweber_Form_Settings $form_settings_instance AWeber Addon Form Settings instance.
68
  */
69
  $submitted_data = apply_filters(
70
  'forminator_addon_aweber_form_submitted_data',
82
  *
83
  * @since 1.3
84
  *
85
+ * @param int $form_id current Form ID.
86
  * @param array $submitted_data
87
+ * @param Forminator_Addon_Aweber_Form_Settings $form_settings_instance AWeber Addon Form Settings instance.
88
  */
89
  do_action( 'forminator_addon_aweber_before_add_subscriber', $form_id, $submitted_data, $form_settings_instance );
90
 
91
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
92
+ // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to aweber.
93
  if ( $form_settings_instance->is_multi_form_settings_complete( $key ) ) {
94
+ // exec only on completed connection.
95
  $data[] = array(
96
  'name' => 'status-' . $key,
97
  'value' => $this->get_status_on_add_subscriber( $key, $submitted_data, $addon_setting_value, $form_entry_fields ),
106
  * @since 1.3
107
  *
108
  * @param array $entry_fields
109
+ * @param int $form_id current Form ID.
110
  * @param array $submitted_data
111
+ * @param Forminator_Addon_Aweber_Form_Settings $form_settings_instance AWeber Addon Form Settings instance.
112
  */
113
  $data = apply_filters(
114
  'forminator_addon_aweber_entry_fields',
135
  * @return array `is_sent` true means its success send data to AWeber, false otherwise
136
  */
137
  private function get_status_on_add_subscriber( $connection_id, $submitted_data, $connection_settings, $form_entry_fields ) {
138
+ // initialize as null.
139
  $api = null;
140
 
141
  $form_id = $this->form_id;
173
  * @since 1.3
174
  *
175
  * @param array $args
176
+ * @param int $form_id Current Form id.
177
+ * @param string $connection_id ID of current connection.
178
  * @param array $submitted_data
179
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
180
+ * @param array $form_entry_fields default entry fields of form.
181
+ * @param array $form_settings Displayed Form settings.
182
+ * @param Forminator_Addon_Aweber_Form_Settings $form_settings_instance AWeber Addon Form Settings instance.
183
  */
184
  $args = apply_filters(
185
  'forminator_addon_aweber_find_subscriber_args',
205
  $existing_subscriber = $existing_subscriber_entries[0];
206
  if ( isset( $existing_subscriber->id ) ) {
207
  $subscriber_is_exist = true;
208
+ // https://labs.aweber.com/docs/reference/1.0#subscriber_entry.
209
  // you can not modify or delete Subscribers with a status of 'unconfirmed'.
210
  if ( isset( $existing_subscriber->status ) && 'unconfirmed' === $existing_subscriber->status ) {
211
  throw new Forminator_Addon_Aweber_Exception( __( 'Unconfirmed subscriber can\'t be modified.', 'forminator' ) );
214
  }
215
  }
216
 
217
+ // processed.
218
  unset( $fields_map['default_field_email'] );
219
 
220
  $name_element_id = $connection_settings['fields_map']['default_field_name'];
234
  $args['name'] = $name;
235
  }
236
 
237
+ // processed.
238
  unset( $fields_map['default_field_name'] );
239
 
240
  $custom_fields = array();
241
+ // process rest extra fields if available.
242
  foreach ( $fields_map as $field_id => $element_id ) {
243
  if ( ! empty( $element_id ) ) {
244
 
256
  }
257
 
258
  if ( isset( $fields_mapper[ $field_id ] ) && isset( $element_value ) ) {
259
+ $custom_fields[ $fields_mapper[ $field_id ] ] = (string) $element_value; // custom value must be string.
260
+ unset( $element_value ); // unset for next loop.
261
  }
262
  }
263
  }
268
  if ( isset( $connection_settings['ad_tracking'] ) && ! empty( $connection_settings['ad_tracking'] ) ) {
269
  $ad_tracking = $connection_settings['ad_tracking'];
270
 
271
+ // disable all_fields here.
272
  $ad_tracking = str_ireplace( '{all_fields}', '', $ad_tracking );
273
  $ad_tracking = forminator_addon_replace_custom_vars( $ad_tracking, $submitted_data, $this->custom_form, $form_entry_fields, false );
274
 
278
  * @since 1.2
279
  *
280
  * @param string $card_name
281
+ * @param int $form_id Current Form id.
282
+ * @param string $connection_id ID of current connection.
283
  * @param array $submitted_data
284
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
285
+ * @param array $form_entry_fields default entry fields of form.
286
+ * @param array $form_settings Displayed Form settings.
287
+ * @param Forminator_Addon_Aweber_Form_Settings $form_settings_instance AWeber Addon Form Settings instance.
288
  */
289
  $ad_tracking = apply_filters(
290
  'forminator_addon_aweber_subscriber_ad_tracking',
300
 
301
  if ( ! empty( $ad_tracking ) && is_string( $ad_tracking ) ) {
302
  if ( strlen( $ad_tracking ) > 20 ) {
303
+ // 20 chars max.
304
  $ad_tracking = substr( $ad_tracking, 0, 20 );
305
  }
306
  $args['ad_tracking'] = $ad_tracking;
313
  if ( stripos( $tag, '{' ) === 0
314
  && stripos( $tag, '}' ) === ( strlen( $tag ) - 1 )
315
  ) {
316
+ // translate to value.
317
  $element_id = str_ireplace( '{', '', $tag );
318
  $element_id = str_ireplace( '}', '', $element_id );
319
  if ( self::element_is_calculation( $element_id ) ) {
330
  }
331
 
332
  if ( isset( $element_value ) ) {
333
+ $tags[] = strtolower( (string) $element_value ); // tag must be string.
334
+ unset( $element_value ); // unset for next loop.
335
  }
336
  } else {
337
  $tags[] = strtolower( $tag );
344
  * @since 1.2
345
  *
346
  * @param string $card_name
347
+ * @param int $form_id Current Form id.
348
+ * @param string $connection_id ID of current connection.
349
  * @param array $submitted_data
350
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
351
+ * @param array $form_entry_fields default entry fields of form.
352
+ * @param array $form_settings Displayed Form settings.
353
+ * @param Forminator_Addon_Aweber_Form_Settings $form_settings_instance AWeber Addon Form Settings instance.
354
  */
355
  $tags = apply_filters(
356
  'forminator_addon_aweber_subscriber_tags',
378
  * @since 1.2
379
  *
380
  * @param string $card_name
381
+ * @param int $form_id Current Form id.
382
+ * @param string $connection_id ID of current connection.
383
  * @param array $submitted_data
384
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
385
+ * @param array $form_entry_fields default entry fields of form.
386
+ * @param array $form_settings Displayed Form settings.
387
+ * @param Forminator_Addon_Aweber_Form_Settings $form_settings_instance AWeber Addon Form Settings instance.
388
  */
389
  $ip_address = apply_filters(
390
  'forminator_addon_aweber_subscriber_ip_address',
407
  * @since 1.3
408
  *
409
  * @param array $args
410
+ * @param int $form_id Current Form id.
411
+ * @param string $connection_id ID of current connection.
412
  * @param array $submitted_data
413
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
414
+ * @param array $form_entry_fields default entry fields of form.
415
+ * @param array $form_settings Displayed Form settings.
416
+ * @param Forminator_Addon_Aweber_Form_Settings $form_settings_instance AWeber Addon Form Settings instance.
417
  */
418
  $args = apply_filters(
419
  'forminator_addon_aweber_add_subscriber_args',
433
  * subscribed, unconfirmed, unsubscribed status wont be updated
434
  * use hooks @see forminator_addon_aweber_update_subscriber_args, if needed
435
  */
436
+ // update if exist.
437
  $current_tags = array();
438
  if ( isset( $existing_subscriber->tags ) && is_array( $existing_subscriber->tags ) ) {
439
  $current_tags = $existing_subscriber->tags;
462
  * @since 1.3
463
  *
464
  * @param array $args
465
+ * @param int $form_id Current Form id.
466
+ * @param string $connection_id ID of current connection.
467
  * @param array $submitted_data
468
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
469
+ * @param array $form_entry_fields default entry fields of form.
470
+ * @param array $form_settings Displayed Form settings.
471
+ * @param Forminator_Addon_Aweber_Form_Settings $form_settings_instance AWeber Addon Form Settings instance.
472
  */
473
  $args = apply_filters(
474
  'forminator_addon_aweber_update_subscriber_args',
491
  'data_sent' => $api->get_last_data_sent(),
492
  'data_received' => $api->get_last_data_received(),
493
  'url_request' => $api->get_last_url_request(),
494
+ 'list_id' => $list_id, // for delete reference.
495
  );
496
 
497
  } catch ( Forminator_Addon_Aweber_Exception $e ) {
531
  * @since 1.3
532
  *
533
  * @param array $addon_meta_data
534
+ * @param int $form_id current Form ID.
535
+ * @param Forminator_Addon_Aweber_Form_Settings $form_settings_instance AWeber Addon Form Settings instance.
536
  */
537
  $addon_meta_data = apply_filters(
538
  'forminator_addon_aweber_metadata',
620
  }
621
 
622
  if ( Forminator_Addon_Aweber::is_show_full_log() ) {
623
+ // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_AWEBER_SHOW_FULL_LOG', true)`.
624
  if ( isset( $status['url_request'] ) ) {
625
  $sub_entries[] = array(
626
  'label' => __( 'API URL', 'forminator' ),
645
 
646
  $additional_entry_item['sub_entries'] = $sub_entries;
647
 
648
+ // return single array.
649
  return $additional_entry_item;
650
  }
651
 
670
  *
671
  * @since 1.3
672
  *
673
+ * @param array $export_headers headers to be displayed on export file.
674
+ * @param int $form_id current Form ID.
675
+ * @param Forminator_Addon_Aweber_Form_Settings $form_settings_instance AWeber Addon Form Settings instance.
676
  */
677
  $export_headers = apply_filters(
678
  'forminator_addon_aweber_export_headers',
707
  * @since 1.3
708
  *
709
  * @param array $addon_meta_data
710
+ * @param int $form_id current Form ID.
711
+ * @param Forminator_Addon_Aweber_Form_Settings $form_settings_instance AWeber Form Settings instance.
712
  */
713
  $addon_meta_data = apply_filters(
714
  'forminator_addon_aweber_metadata',
726
  *
727
  * @since 1.3
728
  *
729
+ * @param array $export_columns column to be exported.
730
+ * @param int $form_id current Form ID.
731
+ * @param Forminator_Form_Entry_Model $entry_model Form Entry Model.
732
+ * @param array $addon_meta_data meta data saved by addon on entry fields.
733
+ * @param Forminator_Addon_Aweber_Form_Settings $form_settings_instance AWeber Addon Form Settings instance.
734
  */
735
  $export_columns = apply_filters(
736
  'forminator_addon_aweber_export_columns',
763
 
764
  $addon_meta_data = $addon_meta_data[0];
765
 
766
+ // make sure its `status`, because we only add this.
767
  if ( 'status' !== $addon_meta_data['name'] ) {
768
  if ( stripos( $addon_meta_data['name'], 'status-' ) === 0 ) {
769
  $meta_data = array();
770
  foreach ( $addon_meta_datas as $addon_meta_data ) {
771
+ // make it like single value so it will be processed like single meta data.
772
  $addon_meta_data['name'] = 'status';
773
 
774
+ // add it on an array for next recursive process.
775
  $meta_data[] = $this->get_from_addon_meta_data( array( $addon_meta_data ), $key, $default );
776
  }
777
 
800
  return $default;
801
  }
802
 
803
+ // /**
804
+ // * DELETE NOT SUPPORTED HERE, BECAUSE AWEBER API NOT RETURNING SUBSCRIBER ID ON CREATE SUBSCRIBER.
805
+ // *.
806
+ // * @param Forminator_Form_Entry_Model $entry_model.
807
+ // * @param $addon_meta_data.
808
+ // */.
809
+ // public function on_before_delete_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {.
810
+ // parent::on_before_delete_entry( $entry_model, $addon_meta_data );.
811
+ // }.
812
  }
addons/pro/aweber/class-forminator-addon-aweber-form-settings.php CHANGED
@@ -42,7 +42,7 @@ class Forminator_Addon_Aweber_Form_Settings extends Forminator_Addon_Form_Settin
42
  * @return array
43
  */
44
  public function form_settings_wizards() {
45
- // numerical array steps
46
  return array(
47
  array(
48
  'callback' => array( $this, 'pick_name' ),
@@ -317,11 +317,11 @@ class Forminator_Addon_Aweber_Form_Settings extends Forminator_Addon_Form_Settin
317
  $multi_id = $submitted_data['multi_id'];
318
  unset( $submitted_data['multi_id'] );
319
 
320
- // find type of email
321
  $email_fields = array();
322
  $forminator_field_element_ids = array();
323
  foreach ( $this->form_fields as $form_field ) {
324
- // collect element ids
325
  $forminator_field_element_ids[] = $form_field['element_id'];
326
  if ( 'email' === $form_field['type'] ) {
327
  $email_fields[] = $form_field;
@@ -524,7 +524,7 @@ class Forminator_Addon_Aweber_Form_Settings extends Forminator_Addon_Form_Settin
524
  }
525
  $tag_selected_fields = array();
526
  foreach ( $saved_tags as $key => $saved_tag ) {
527
- // using form data
528
  if ( stripos( $saved_tag, '{' ) === 0
529
  && stripos( $saved_tag, '}' ) === ( strlen( $saved_tag ) - 1 )
530
  ) {
@@ -539,10 +539,10 @@ class Forminator_Addon_Aweber_Form_Settings extends Forminator_Addon_Form_Settin
539
  // let this go, its already selected.
540
  unset( $forminator_form_element_ids[ $element_id ] );
541
  } else {
542
- // no more exist on element ids let it go
543
  unset( $saved_tags[ $key ] );
544
  }
545
- } else { // free form type
546
  $tag_selected_fields[] = array(
547
  'element_id' => $saved_tag,
548
  'field_label' => $saved_tag,
@@ -621,7 +621,7 @@ class Forminator_Addon_Aweber_Form_Settings extends Forminator_Addon_Form_Settin
621
  * @return bool
622
  */
623
  public function setup_options_is_completed( $submitted_data ) {
624
- // all settings here are optional, so it can be marked as completed
625
  return true;
626
  }
627
 
@@ -677,7 +677,7 @@ class Forminator_Addon_Aweber_Form_Settings extends Forminator_Addon_Form_Settin
677
  foreach ( $this->get_form_settings_values() as $key => $value ) {
678
  $multi_ids[] = array(
679
  'id' => $key,
680
- // use name that was added by user on creating connection
681
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
682
  );
683
  }
@@ -693,7 +693,7 @@ class Forminator_Addon_Aweber_Form_Settings extends Forminator_Addon_Form_Settin
693
  * @param array $submitted_data
694
  */
695
  public function disconnect_form( $submitted_data ) {
696
- // only execute if multi_id provided on submitted data
697
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
698
  $addon_form_settings = $this->get_form_settings_values();
699
  unset( $addon_form_settings[ $submitted_data['multi_id'] ] );
42
  * @return array
43
  */
44
  public function form_settings_wizards() {
45
+ // numerical array steps.
46
  return array(
47
  array(
48
  'callback' => array( $this, 'pick_name' ),
317
  $multi_id = $submitted_data['multi_id'];
318
  unset( $submitted_data['multi_id'] );
319
 
320
+ // find type of email.
321
  $email_fields = array();
322
  $forminator_field_element_ids = array();
323
  foreach ( $this->form_fields as $form_field ) {
324
+ // collect element ids.
325
  $forminator_field_element_ids[] = $form_field['element_id'];
326
  if ( 'email' === $form_field['type'] ) {
327
  $email_fields[] = $form_field;
524
  }
525
  $tag_selected_fields = array();
526
  foreach ( $saved_tags as $key => $saved_tag ) {
527
+ // using form data.
528
  if ( stripos( $saved_tag, '{' ) === 0
529
  && stripos( $saved_tag, '}' ) === ( strlen( $saved_tag ) - 1 )
530
  ) {
539
  // let this go, its already selected.
540
  unset( $forminator_form_element_ids[ $element_id ] );
541
  } else {
542
+ // no more exist on element ids let it go.
543
  unset( $saved_tags[ $key ] );
544
  }
545
+ } else { // free form type.
546
  $tag_selected_fields[] = array(
547
  'element_id' => $saved_tag,
548
  'field_label' => $saved_tag,
621
  * @return bool
622
  */
623
  public function setup_options_is_completed( $submitted_data ) {
624
+ // all settings here are optional, so it can be marked as completed.
625
  return true;
626
  }
627
 
677
  foreach ( $this->get_form_settings_values() as $key => $value ) {
678
  $multi_ids[] = array(
679
  'id' => $key,
680
+ // use name that was added by user on creating connection.
681
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
682
  );
683
  }
693
  * @param array $submitted_data
694
  */
695
  public function disconnect_form( $submitted_data ) {
696
+ // only execute if multi_id provided on submitted data.
697
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
698
  $addon_form_settings = $this->get_form_settings_values();
699
  unset( $addon_form_settings[ $submitted_data['multi_id'] ] );
addons/pro/aweber/class-forminator-addon-aweber-quiz-hooks.php CHANGED
@@ -63,8 +63,8 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
63
  * @since 1.3
64
  *
65
  * @param array $submitted_data
66
- * @param int $quiz_id current Quiz ID
67
- * @param Forminator_Addon_Aweber_Quiz_Settings $quiz_settings_instance AWeber Addon Quiz Settings instance
68
  */
69
  $submitted_data = apply_filters(
70
  'forminator_addon_aweber_quiz_submitted_data',
@@ -91,16 +91,16 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
91
  *
92
  * @since 1.3
93
  *
94
- * @param int $quiz_id current Quiz ID
95
  * @param array $submitted_data
96
- * @param Forminator_Addon_Aweber_Quiz_Settings $quiz_settings_instance AWeber Addon Quiz Settings instance
97
  */
98
  do_action( 'forminator_addon_aweber_before_add_subscriber', $quiz_id, $submitted_data, $quiz_settings_instance );
99
 
100
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
101
- // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to aweber
102
  if ( $quiz_settings_instance->is_multi_quiz_settings_complete( $key ) ) {
103
- // exec only on completed connection
104
  $data[] = array(
105
  'name' => 'status-' . $key,
106
  'value' => $this->get_status_on_add_subscriber( $key, $submitted_data, $addon_setting_value, $form_entry_fields, $lead_submitted_data ),
@@ -115,9 +115,9 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
115
  * @since 1.3
116
  *
117
  * @param array $entry_fields
118
- * @param int $quiz_id current Quiz ID
119
  * @param array $submitted_data
120
- * @param Forminator_Addon_Aweber_Quiz_Settings $quiz_settings_instance AWeber Addon Quiz Settings instance
121
  */
122
  $data = apply_filters(
123
  'forminator_addon_aweber_entry_fields',
@@ -144,7 +144,7 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
144
  * @return array `is_sent` true means its success send data to AWeber, false otherwise
145
  */
146
  private function get_status_on_add_subscriber( $connection_id, $submitted_data, $connection_settings, $form_entry_fields, $lead_submitted_data ) {
147
- // initialize as null
148
  $api = null;
149
 
150
  $quiz_id = $this->quiz_id;
@@ -182,13 +182,13 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
182
  * @since 1.3
183
  *
184
  * @param array $args
185
- * @param int $quiz_id Current Quiz id
186
- * @param string $connection_id ID of current connection
187
  * @param array $submitted_data
188
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
189
- * @param array $form_entry_fields default entry fields of quiz
190
- * @param array $quiz_settings Displayed Quiz settings
191
- * @param Forminator_Addon_Aweber_Quiz_Settings $quiz_settings_instance AWeber Addon Quiz Settings instance
192
  */
193
  $args = apply_filters(
194
  'forminator_addon_aweber_find_subscriber_args',
@@ -214,7 +214,7 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
214
  $existing_subscriber = $existing_subscriber_entries[0];
215
  if ( isset( $existing_subscriber->id ) ) {
216
  $subscriber_is_exist = true;
217
- // https://labs.aweber.com/docs/reference/1.0#subscriber_entry
218
  // you can not modify or delete Subscribers with a status of 'unconfirmed'.
219
  if ( isset( $existing_subscriber->status ) && 'unconfirmed' === $existing_subscriber->status ) {
220
  throw new Forminator_Addon_Aweber_Exception( __( 'Unconfirmed subscriber can\'t be modified.', 'forminator' ) );
@@ -223,7 +223,7 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
223
  }
224
  }
225
 
226
- // processed
227
  unset( $fields_map['default_field_email'] );
228
 
229
  $name_element_id = $connection_settings['fields_map']['default_field_name'];
@@ -237,11 +237,11 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
237
  $args['name'] = $name;
238
  }
239
 
240
- // processed
241
  unset( $fields_map['default_field_name'] );
242
 
243
  $custom_fields = array();
244
- // process rest extra fields if available
245
  foreach ( $fields_map as $field_id => $element_id ) {
246
  if ( ! empty( $element_id ) ) {
247
 
@@ -253,8 +253,8 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
253
  }
254
 
255
  if ( isset( $fields_mapper[ $field_id ] ) && isset( $element_value ) ) {
256
- $custom_fields[ $fields_mapper[ $field_id ] ] = (string) $element_value; // custom value must be string
257
- unset( $element_value ); // unset for next loop
258
  }
259
  }
260
  }
@@ -265,7 +265,7 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
265
  if ( isset( $connection_settings['ad_tracking'] ) && ! empty( $connection_settings['ad_tracking'] ) ) {
266
  $ad_tracking = $connection_settings['ad_tracking'];
267
 
268
- // disable all_fields here
269
  $ad_tracking = str_ireplace( '{all_fields}', '', $ad_tracking );
270
  $ad_tracking = str_ireplace( '{quiz_name}', forminator_get_name_from_model( $this->quiz ), $ad_tracking );
271
  $ad_tracking = forminator_addon_replace_custom_vars( $ad_tracking, $lead_submitted_data, $this->lead_model, $form_entry_fields, false );
@@ -275,13 +275,13 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
275
  * @since 1.2
276
  *
277
  * @param string $card_name
278
- * @param int $quiz_id Current Quiz id
279
- * @param string $connection_id ID of current connection
280
  * @param array $submitted_data
281
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
282
- * @param array $form_entry_fields default entry fields of quiz
283
- * @param array $quiz_settings Displayed Quiz settings
284
- * @param Forminator_Addon_Aweber_Quiz_Settings $quiz_settings_instance AWeber Addon Quiz Settings instance
285
  */
286
  $ad_tracking = apply_filters(
287
  'forminator_addon_aweber_subscriber_ad_tracking',
@@ -297,7 +297,7 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
297
 
298
  if ( ! empty( $ad_tracking ) && is_string( $ad_tracking ) ) {
299
  if ( strlen( $ad_tracking ) > 20 ) {
300
- // 20 chars max
301
  $ad_tracking = substr( $ad_tracking, 0, 20 );
302
  }
303
  $args['ad_tracking'] = $ad_tracking;
@@ -310,7 +310,7 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
310
  if ( stripos( $tag, '{' ) === 0
311
  && stripos( $tag, '}' ) === ( strlen( $tag ) - 1 )
312
  ) {
313
- // translate to value
314
  $element_id = str_ireplace( '{', '', $tag );
315
  $element_id = str_ireplace( '}', '', $element_id );
316
  if ( isset( $submitted_data[ $element_id ] ) && ! empty( $submitted_data[ $element_id ] ) ) {
@@ -321,8 +321,8 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
321
  }
322
 
323
  if ( isset( $element_value ) ) {
324
- $tags[] = strtolower( (string) $element_value ); // tag must be string
325
- unset( $element_value ); // unset for next loop
326
  }
327
  } else {
328
  $tags[] = strtolower( $tag );
@@ -335,13 +335,13 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
335
  * @since 1.2
336
  *
337
  * @param string $card_name
338
- * @param int $quiz_id Current Quiz id
339
- * @param string $connection_id ID of current connection
340
  * @param array $submitted_data
341
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
342
- * @param array $form_entry_fields default entry fields of quiz
343
- * @param array $quiz_settings Displayed Quiz settings
344
- * @param Forminator_Addon_Aweber_Quiz_Settings $quiz_settings_instance AWeber Addon Quiz Settings instance
345
  */
346
  $tags = apply_filters(
347
  'forminator_addon_aweber_subscriber_tags',
@@ -369,13 +369,13 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
369
  * @since 1.2
370
  *
371
  * @param string $card_name
372
- * @param int $quiz_id Current Quiz id
373
- * @param string $connection_id ID of current connection
374
  * @param array $submitted_data
375
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
376
- * @param array $form_entry_fields default entry fields of quiz
377
- * @param array $quiz_settings Displayed Quiz settings
378
- * @param Forminator_Addon_Aweber_Quiz_Settings $quiz_settings_instance AWeber Addon Quiz Settings instance
379
  */
380
  $ip_address = apply_filters(
381
  'forminator_addon_aweber_subscriber_ip_address',
@@ -398,13 +398,13 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
398
  * @since 1.3
399
  *
400
  * @param array $args
401
- * @param int $quiz_id Current Quiz id
402
- * @param string $connection_id ID of current connection
403
  * @param array $submitted_data
404
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
405
- * @param array $form_entry_fields default entry fields of quiz
406
- * @param array $quiz_settings Displayed Quiz settings
407
- * @param Forminator_Addon_Aweber_Quiz_Settings $quiz_settings_instance AWeber Addon Quiz Settings instance
408
  */
409
  $args = apply_filters(
410
  'forminator_addon_aweber_add_subscriber_args',
@@ -426,7 +426,7 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
426
  * subscribed, unconfirmed, unsubscribed status wont be updated
427
  * use hooks @see forminator_addon_aweber_update_subscriber_args, if needed
428
  */
429
- // update if exist
430
  $current_tags = array();
431
  if ( isset( $existing_subscriber->tags ) && is_array( $existing_subscriber->tags ) ) {
432
  $current_tags = $existing_subscriber->tags;
@@ -455,13 +455,13 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
455
  * @since 1.3
456
  *
457
  * @param array $args
458
- * @param int $quiz_id Current Quiz id
459
- * @param string $connection_id ID of current connection
460
  * @param array $submitted_data
461
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
462
- * @param array $form_entry_fields default entry fields of quiz
463
- * @param array $quiz_settings Displayed Quiz settings
464
- * @param Forminator_Addon_Aweber_Quiz_Settings $quiz_settings_instance AWeber Addon Quiz Settings instance
465
  */
466
  $args = apply_filters(
467
  'forminator_addon_aweber_update_subscriber_args',
@@ -485,7 +485,7 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
485
  'data_sent' => $api->get_last_data_sent(),
486
  'data_received' => $api->get_last_data_received(),
487
  'url_request' => $api->get_last_url_request(),
488
- 'list_id' => $list_id, // for delete reference
489
  );
490
 
491
  } catch ( Forminator_Addon_Aweber_Exception $e ) {
@@ -525,8 +525,8 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
525
  * @since 1.3
526
  *
527
  * @param array $addon_meta_data
528
- * @param int $quiz_id current Quiz ID
529
- * @param Forminator_Addon_Aweber_Quiz_Settings $quiz_settings_instance AWeber Addon Quiz Settings instance
530
  */
531
  $addon_meta_data = apply_filters(
532
  'forminator_addon_aweber_metadata',
@@ -614,7 +614,7 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
614
  }
615
 
616
  if ( Forminator_Addon_Aweber::is_show_full_log() ) {
617
- // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_AWEBER_SHOW_FULL_LOG', true)`
618
  if ( isset( $status['url_request'] ) ) {
619
  $sub_entries[] = array(
620
  'label' => __( 'API URL', 'forminator' ),
@@ -639,7 +639,7 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
639
 
640
  $additional_entry_item['sub_entries'] = $sub_entries;
641
 
642
- // return single array
643
  return $additional_entry_item;
644
  }
645
 
@@ -664,9 +664,9 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
664
  *
665
  * @since 1.3
666
  *
667
- * @param array $export_headers headers to be displayed on export file
668
- * @param int $quiz_id current Quiz ID
669
- * @param Forminator_Addon_Aweber_Quiz_Settings $quiz_settings_instance AWeber Addon Quiz Settings instance
670
  */
671
  $export_headers = apply_filters(
672
  'forminator_addon_aweber_export_headers',
@@ -701,8 +701,8 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
701
  * @since 1.3
702
  *
703
  * @param array $addon_meta_data
704
- * @param int $quiz_id current Quiz ID
705
- * @param Forminator_Addon_Aweber_Quiz_Settings $quiz_settings_instance AWeber Quiz Settings instance
706
  */
707
  $addon_meta_data = apply_filters(
708
  'forminator_addon_aweber_metadata',
@@ -720,11 +720,11 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
720
  *
721
  * @since 1.3
722
  *
723
- * @param array $export_columns column to be exported
724
- * @param int $quiz_id current Quiz ID
725
- * @param Forminator_Form_Entry_Model $entry_model Form Entry Model
726
- * @param array $addon_meta_data meta data saved by addon on entry fields
727
- * @param Forminator_Addon_Aweber_Quiz_Settings $quiz_settings_instance AWeber Addon Quiz Settings instance
728
  */
729
  $export_columns = apply_filters(
730
  'forminator_addon_aweber_export_columns',
@@ -757,15 +757,15 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
757
 
758
  $addon_meta_data = $addon_meta_data[0];
759
 
760
- // make sure its `status`, because we only add this
761
  if ( 'status' !== $addon_meta_data['name'] ) {
762
  if ( stripos( $addon_meta_data['name'], 'status-' ) === 0 ) {
763
  $meta_data = array();
764
  foreach ( $addon_meta_datas as $addon_meta_data ) {
765
- // make it like single value so it will be processed like single meta data
766
  $addon_meta_data['name'] = 'status';
767
 
768
- // add it on an array for next recursive process
769
  $meta_data[] = $this->get_from_addon_meta_data( array( $addon_meta_data ), $key, $default );
770
  }
771
 
@@ -794,13 +794,13 @@ class Forminator_Addon_Aweber_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
794
  return $default;
795
  }
796
 
797
- // /**
798
- // * DELETE NOT SUPPORTED HERE, BECAUSE AWEBER API NOT RETURNING SUBSCRIBER ID ON CREATE SUBSCRIBER
799
- // *
800
- // * @param Forminator_Form_Entry_Model $entry_model
801
- // * @param $addon_meta_data
802
- // */
803
- // public function on_before_delete_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {
804
- // parent::on_before_delete_entry( $entry_model, $addon_meta_data );
805
- // }
806
  }
63
  * @since 1.3
64
  *
65
  * @param array $submitted_data
66
+ * @param int $quiz_id current Quiz ID.
67
+ * @param Forminator_Addon_Aweber_Quiz_Settings $quiz_settings_instance AWeber Addon Quiz Settings instance.
68
  */
69
  $submitted_data = apply_filters(
70
  'forminator_addon_aweber_quiz_submitted_data',
91
  *
92
  * @since 1.3
93
  *
94
+ * @param int $quiz_id current Quiz ID.
95
  * @param array $submitted_data
96
+ * @param Forminator_Addon_Aweber_Quiz_Settings $quiz_settings_instance AWeber Addon Quiz Settings instance.
97
  */
98
  do_action( 'forminator_addon_aweber_before_add_subscriber', $quiz_id, $submitted_data, $quiz_settings_instance );
99
 
100
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
101
+ // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to aweber.
102
  if ( $quiz_settings_instance->is_multi_quiz_settings_complete( $key ) ) {
103
+ // exec only on completed connection.
104
  $data[] = array(
105
  'name' => 'status-' . $key,
106
  'value' => $this->get_status_on_add_subscriber( $key, $submitted_data, $addon_setting_value, $form_entry_fields, $lead_submitted_data ),
115
  * @since 1.3
116
  *
117
  * @param array $entry_fields
118
+ * @param int $quiz_id current Quiz ID.
119
  * @param array $submitted_data
120
+ * @param Forminator_Addon_Aweber_Quiz_Settings $quiz_settings_instance AWeber Addon Quiz Settings instance.
121
  */
122
  $data = apply_filters(
123
  'forminator_addon_aweber_entry_fields',
144
  * @return array `is_sent` true means its success send data to AWeber, false otherwise
145
  */
146
  private function get_status_on_add_subscriber( $connection_id, $submitted_data, $connection_settings, $form_entry_fields, $lead_submitted_data ) {
147
+ // initialize as null.
148
  $api = null;
149
 
150
  $quiz_id = $this->quiz_id;
182
  * @since 1.3
183
  *
184
  * @param array $args
185
+ * @param int $quiz_id Current Quiz id.
186
+ * @param string $connection_id ID of current connection.
187
  * @param array $submitted_data
188
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
189
+ * @param array $form_entry_fields default entry fields of quiz.
190
+ * @param array $quiz_settings Displayed Quiz settings.
191
+ * @param Forminator_Addon_Aweber_Quiz_Settings $quiz_settings_instance AWeber Addon Quiz Settings instance.
192
  */
193
  $args = apply_filters(
194
  'forminator_addon_aweber_find_subscriber_args',
214
  $existing_subscriber = $existing_subscriber_entries[0];
215
  if ( isset( $existing_subscriber->id ) ) {
216
  $subscriber_is_exist = true;
217
+ // https://labs.aweber.com/docs/reference/1.0#subscriber_entry.
218
  // you can not modify or delete Subscribers with a status of 'unconfirmed'.
219
  if ( isset( $existing_subscriber->status ) && 'unconfirmed' === $existing_subscriber->status ) {
220
  throw new Forminator_Addon_Aweber_Exception( __( 'Unconfirmed subscriber can\'t be modified.', 'forminator' ) );
223
  }
224
  }
225
 
226
+ // processed.
227
  unset( $fields_map['default_field_email'] );
228
 
229
  $name_element_id = $connection_settings['fields_map']['default_field_name'];
237
  $args['name'] = $name;
238
  }
239
 
240
+ // processed.
241
  unset( $fields_map['default_field_name'] );
242
 
243
  $custom_fields = array();
244
+ // process rest extra fields if available.
245
  foreach ( $fields_map as $field_id => $element_id ) {
246
  if ( ! empty( $element_id ) ) {
247
 
253
  }
254
 
255
  if ( isset( $fields_mapper[ $field_id ] ) && isset( $element_value ) ) {
256
+ $custom_fields[ $fields_mapper[ $field_id ] ] = (string) $element_value; // custom value must be string.
257
+ unset( $element_value ); // unset for next loop.
258
  }
259
  }
260
  }
265
  if ( isset( $connection_settings['ad_tracking'] ) && ! empty( $connection_settings['ad_tracking'] ) ) {
266
  $ad_tracking = $connection_settings['ad_tracking'];
267
 
268
+ // disable all_fields here.
269
  $ad_tracking = str_ireplace( '{all_fields}', '', $ad_tracking );
270
  $ad_tracking = str_ireplace( '{quiz_name}', forminator_get_name_from_model( $this->quiz ), $ad_tracking );
271
  $ad_tracking = forminator_addon_replace_custom_vars( $ad_tracking, $lead_submitted_data, $this->lead_model, $form_entry_fields, false );
275
  * @since 1.2
276
  *
277
  * @param string $card_name
278
+ * @param int $quiz_id Current Quiz id.
279
+ * @param string $connection_id ID of current connection.
280
  * @param array $submitted_data
281
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
282
+ * @param array $form_entry_fields default entry fields of quiz.
283
+ * @param array $quiz_settings Displayed Quiz settings.
284
+ * @param Forminator_Addon_Aweber_Quiz_Settings $quiz_settings_instance AWeber Addon Quiz Settings instance.
285
  */
286
  $ad_tracking = apply_filters(
287
  'forminator_addon_aweber_subscriber_ad_tracking',
297
 
298
  if ( ! empty( $ad_tracking ) && is_string( $ad_tracking ) ) {
299
  if ( strlen( $ad_tracking ) > 20 ) {
300
+ // 20 chars max.
301
  $ad_tracking = substr( $ad_tracking, 0, 20 );
302
  }
303
  $args['ad_tracking'] = $ad_tracking;
310
  if ( stripos( $tag, '{' ) === 0
311
  && stripos( $tag, '}' ) === ( strlen( $tag ) - 1 )
312
  ) {
313
+ // translate to value.
314
  $element_id = str_ireplace( '{', '', $tag );
315
  $element_id = str_ireplace( '}', '', $element_id );
316
  if ( isset( $submitted_data[ $element_id ] ) && ! empty( $submitted_data[ $element_id ] ) ) {
321
  }
322
 
323
  if ( isset( $element_value ) ) {
324
+ $tags[] = strtolower( (string) $element_value ); // tag must be string.
325
+ unset( $element_value ); // unset for next loop.
326
  }
327
  } else {
328
  $tags[] = strtolower( $tag );
335
  * @since 1.2
336
  *
337
  * @param string $card_name
338
+ * @param int $quiz_id Current Quiz id.
339
+ * @param string $connection_id ID of current connection.
340
  * @param array $submitted_data
341
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
342
+ * @param array $form_entry_fields default entry fields of quiz.
343
+ * @param array $quiz_settings Displayed Quiz settings.
344
+ * @param Forminator_Addon_Aweber_Quiz_Settings $quiz_settings_instance AWeber Addon Quiz Settings instance.
345
  */
346
  $tags = apply_filters(
347
  'forminator_addon_aweber_subscriber_tags',
369
  * @since 1.2
370
  *
371
  * @param string $card_name
372
+ * @param int $quiz_id Current Quiz id.
373
+ * @param string $connection_id ID of current connection.
374
  * @param array $submitted_data
375
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
376
+ * @param array $form_entry_fields default entry fields of quiz.
377
+ * @param array $quiz_settings Displayed Quiz settings.
378
+ * @param Forminator_Addon_Aweber_Quiz_Settings $quiz_settings_instance AWeber Addon Quiz Settings instance.
379
  */
380
  $ip_address = apply_filters(
381
  'forminator_addon_aweber_subscriber_ip_address',
398
  * @since 1.3
399
  *
400
  * @param array $args
401
+ * @param int $quiz_id Current Quiz id.
402
+ * @param string $connection_id ID of current connection.
403
  * @param array $submitted_data
404
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
405
+ * @param array $form_entry_fields default entry fields of quiz.
406
+ * @param array $quiz_settings Displayed Quiz settings.
407
+ * @param Forminator_Addon_Aweber_Quiz_Settings $quiz_settings_instance AWeber Addon Quiz Settings instance.
408
  */
409
  $args = apply_filters(
410
  'forminator_addon_aweber_add_subscriber_args',
426
  * subscribed, unconfirmed, unsubscribed status wont be updated
427
  * use hooks @see forminator_addon_aweber_update_subscriber_args, if needed
428
  */
429
+ // update if exist.
430
  $current_tags = array();
431
  if ( isset( $existing_subscriber->tags ) && is_array( $existing_subscriber->tags ) ) {
432
  $current_tags = $existing_subscriber->tags;
455
  * @since 1.3
456
  *
457
  * @param array $args
458
+ * @param int $quiz_id Current Quiz id.
459
+ * @param string $connection_id ID of current connection.
460
  * @param array $submitted_data
461
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
462
+ * @param array $form_entry_fields default entry fields of quiz.
463
+ * @param array $quiz_settings Displayed Quiz settings.
464
+ * @param Forminator_Addon_Aweber_Quiz_Settings $quiz_settings_instance AWeber Addon Quiz Settings instance.
465
  */
466
  $args = apply_filters(
467
  'forminator_addon_aweber_update_subscriber_args',
485
  'data_sent' => $api->get_last_data_sent(),
486
  'data_received' => $api->get_last_data_received(),
487
  'url_request' => $api->get_last_url_request(),
488
+ 'list_id' => $list_id, // for delete reference.
489
  );
490
 
491
  } catch ( Forminator_Addon_Aweber_Exception $e ) {
525
  * @since 1.3
526
  *
527
  * @param array $addon_meta_data
528
+ * @param int $quiz_id current Quiz ID.
529
+ * @param Forminator_Addon_Aweber_Quiz_Settings $quiz_settings_instance AWeber Addon Quiz Settings instance.
530
  */
531
  $addon_meta_data = apply_filters(
532
  'forminator_addon_aweber_metadata',
614
  }
615
 
616
  if ( Forminator_Addon_Aweber::is_show_full_log() ) {
617
+ // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_AWEBER_SHOW_FULL_LOG', true)`.
618
  if ( isset( $status['url_request'] ) ) {
619
  $sub_entries[] = array(
620
  'label' => __( 'API URL', 'forminator' ),
639
 
640
  $additional_entry_item['sub_entries'] = $sub_entries;
641
 
642
+ // return single array.
643
  return $additional_entry_item;
644
  }
645
 
664
  *
665
  * @since 1.3
666
  *
667
+ * @param array $export_headers headers to be displayed on export file.
668
+ * @param int $quiz_id current Quiz ID.
669
+ * @param Forminator_Addon_Aweber_Quiz_Settings $quiz_settings_instance AWeber Addon Quiz Settings instance.
670
  */
671
  $export_headers = apply_filters(
672
  'forminator_addon_aweber_export_headers',
701
  * @since 1.3
702
  *
703
  * @param array $addon_meta_data
704
+ * @param int $quiz_id current Quiz ID.
705
+ * @param Forminator_Addon_Aweber_Quiz_Settings $quiz_settings_instance AWeber Quiz Settings instance.
706
  */
707
  $addon_meta_data = apply_filters(
708
  'forminator_addon_aweber_metadata',
720
  *
721
  * @since 1.3
722
  *
723
+ * @param array $export_columns column to be exported.
724
+ * @param int $quiz_id current Quiz ID.
725
+ * @param Forminator_Form_Entry_Model $entry_model Form Entry Model.
726
+ * @param array $addon_meta_data meta data saved by addon on entry fields.
727
+ * @param Forminator_Addon_Aweber_Quiz_Settings $quiz_settings_instance AWeber Addon Quiz Settings instance.
728
  */
729
  $export_columns = apply_filters(
730
  'forminator_addon_aweber_export_columns',
757
 
758
  $addon_meta_data = $addon_meta_data[0];
759
 
760
+ // make sure its `status`, because we only add this.
761
  if ( 'status' !== $addon_meta_data['name'] ) {
762
  if ( stripos( $addon_meta_data['name'], 'status-' ) === 0 ) {
763
  $meta_data = array();
764
  foreach ( $addon_meta_datas as $addon_meta_data ) {
765
+ // make it like single value so it will be processed like single meta data.
766
  $addon_meta_data['name'] = 'status';
767
 
768
+ // add it on an array for next recursive process.
769
  $meta_data[] = $this->get_from_addon_meta_data( array( $addon_meta_data ), $key, $default );
770
  }
771
 
794
  return $default;
795
  }
796
 
797
+ // /**
798
+ // * DELETE NOT SUPPORTED HERE, BECAUSE AWEBER API NOT RETURNING SUBSCRIBER ID ON CREATE SUBSCRIBER.
799
+ // *.
800
+ // * @param Forminator_Form_Entry_Model $entry_model.
801
+ // * @param $addon_meta_data.
802
+ // */.
803
+ // public function on_before_delete_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {.
804
+ // parent::on_before_delete_entry( $entry_model, $addon_meta_data );.
805
+ // }.
806
  }
addons/pro/aweber/class-forminator-addon-aweber-quiz-settings.php CHANGED
@@ -42,7 +42,7 @@ class Forminator_Addon_Aweber_Quiz_Settings extends Forminator_Addon_Quiz_Settin
42
  * @return array
43
  */
44
  public function quiz_settings_wizards() {
45
- // numerical array steps
46
  return array(
47
  array(
48
  'callback' => array( $this, 'pick_name' ),
@@ -317,12 +317,12 @@ class Forminator_Addon_Aweber_Quiz_Settings extends Forminator_Addon_Quiz_Settin
317
  $multi_id = $submitted_data['multi_id'];
318
  unset( $submitted_data['multi_id'] );
319
 
320
- // find type of email
321
  $email_fields = array();
322
  $forminator_field_element_ids = array();
323
  $forminator_quiz_element_ids = array();
324
  foreach ( $this->form_fields as $form_field ) {
325
- // collect element ids
326
  $forminator_field_element_ids[] = $form_field['element_id'];
327
  if ( 'email' === $form_field['type'] ) {
328
  $email_fields[] = $form_field;
@@ -334,7 +334,7 @@ class Forminator_Addon_Aweber_Quiz_Settings extends Forminator_Addon_Quiz_Settin
334
  'quiz-name' => __( 'Quiz Name', 'forminator' ),
335
  );
336
  foreach ( $quiz_questions as $quiz_question ) {
337
- // collect element ids
338
  $forminator_quiz_element_ids[] = $quiz_question['slug'];
339
  $quiz_fields[ $quiz_question['slug'] ] = $quiz_question['title'];
340
  }
@@ -546,7 +546,7 @@ class Forminator_Addon_Aweber_Quiz_Settings extends Forminator_Addon_Quiz_Settin
546
  }
547
  $tag_selected_fields = array();
548
  foreach ( $saved_tags as $key => $saved_tag ) {
549
- // using form data
550
  if ( stripos( $saved_tag, '{' ) === 0
551
  && stripos( $saved_tag, '}' ) === ( strlen( $saved_tag ) - 1 )
552
  ) {
@@ -561,10 +561,10 @@ class Forminator_Addon_Aweber_Quiz_Settings extends Forminator_Addon_Quiz_Settin
561
  // let this go, its already selected.
562
  unset( $forminator_form_element_ids[ $element_id ] );
563
  } else {
564
- // no more exist on element ids let it go
565
  unset( $saved_tags[ $key ] );
566
  }
567
- } else { // free form type
568
  $tag_selected_fields[] = array(
569
  'element_id' => $saved_tag,
570
  'field_label' => $saved_tag,
@@ -643,7 +643,7 @@ class Forminator_Addon_Aweber_Quiz_Settings extends Forminator_Addon_Quiz_Settin
643
  * @return bool
644
  */
645
  public function setup_options_is_completed( $submitted_data ) {
646
- // all settings here are optional, so it can be marked as completed
647
  return true;
648
  }
649
 
@@ -699,7 +699,7 @@ class Forminator_Addon_Aweber_Quiz_Settings extends Forminator_Addon_Quiz_Settin
699
  foreach ( $this->get_quiz_settings_values() as $key => $value ) {
700
  $multi_ids[] = array(
701
  'id' => $key,
702
- // use name that was added by user on creating connection
703
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
704
  );
705
  }
@@ -715,7 +715,7 @@ class Forminator_Addon_Aweber_Quiz_Settings extends Forminator_Addon_Quiz_Settin
715
  * @param array $submitted_data
716
  */
717
  public function disconnect_form( $submitted_data ) {
718
- // only execute if multi_id provided on submitted data
719
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
720
  $addon_form_settings = $this->get_quiz_settings_values();
721
  unset( $addon_form_settings[ $submitted_data['multi_id'] ] );
42
  * @return array
43
  */
44
  public function quiz_settings_wizards() {
45
+ // numerical array steps.
46
  return array(
47
  array(
48
  'callback' => array( $this, 'pick_name' ),
317
  $multi_id = $submitted_data['multi_id'];
318
  unset( $submitted_data['multi_id'] );
319
 
320
+ // find type of email.
321
  $email_fields = array();
322
  $forminator_field_element_ids = array();
323
  $forminator_quiz_element_ids = array();
324
  foreach ( $this->form_fields as $form_field ) {
325
+ // collect element ids.
326
  $forminator_field_element_ids[] = $form_field['element_id'];
327
  if ( 'email' === $form_field['type'] ) {
328
  $email_fields[] = $form_field;
334
  'quiz-name' => __( 'Quiz Name', 'forminator' ),
335
  );
336
  foreach ( $quiz_questions as $quiz_question ) {
337
+ // collect element ids.
338
  $forminator_quiz_element_ids[] = $quiz_question['slug'];
339
  $quiz_fields[ $quiz_question['slug'] ] = $quiz_question['title'];
340
  }
546
  }
547
  $tag_selected_fields = array();
548
  foreach ( $saved_tags as $key => $saved_tag ) {
549
+ // using form data.
550
  if ( stripos( $saved_tag, '{' ) === 0
551
  && stripos( $saved_tag, '}' ) === ( strlen( $saved_tag ) - 1 )
552
  ) {
561
  // let this go, its already selected.
562
  unset( $forminator_form_element_ids[ $element_id ] );
563
  } else {
564
+ // no more exist on element ids let it go.
565
  unset( $saved_tags[ $key ] );
566
  }
567
+ } else { // free form type.
568
  $tag_selected_fields[] = array(
569
  'element_id' => $saved_tag,
570
  'field_label' => $saved_tag,
643
  * @return bool
644
  */
645
  public function setup_options_is_completed( $submitted_data ) {
646
+ // all settings here are optional, so it can be marked as completed.
647
  return true;
648
  }
649
 
699
  foreach ( $this->get_quiz_settings_values() as $key => $value ) {
700
  $multi_ids[] = array(
701
  'id' => $key,
702
+ // use name that was added by user on creating connection.
703
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
704
  );
705
  }
715
  * @param array $submitted_data
716
  */
717
  public function disconnect_form( $submitted_data ) {
718
+ // only execute if multi_id provided on submitted data.
719
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
720
  $addon_form_settings = $this->get_quiz_settings_values();
721
  unset( $addon_form_settings[ $submitted_data['multi_id'] ] );
addons/pro/aweber/class-forminator-addon-aweber.php CHANGED
@@ -46,7 +46,7 @@ final class Forminator_Addon_Aweber extends Forminator_Addon_Abstract {
46
  * @since 1.0 Aweber Addon
47
  */
48
  public function __construct() {
49
- // late init to allow translation
50
  $this->_description = __( 'Get awesome by your form.', 'forminator' );
51
  $this->_activation_error_message = __( 'Sorry but we failed to activate AWeber Integration, don\'t hesitate to contact us', 'forminator' );
52
  $this->_deactivation_error_message = __( 'Sorry but we failed to deactivate AWeber Integration, please try again', 'forminator' );
@@ -89,15 +89,15 @@ final class Forminator_Addon_Aweber extends Forminator_Addon_Abstract {
89
  */
90
  public function is_connected() {
91
  try {
92
- // check if its active
93
  if ( ! $this->is_active() ) {
94
  throw new Forminator_Addon_Aweber_Exception( __( 'AWeber is not active', 'forminator' ) );
95
  }
96
 
97
- // if user completed api setup
98
  $is_connected = false;
99
  $setting_values = $this->get_settings_values();
100
- // if user completed api setup
101
  if ( isset( $setting_values['account_id'] ) && ! empty( $setting_values['account_id'] ) ) {
102
  $is_connected = true;
103
  }
@@ -138,7 +138,7 @@ final class Forminator_Addon_Aweber extends Forminator_Addon_Abstract {
138
  throw new Forminator_Addon_Aweber_Exception( __( 'Invalid Form Settings of AWeber', 'forminator' ) );
139
  }
140
 
141
- // Mark as active when there is at least one active connection
142
  if ( false === $form_settings_instance->find_one_active_connection() ) {
143
  throw new Forminator_Addon_Aweber_Exception( __( 'No active AWeber connection found in this form', 'forminator' ) );
144
  }
@@ -155,8 +155,8 @@ final class Forminator_Addon_Aweber extends Forminator_Addon_Abstract {
155
  * @since 1.0
156
  *
157
  * @param bool $is_form_connected
158
- * @param int $form_id Current Form ID
159
- * @param Forminator_Addon_Aweber_Form_Settings|null $form_settings_instance Instance of form settings, or null when unavailable
160
  *
161
  */
162
  $is_form_connected = apply_filters( 'forminator_addon_aweber_is_form_connected', $is_form_connected, $form_id, $form_settings_instance );
@@ -297,7 +297,7 @@ final class Forminator_Addon_Aweber extends Forminator_Addon_Abstract {
297
  public function is_authorized( $submitted_data ) {
298
  $setting_values = $this->get_settings_values();
299
 
300
- // check account_id there
301
  return isset( $setting_values['account_id'] ) && ! empty( $setting_values['account_id'] );
302
  }
303
 
@@ -412,7 +412,7 @@ final class Forminator_Addon_Aweber extends Forminator_Addon_Abstract {
412
  $return_url = rawurlencode( $return_url );
413
 
414
  $auth_params = array(
415
- 'oauth_callback' => $return_url, // un-official https://labs.aweber.com/getting_started/public#1
416
  );
417
 
418
  /**
@@ -440,7 +440,7 @@ final class Forminator_Addon_Aweber extends Forminator_Addon_Abstract {
440
  */
441
  public function get_app_id() {
442
  $app_id = $this->_app_id;
443
- // check override by config constant
444
  if ( defined( 'FORMINATOR_ADDON_AWEBER_APP_ID' ) && FORMINATOR_ADDON_AWEBER_APP_ID ) {
445
  $app_id = FORMINATOR_ADDON_AWEBER_APP_ID;
446
  }
@@ -636,7 +636,7 @@ final class Forminator_Addon_Aweber extends Forminator_Addon_Abstract {
636
  throw new Forminator_Addon_Aweber_Exception( __( 'Invalid Quiz Settings of AWeber', 'forminator' ) );
637
  }
638
 
639
- // Mark as active when there is at least one active connection
640
  if ( false === $quiz_settings_instance->find_one_active_connection() ) {
641
  throw new Forminator_Addon_Aweber_Exception( __( 'No active AWeber connection found in this quiz', 'forminator' ) );
642
  }
@@ -653,8 +653,8 @@ final class Forminator_Addon_Aweber extends Forminator_Addon_Abstract {
653
  * @since 1.0
654
  *
655
  * @param bool $is_quiz_connected
656
- * @param int $quiz_id Current Quiz ID
657
- * @param Forminator_Addon_Aweber_Form_Settings|null $quiz_settings_instance Instance of quiz settings, or null when unavailable
658
  *
659
  */
660
  $is_quiz_connected = apply_filters( 'forminator_addon_aweber_is_form_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
@@ -675,7 +675,7 @@ final class Forminator_Addon_Aweber extends Forminator_Addon_Abstract {
675
  public function is_quiz_lead_connected( $quiz_id ) {
676
 
677
  try {
678
- // initialize with null
679
  $quiz_settings_instance = null;
680
  if ( ! $this->is_connected() ) {
681
  throw new Forminator_Addon_Aweber_Exception( __( ' AWeber is not connected', 'forminator' ) );
@@ -705,8 +705,8 @@ final class Forminator_Addon_Aweber extends Forminator_Addon_Abstract {
705
  * @since 1.1
706
  *
707
  * @param bool $is_quiz_connected
708
- * @param int $quiz_id Current Quiz ID
709
- * @param Forminator_Addon_Aweber_Quiz_Settings|null $quiz_settings_instance Instance of quiz settings, or null when unavailable
710
  *
711
  */
712
  $is_quiz_connected = apply_filters( 'forminator_addon_aweber_is_quiz_lead_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
46
  * @since 1.0 Aweber Addon
47
  */
48
  public function __construct() {
49
+ // late init to allow translation.
50
  $this->_description = __( 'Get awesome by your form.', 'forminator' );
51
  $this->_activation_error_message = __( 'Sorry but we failed to activate AWeber Integration, don\'t hesitate to contact us', 'forminator' );
52
  $this->_deactivation_error_message = __( 'Sorry but we failed to deactivate AWeber Integration, please try again', 'forminator' );
89
  */
90
  public function is_connected() {
91
  try {
92
+ // check if its active.
93
  if ( ! $this->is_active() ) {
94
  throw new Forminator_Addon_Aweber_Exception( __( 'AWeber is not active', 'forminator' ) );
95
  }
96
 
97
+ // if user completed api setup.
98
  $is_connected = false;
99
  $setting_values = $this->get_settings_values();
100
+ // if user completed api setup.
101
  if ( isset( $setting_values['account_id'] ) && ! empty( $setting_values['account_id'] ) ) {
102
  $is_connected = true;
103
  }
138
  throw new Forminator_Addon_Aweber_Exception( __( 'Invalid Form Settings of AWeber', 'forminator' ) );
139
  }
140
 
141
+ // Mark as active when there is at least one active connection.
142
  if ( false === $form_settings_instance->find_one_active_connection() ) {
143
  throw new Forminator_Addon_Aweber_Exception( __( 'No active AWeber connection found in this form', 'forminator' ) );
144
  }
155
  * @since 1.0
156
  *
157
  * @param bool $is_form_connected
158
+ * @param int $form_id Current Form ID.
159
+ * @param Forminator_Addon_Aweber_Form_Settings|null $form_settings_instance Instance of form settings, or null when unavailable.
160
  *
161
  */
162
  $is_form_connected = apply_filters( 'forminator_addon_aweber_is_form_connected', $is_form_connected, $form_id, $form_settings_instance );
297
  public function is_authorized( $submitted_data ) {
298
  $setting_values = $this->get_settings_values();
299
 
300
+ // check account_id there.
301
  return isset( $setting_values['account_id'] ) && ! empty( $setting_values['account_id'] );
302
  }
303
 
412
  $return_url = rawurlencode( $return_url );
413
 
414
  $auth_params = array(
415
+ 'oauth_callback' => $return_url, // un-official https://labs.aweber.com/getting_started/public#1.
416
  );
417
 
418
  /**
440
  */
441
  public function get_app_id() {
442
  $app_id = $this->_app_id;
443
+ // check override by config constant.
444
  if ( defined( 'FORMINATOR_ADDON_AWEBER_APP_ID' ) && FORMINATOR_ADDON_AWEBER_APP_ID ) {
445
  $app_id = FORMINATOR_ADDON_AWEBER_APP_ID;
446
  }
636
  throw new Forminator_Addon_Aweber_Exception( __( 'Invalid Quiz Settings of AWeber', 'forminator' ) );
637
  }
638
 
639
+ // Mark as active when there is at least one active connection.
640
  if ( false === $quiz_settings_instance->find_one_active_connection() ) {
641
  throw new Forminator_Addon_Aweber_Exception( __( 'No active AWeber connection found in this quiz', 'forminator' ) );
642
  }
653
  * @since 1.0
654
  *
655
  * @param bool $is_quiz_connected
656
+ * @param int $quiz_id Current Quiz ID.
657
+ * @param Forminator_Addon_Aweber_Form_Settings|null $quiz_settings_instance Instance of quiz settings, or null when unavailable.
658
  *
659
  */
660
  $is_quiz_connected = apply_filters( 'forminator_addon_aweber_is_form_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
675
  public function is_quiz_lead_connected( $quiz_id ) {
676
 
677
  try {
678
+ // initialize with null.
679
  $quiz_settings_instance = null;
680
  if ( ! $this->is_connected() ) {
681
  throw new Forminator_Addon_Aweber_Exception( __( ' AWeber is not connected', 'forminator' ) );
705
  * @since 1.1
706
  *
707
  * @param bool $is_quiz_connected
708
+ * @param int $quiz_id Current Quiz ID.
709
+ * @param Forminator_Addon_Aweber_Quiz_Settings|null $quiz_settings_instance Instance of quiz settings, or null when unavailable.
710
  *
711
  */
712
  $is_quiz_connected = apply_filters( 'forminator_addon_aweber_is_quiz_lead_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
addons/pro/aweber/lib/class-forminator-addon-aweber-oauth.php CHANGED
@@ -11,9 +11,9 @@ class Forminator_Addon_Aweber_Oauth {
11
  *
12
  * @since 1.0
13
  *
14
- * @param mixed $method String name of HTTP method, such as "GET"
15
- * @param mixed $url URL where this request will go
16
- * @param mixed $data Array of params for this request. This should
17
  * include ALL oauth properties except for the signature.
18
  *
19
  * @return string
@@ -84,8 +84,8 @@ class Forminator_Addon_Aweber_Oauth {
84
  *
85
  * @since 1.0
86
  *
87
- * @param mixed $base Base string of data to sign
88
- * @param mixed $key Key to sign the data with
89
  *
90
  * @access public
91
  * @return string The signature
@@ -160,7 +160,7 @@ class Forminator_Addon_Aweber_Oauth {
160
  * @since 1.3
161
  *
162
  * @param string $oauth_nonce
163
- * @param int $timestamp current timestamp for future reference
164
  */
165
  $oauth_nonce = apply_filters( 'forminator_addon_aweber_oauth_nonce', $oauth_nonce, $timestamp );
166
 
11
  *
12
  * @since 1.0
13
  *
14
+ * @param mixed $method String name of HTTP method, such as "GET".
15
+ * @param mixed $url URL where this request will go.
16
+ * @param mixed $data Array of params for this request. This should.
17
  * include ALL oauth properties except for the signature.
18
  *
19
  * @return string
84
  *
85
  * @since 1.0
86
  *
87
+ * @param mixed $base Base string of data to sign.
88
+ * @param mixed $key Key to sign the data with.
89
  *
90
  * @access public
91
  * @return string The signature
160
  * @since 1.3
161
  *
162
  * @param string $oauth_nonce
163
+ * @param int $timestamp current timestamp for future reference.
164
  */
165
  $oauth_nonce = apply_filters( 'forminator_addon_aweber_oauth_nonce', $oauth_nonce, $timestamp );
166
 
addons/pro/aweber/lib/class-forminator-addon-aweber-wp-api.php CHANGED
@@ -117,7 +117,7 @@ class Forminator_Addon_Aweber_Wp_Api {
117
  *
118
  * @since 1.1
119
  *
120
- * @param string $user_agent current user agent
121
  */
122
  $user_agent = apply_filters( 'forminator_addon_aweber_api_user_agent', $user_agent );
123
 
@@ -140,7 +140,7 @@ class Forminator_Addon_Aweber_Wp_Api {
140
  * @throws Forminator_Addon_Aweber_Wp_Api_Not_Found_Exception
141
  */
142
  private function request( $verb, $url, $args = array(), $headers = array() ) {
143
- // Adding extra user agent for wp remote request
144
  add_filter( 'http_headers_useragent', array( $this, 'filter_user_agent' ) );
145
  $verb = ! empty( $verb ) ? $verb : 'GET';
146
 
@@ -149,10 +149,10 @@ class Forminator_Addon_Aweber_Wp_Api {
149
  *
150
  * @since 1.1
151
  *
152
- * @param string $url full url with scheme
153
- * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`
154
- * @param string $path requested path resource
155
- * @param array $args argument sent to this function
156
  */
157
  $url = apply_filters( 'forminator_addon_aweber_api_url', $url, $verb, $args );
158
 
@@ -162,9 +162,9 @@ class Forminator_Addon_Aweber_Wp_Api {
162
  * @since 1.1
163
  *
164
  * @param array $headers
165
- * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`
166
- * @param string $url full url with scheme
167
- * @param array $args argument sent to this function
168
  */
169
  $headers = apply_filters( 'forminator_addon_aweber_api_request_headers', $headers, $verb, $url, $args );
170
 
@@ -182,12 +182,12 @@ class Forminator_Addon_Aweber_Wp_Api {
182
  * @since 1.1
183
  *
184
  * @param array $request_data
185
- * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`
186
- * @param string $url full url with scheme
187
  */
188
  $args = apply_filters( 'forminator_addon_aweber_api_request_data', $request_data, $verb, $url );
189
 
190
- // $oauth_url_params doesnt need to be included
191
  $this->_last_url_request = $url;
192
 
193
  if ( 'PATCH' === $verb ) {
@@ -258,10 +258,10 @@ class Forminator_Addon_Aweber_Wp_Api {
258
 
259
  $body = wp_remote_retrieve_body( $res );
260
 
261
- // probably silent mode
262
  if ( ! empty( $body ) ) {
263
  $res = json_decode( $body );
264
- // fallback to parse args when fail
265
  if ( empty( $res ) ) {
266
  $res = wp_parse_args( $body, array() );
267
 
@@ -277,9 +277,9 @@ class Forminator_Addon_Aweber_Wp_Api {
277
  *
278
  * @since 1.1
279
  *
280
- * @param mixed $response original wp remote request response or decoded body if available
281
- * @param string $body original content of http response's body
282
- * @param array|WP_Error $wp_response original wp remote request response
283
  */
284
  $res = apply_filters( 'forminator_addon_aweber_api_response', $response, $body, $wp_response );
285
 
@@ -311,8 +311,8 @@ class Forminator_Addon_Aweber_Wp_Api {
311
  *
312
  * @since 1.3
313
  *
314
- * @param array $oauth_request_data default oauth request data
315
- * @param int $timestamp current timestamp for future reference
316
  */
317
  $oauth_request_data = apply_filters( 'forminator_addon_aweber_oauth_request_data', $oauth_request_data, $timestamp );
318
 
@@ -361,9 +361,9 @@ class Forminator_Addon_Aweber_Wp_Api {
361
  *
362
  * @since 1.0 Aweber Addon
363
  *
364
- * @param mixed $method HTTP method
365
- * @param mixed $url URL for the request
366
- * @param mixed $data The data to generate oauth data and be signed
367
  *
368
  * @return array
369
  */
117
  *
118
  * @since 1.1
119
  *
120
+ * @param string $user_agent current user agent.
121
  */
122
  $user_agent = apply_filters( 'forminator_addon_aweber_api_user_agent', $user_agent );
123
 
140
  * @throws Forminator_Addon_Aweber_Wp_Api_Not_Found_Exception
141
  */
142
  private function request( $verb, $url, $args = array(), $headers = array() ) {
143
+ // Adding extra user agent for wp remote request.
144
  add_filter( 'http_headers_useragent', array( $this, 'filter_user_agent' ) );
145
  $verb = ! empty( $verb ) ? $verb : 'GET';
146
 
149
  *
150
  * @since 1.1
151
  *
152
+ * @param string $url full url with scheme.
153
+ * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`.
154
+ * @param string $path requested path resource.
155
+ * @param array $args argument sent to this function.
156
  */
157
  $url = apply_filters( 'forminator_addon_aweber_api_url', $url, $verb, $args );
158
 
162
  * @since 1.1
163
  *
164
  * @param array $headers
165
+ * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`.
166
+ * @param string $url full url with scheme.
167
+ * @param array $args argument sent to this function.
168
  */
169
  $headers = apply_filters( 'forminator_addon_aweber_api_request_headers', $headers, $verb, $url, $args );
170
 
182
  * @since 1.1
183
  *
184
  * @param array $request_data
185
+ * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`.
186
+ * @param string $url full url with scheme.
187
  */
188
  $args = apply_filters( 'forminator_addon_aweber_api_request_data', $request_data, $verb, $url );
189
 
190
+ // $oauth_url_params doesnt need to be included.
191
  $this->_last_url_request = $url;
192
 
193
  if ( 'PATCH' === $verb ) {
258
 
259
  $body = wp_remote_retrieve_body( $res );
260
 
261
+ // probably silent mode.
262
  if ( ! empty( $body ) ) {
263
  $res = json_decode( $body );
264
+ // fallback to parse args when fail.
265
  if ( empty( $res ) ) {
266
  $res = wp_parse_args( $body, array() );
267
 
277
  *
278
  * @since 1.1
279
  *
280
+ * @param mixed $response original wp remote request response or decoded body if available.
281
+ * @param string $body original content of http response's body.
282
+ * @param array|WP_Error $wp_response original wp remote request response.
283
  */
284
  $res = apply_filters( 'forminator_addon_aweber_api_response', $response, $body, $wp_response );
285
 
311
  *
312
  * @since 1.3
313
  *
314
+ * @param array $oauth_request_data default oauth request data.
315
+ * @param int $timestamp current timestamp for future reference.
316
  */
317
  $oauth_request_data = apply_filters( 'forminator_addon_aweber_oauth_request_data', $oauth_request_data, $timestamp );
318
 
361
  *
362
  * @since 1.0 Aweber Addon
363
  *
364
+ * @param mixed $method HTTP method.
365
+ * @param mixed $url URL for the request.
366
+ * @param mixed $data The data to generate oauth data and be signed.
367
  *
368
  * @return array
369
  */
addons/pro/aweber/views/form-settings/map-fields.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // Defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'multi_id' => '',
1
  <?php
2
+ // Defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'multi_id' => '',
addons/pro/aweber/views/form-settings/pick-name.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
addons/pro/aweber/views/form-settings/setup-list.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'list_id' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'list_id' => '',
addons/pro/aweber/views/form-settings/setup-options.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'multi_id' => '',
@@ -61,7 +61,7 @@ foreach ( $template_vars as $key => $val ) {
61
  <span class="sui-error-message"><?php echo esc_html( $vars['ad_tracking_error'] ); ?></span>
62
  <?php endif; ?>
63
 
64
- <span class="sui-description"><?php echo ( sprintf( __( 'Use 20 or fewer characters to label subscribers based on how they signed up. Find complete article %1$shere%2$s.', 'forminator' ), '<a href="https://help.aweber.com/hc/en-us/articles/204028836-What-is-Ad-Tracking-" target="_blank">', '</a>' ) ); // phpcs:ignore ?></span>
65
 
66
  </div>
67
 
@@ -96,7 +96,7 @@ foreach ( $template_vars as $key => $val ) {
96
  <span class="sui-error-message"><?php echo esc_html( $vars['tags_error'] ); ?></span>
97
  <?php endif; ?>
98
 
99
- <span class="sui-description"><?php echo ( sprintf( __( 'Available fields value or free text can be used as tags. Have a campaign that’s triggered when a subscriber is tagged? Enter the appropriate tag to add the subscriber to the campaign, and they will immediately begin receiving your messages. More info about AWeber subscriber tags can be found %1$shere%2$s.', 'forminator' ), '<a href="https://help.aweber.com/hc/en-us/articles/212677877-How-do-I-use-Tags-with-Campaigns-" target="_blank">', '</a>' ) ); // phpcs:ignore ?></span>
100
 
101
  </div>
102
 
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'multi_id' => '',
61
  <span class="sui-error-message"><?php echo esc_html( $vars['ad_tracking_error'] ); ?></span>
62
  <?php endif; ?>
63
 
64
+ <span class="sui-description"><?php echo ( sprintf( esc_html__( 'Use 20 or fewer characters to label subscribers based on how they signed up. Find complete article %1$shere%2$s.', 'forminator' ), '<a href="https://help.aweber.com/hc/en-us/articles/204028836-What-is-Ad-Tracking-" target="_blank">', '</a>' ) ); ?></span>
65
 
66
  </div>
67
 
96
  <span class="sui-error-message"><?php echo esc_html( $vars['tags_error'] ); ?></span>
97
  <?php endif; ?>
98
 
99
+ <span class="sui-description"><?php echo ( sprintf( esc_html__( 'Available fields value or free text can be used as tags. Have a campaign that’s triggered when a subscriber is tagged? Enter the appropriate tag to add the subscriber to the campaign, and they will immediately begin receiving your messages. More info about AWeber subscriber tags can be found %1$shere%2$s.', 'forminator' ), '<a href="https://help.aweber.com/hc/en-us/articles/212677877-How-do-I-use-Tags-with-Campaigns-" target="_blank">', '</a>' ) ); ?></span>
100
 
101
  </div>
102
 
addons/pro/aweber/views/quiz-settings/map-fields.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // Defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'multi_id' => '',
1
  <?php
2
+ // Defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'multi_id' => '',
addons/pro/aweber/views/quiz-settings/pick-name.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
addons/pro/aweber/views/quiz-settings/setup-list.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'list_id' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'list_id' => '',
addons/pro/aweber/views/quiz-settings/setup-options.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'multi_id' => '',
@@ -61,7 +61,7 @@ foreach ( $template_vars as $key => $val ) {
61
  <span class="sui-error-message"><?php echo esc_html( $vars['ad_tracking_error'] ); ?></span>
62
  <?php endif; ?>
63
 
64
- <span class="sui-description"><?php echo ( sprintf( __( 'Use 20 or fewer characters to label subscribers based on how they signed up. Find complete article %1$shere%2$s.', 'forminator' ), '<a href="https://help.aweber.com/hc/en-us/articles/204028836-What-is-Ad-Tracking-" target="_blank">', '</a>' ) ); // phpcs:ignore ?></span>
65
 
66
  </div>
67
 
@@ -96,7 +96,7 @@ foreach ( $template_vars as $key => $val ) {
96
  <span class="sui-error-message"><?php echo esc_html( $vars['tags_error'] ); ?></span>
97
  <?php endif; ?>
98
 
99
- <span class="sui-description"><?php echo ( sprintf( __( 'Available fields value or free text can be used as tags. Have a campaign that’s triggered when a subscriber is tagged? Enter the appropriate tag to add the subscriber to the campaign, and they will immediately begin receiving your messages. More info about AWeber subscriber tags can be found %1$shere%2$s.', 'forminator' ), '<a href="https://help.aweber.com/hc/en-us/articles/212677877-How-do-I-use-Tags-with-Campaigns-" target="_blank">', '</a>' ) ); // phpcs:ignore ?></span>
100
 
101
  </div>
102
 
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'multi_id' => '',
61
  <span class="sui-error-message"><?php echo esc_html( $vars['ad_tracking_error'] ); ?></span>
62
  <?php endif; ?>
63
 
64
+ <span class="sui-description"><?php echo ( sprintf( esc_html__( 'Use 20 or fewer characters to label subscribers based on how they signed up. Find complete article %1$shere%2$s.', 'forminator' ), '<a href="https://help.aweber.com/hc/en-us/articles/204028836-What-is-Ad-Tracking-" target="_blank">', '</a>' ) ); ?></span>
65
 
66
  </div>
67
 
96
  <span class="sui-error-message"><?php echo esc_html( $vars['tags_error'] ); ?></span>
97
  <?php endif; ?>
98
 
99
+ <span class="sui-description"><?php echo ( sprintf( esc_html__( 'Available fields value or free text can be used as tags. Have a campaign that’s triggered when a subscriber is tagged? Enter the appropriate tag to add the subscriber to the campaign, and they will immediately begin receiving your messages. More info about AWeber subscriber tags can be found %1$shere%2$s.', 'forminator' ), '<a href="https://help.aweber.com/hc/en-us/articles/212677877-How-do-I-use-Tags-with-Campaigns-" target="_blank">', '</a>' ) ); ?></span>
100
 
101
  </div>
102
 
addons/pro/aweber/views/sections/authorize.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'is_close' => false,
@@ -44,7 +44,7 @@ foreach ( $template_vars as $key => $val ) {
44
 
45
  var hashParams = {};
46
  var e,
47
- a = /\+/g, // Regex for replacing addition symbol with a space
48
  r = /([^&;=]+)=?([^&;]*)/g,
49
  d = function (s) {
50
  return decodeURIComponent(s.replace(a, " "));
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'is_close' => false,
44
 
45
  var hashParams = {};
46
  var e,
47
+ a = /\+/g, // Regex for replacing addition symbol with a space.
48
  r = /([^&;=]+)=?([^&;]*)/g,
49
  d = function (s) {
50
  return decodeURIComponent(s.replace(a, " "));
addons/pro/aweber/views/settings/authorize.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // Defaults
3
  $vars = array(
4
  'account_id' => 0,
5
  'auth_url' => '',
1
  <?php
2
+ // Defaults.
3
  $vars = array(
4
  'account_id' => 0,
5
  'auth_url' => '',
addons/pro/aweber/views/settings/wait-authorize.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // Defaults
3
  $vars = array(
4
  'account_id' => 0,
5
  'auth_url' => '',
1
  <?php
2
+ // Defaults.
3
  $vars = array(
4
  'account_id' => 0,
5
  'auth_url' => '',
addons/pro/campaignmonitor/class-forminator-addon-campaignmonitor-form-hooks.php CHANGED
@@ -64,8 +64,8 @@ class Forminator_Addon_Campaignmonitor_Form_Hooks extends Forminator_Addon_Form_
64
  * @since 1.3
65
  *
66
  * @param array $submitted_data
67
- * @param int $form_id current Form ID
68
- * @param Forminator_Addon_Campaignmonitor_Form_Settings $form_settings_instance Campaign Monitor Addon Form Settings instance
69
  */
70
  $submitted_data = apply_filters(
71
  'forminator_addon_campaignmonitor_form_submitted_data',
@@ -86,16 +86,16 @@ class Forminator_Addon_Campaignmonitor_Form_Hooks extends Forminator_Addon_Form_
86
  *
87
  * @since 1.3
88
  *
89
- * @param int $form_id current Form ID
90
  * @param array $submitted_data
91
- * @param Forminator_Addon_Campaignmonitor_Form_Settings $form_settings_instance Campaign Monitor Addon Form Settings instance
92
  */
93
  do_action( 'forminator_addon_campaignmonitor_before_add_subscriber', $form_id, $submitted_data, $form_settings_instance );
94
 
95
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
96
- // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to campaign monitor
97
  if ( $form_settings_instance->is_multi_form_settings_complete( $key ) ) {
98
- // exec only on completed connection
99
  $data[] = array(
100
  'name' => 'status-' . $key,
101
  'value' => $this->get_status_on_add_subscriber( $key, $submitted_data, $addon_setting_value, $form_settings, $form_entry_fields ),
@@ -110,9 +110,9 @@ class Forminator_Addon_Campaignmonitor_Form_Hooks extends Forminator_Addon_Form_
110
  * @since 1.3
111
  *
112
  * @param array $entry_fields
113
- * @param int $form_id current Form ID
114
  * @param array $submitted_data
115
- * @param Forminator_Addon_Campaignmonitor_Form_Settings $form_settings_instance Campaign Monitor Addon Form Settings instance
116
  */
117
  $data = apply_filters(
118
  'forminator_addon_campaignmonitor_entry_fields',
@@ -141,7 +141,7 @@ class Forminator_Addon_Campaignmonitor_Form_Hooks extends Forminator_Addon_Form_
141
  * @return array `is_sent` true means its success send data to ampaign Monitor, false otherwise
142
  */
143
  private function get_status_on_add_subscriber( $connection_id, $submitted_data, $connection_settings, $form_settings, $form_entry_fields = array() ) {
144
- // initialize as null
145
  $api = null;
146
 
147
  $form_id = $this->form_id;
@@ -169,7 +169,7 @@ class Forminator_Addon_Campaignmonitor_Form_Hooks extends Forminator_Addon_Form_
169
  $email = $submitted_data[ $email_element_id ];
170
  $email = strtolower( trim( $email ) );
171
 
172
- // processed
173
  unset( $fields_map['default_field_email'] );
174
 
175
  $name_element_id = $connection_settings['fields_map']['default_field_name'];
@@ -193,11 +193,11 @@ class Forminator_Addon_Campaignmonitor_Form_Hooks extends Forminator_Addon_Form_
193
  $args['Name'] = $submitted_data[ $name_element_id ];
194
  }
195
 
196
- // processed
197
  unset( $fields_map['default_field_name'] );
198
 
199
  $custom_fields = array();
200
- // process rest extra fields if available
201
  foreach ( $fields_map as $field_id => $element_id ) {
202
  if ( ! empty( $element_id ) ) {
203
  if ( self::element_is_calculation( $element_id ) ) {
@@ -218,7 +218,7 @@ class Forminator_Addon_Campaignmonitor_Form_Hooks extends Forminator_Addon_Form_
218
  'Key' => $field_id,
219
  'Value' => $element_value,
220
  );
221
- unset( $element_value ); // unset for next loop
222
  }
223
  }
224
  }
@@ -245,12 +245,12 @@ class Forminator_Addon_Campaignmonitor_Form_Hooks extends Forminator_Addon_Form_
245
  * @since 1.3
246
  *
247
  * @param array $args
248
- * @param int $form_id Current Form id
249
- * @param string $connection_id ID of current connection
250
  * @param array $submitted_data
251
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
252
- * @param array $form_settings Displayed Form settings
253
- * @param Forminator_Addon_Campaignmonitor_Form_Settings $form_settings_instance Campaign Monitor Addon Form Settings instance
254
  */
255
  $args = apply_filters(
256
  'forminator_addon_campaignmonitor_add_subscriber_args',
@@ -275,8 +275,8 @@ class Forminator_Addon_Campaignmonitor_Form_Hooks extends Forminator_Addon_Form_
275
  'data_sent' => $api->get_last_data_sent(),
276
  'data_received' => $api->get_last_data_received(),
277
  'url_request' => $api->get_last_url_request(),
278
- 'subscriber_email' => $api->get_last_data_received(), // for delete reference
279
- 'list_id' => $list_id, // for delete reference
280
  );
281
 
282
  } catch ( Forminator_Addon_Campaignmonitor_Exception $e ) {
@@ -316,8 +316,8 @@ class Forminator_Addon_Campaignmonitor_Form_Hooks extends Forminator_Addon_Form_
316
  * @since 1.3
317
  *
318
  * @param array $addon_meta_data
319
- * @param int $form_id current Form ID
320
- * @param Forminator_Addon_Campaignmonitor_Form_Settings $form_settings_instance Campaign Monitor Addon Form Settings instance
321
  */
322
  $addon_meta_data = apply_filters(
323
  'forminator_addon_campaignmonitor_metadata',
@@ -405,7 +405,7 @@ class Forminator_Addon_Campaignmonitor_Form_Hooks extends Forminator_Addon_Form_
405
  }
406
 
407
  if ( Forminator_Addon_Campaignmonitor::is_show_full_log() ) {
408
- // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_CAMPAIGNMONITOR_SHOW_FULL_LOG', true)`
409
  if ( isset( $status['url_request'] ) ) {
410
  $sub_entries[] = array(
411
  'label' => __( 'API URL', 'forminator' ),
@@ -430,7 +430,7 @@ class Forminator_Addon_Campaignmonitor_Form_Hooks extends Forminator_Addon_Form_
430
 
431
  $additional_entry_item['sub_entries'] = $sub_entries;
432
 
433
- // return single array
434
  return $additional_entry_item;
435
  }
436
 
@@ -455,9 +455,9 @@ class Forminator_Addon_Campaignmonitor_Form_Hooks extends Forminator_Addon_Form_
455
  *
456
  * @since 1.3
457
  *
458
- * @param array $export_headers headers to be displayed on export file
459
- * @param int $form_id current Form ID
460
- * @param Forminator_Addon_Campaignmonitor_Form_Settings $form_settings_instance Campaign Monitor Addon Form Settings instance
461
  */
462
  $export_headers = apply_filters(
463
  'forminator_addon_campaignmonitor_export_headers',
@@ -492,8 +492,8 @@ class Forminator_Addon_Campaignmonitor_Form_Hooks extends Forminator_Addon_Form_
492
  * @since 1.3
493
  *
494
  * @param array $addon_meta_data
495
- * @param int $form_id current Form ID
496
- * @param Forminator_Addon_Campaignmonitor_Form_Settings $form_settings_instance Campaign Monitor Addon Form Settings instance
497
  */
498
  $addon_meta_data = apply_filters(
499
  'forminator_addon_campaignmonitor_metadata',
@@ -511,11 +511,11 @@ class Forminator_Addon_Campaignmonitor_Form_Hooks extends Forminator_Addon_Form_
511
  *
512
  * @since 1.3
513
  *
514
- * @param array $export_columns column to be exported
515
- * @param int $form_id current Form ID
516
- * @param Forminator_Form_Entry_Model $entry_model Form Entry Model
517
- * @param array $addon_meta_data meta data saved by addon on entry fields
518
- * @param Forminator_Addon_Campaignmonitor_Form_Settings $form_settings_instance Campaign Monitor Addon Form Settings instance
519
  */
520
  $export_columns = apply_filters(
521
  'forminator_addon_campaignmonitor_export_columns',
@@ -548,15 +548,15 @@ class Forminator_Addon_Campaignmonitor_Form_Hooks extends Forminator_Addon_Form_
548
 
549
  $addon_meta_data = $addon_meta_data[0];
550
 
551
- // make sure its `status`, because we only add this
552
  if ( 'status' !== $addon_meta_data['name'] ) {
553
  if ( stripos( $addon_meta_data['name'], 'status-' ) === 0 ) {
554
  $meta_data = array();
555
  foreach ( $addon_meta_datas as $addon_meta_data ) {
556
- // make it like single value so it will be processed like single meta data
557
  $addon_meta_data['name'] = 'status';
558
 
559
- // add it on an array for next recursive process
560
  $meta_data[] = $this->get_from_addon_meta_data( array( $addon_meta_data ), $key, $default );
561
  }
562
 
@@ -596,7 +596,7 @@ class Forminator_Addon_Campaignmonitor_Form_Hooks extends Forminator_Addon_Form_
596
  * @return bool
597
  */
598
  public function on_before_delete_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {
599
- // attach hook first
600
  $form_id = $this->form_id;
601
  $form_settings_instance = $this->form_settings_instance;
602
 
@@ -607,9 +607,9 @@ class Forminator_Addon_Campaignmonitor_Form_Hooks extends Forminator_Addon_Form_
607
  * @since 1.1
608
  *
609
  * @param array $addon_meta_data
610
- * @param int $form_id current Form ID
611
- * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model
612
- * @param Forminator_Addon_Campaignmonitor_Form_Settings $form_settings_instance Campaign Monitor Addon Form Settings instance
613
  */
614
  $addon_meta_data = apply_filters(
615
  'forminator_addon_campaignmonitor_metadata',
@@ -624,10 +624,10 @@ class Forminator_Addon_Campaignmonitor_Form_Hooks extends Forminator_Addon_Form_
624
  *
625
  * @since 1.1
626
  *
627
- * @param int $form_id current Form ID
628
- * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model
629
- * @param array $addon_meta_data addon meta data
630
- * @param Forminator_Addon_Campaignmonitor_Form_Settings $form_settings_instance Campaign Monitor Addon Form Settings instance
631
  */
632
  do_action(
633
  'forminator_addon_campaignmonitor_on_before_delete_submission',
@@ -670,9 +670,9 @@ class Forminator_Addon_Campaignmonitor_Form_Hooks extends Forminator_Addon_Form_
670
  * @since 1.3
671
  *
672
  * @param array $subscriber_ids_to_delete
673
- * @param int $form_id current Form ID
674
- * @param array $addon_meta_data addon meta data
675
- * @param Forminator_Addon_Campaignmonitor_Form_Settings $form_settings_instance Campaign Monitor Addon Form Settings instance
676
  *
677
  */
678
  $subscribers_to_delete = apply_filters(
@@ -696,11 +696,11 @@ class Forminator_Addon_Campaignmonitor_Form_Hooks extends Forminator_Addon_Form_
696
  return true;
697
 
698
  } catch ( Forminator_Addon_Campaignmonitor_Exception $e ) {
699
- // handle all internal addon exceptions with `Forminator_Addon_Campaignmonitor_Exception`
700
 
701
- // use wp_error, for future usage it can be returned to page entries
702
  $wp_error = new WP_Error( 'forminator_addon_campaignmonitor_delete_subscriber', $e->getMessage() );
703
- // handle this in addon by self, since page entries cant handle error messages on delete yet
704
  wp_die(
705
  esc_html( $wp_error->get_error_message() ),
706
  esc_html( $this->addon->get_title() ),
64
  * @since 1.3
65
  *
66
  * @param array $submitted_data
67
+ * @param int $form_id current Form ID.
68
+ * @param Forminator_Addon_Campaignmonitor_Form_Settings $form_settings_instance Campaign Monitor Addon Form Settings instance.
69
  */
70
  $submitted_data = apply_filters(
71
  'forminator_addon_campaignmonitor_form_submitted_data',
86
  *
87
  * @since 1.3
88
  *
89
+ * @param int $form_id current Form ID.
90
  * @param array $submitted_data
91
+ * @param Forminator_Addon_Campaignmonitor_Form_Settings $form_settings_instance Campaign Monitor Addon Form Settings instance.
92
  */
93
  do_action( 'forminator_addon_campaignmonitor_before_add_subscriber', $form_id, $submitted_data, $form_settings_instance );
94
 
95
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
96
+ // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to campaign monitor.
97
  if ( $form_settings_instance->is_multi_form_settings_complete( $key ) ) {
98
+ // exec only on completed connection.
99
  $data[] = array(
100
  'name' => 'status-' . $key,
101
  'value' => $this->get_status_on_add_subscriber( $key, $submitted_data, $addon_setting_value, $form_settings, $form_entry_fields ),
110
  * @since 1.3
111
  *
112
  * @param array $entry_fields
113
+ * @param int $form_id current Form ID.
114
  * @param array $submitted_data
115
+ * @param Forminator_Addon_Campaignmonitor_Form_Settings $form_settings_instance Campaign Monitor Addon Form Settings instance.
116
  */
117
  $data = apply_filters(
118
  'forminator_addon_campaignmonitor_entry_fields',
141
  * @return array `is_sent` true means its success send data to ampaign Monitor, false otherwise
142
  */
143
  private function get_status_on_add_subscriber( $connection_id, $submitted_data, $connection_settings, $form_settings, $form_entry_fields = array() ) {
144
+ // initialize as null.
145
  $api = null;
146
 
147
  $form_id = $this->form_id;
169
  $email = $submitted_data[ $email_element_id ];
170
  $email = strtolower( trim( $email ) );
171
 
172
+ // processed.
173
  unset( $fields_map['default_field_email'] );
174
 
175
  $name_element_id = $connection_settings['fields_map']['default_field_name'];
193
  $args['Name'] = $submitted_data[ $name_element_id ];
194
  }
195
 
196
+ // processed.
197
  unset( $fields_map['default_field_name'] );
198
 
199
  $custom_fields = array();
200
+ // process rest extra fields if available.
201
  foreach ( $fields_map as $field_id => $element_id ) {
202
  if ( ! empty( $element_id ) ) {
203
  if ( self::element_is_calculation( $element_id ) ) {
218
  'Key' => $field_id,
219
  'Value' => $element_value,
220
  );
221
+ unset( $element_value ); // unset for next loop.
222
  }
223
  }
224
  }
245
  * @since 1.3
246
  *
247
  * @param array $args
248
+ * @param int $form_id Current Form id.
249
+ * @param string $connection_id ID of current connection.
250
  * @param array $submitted_data
251
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
252
+ * @param array $form_settings Displayed Form settings.
253
+ * @param Forminator_Addon_Campaignmonitor_Form_Settings $form_settings_instance Campaign Monitor Addon Form Settings instance.
254
  */
255
  $args = apply_filters(
256
  'forminator_addon_campaignmonitor_add_subscriber_args',
275
  'data_sent' => $api->get_last_data_sent(),
276
  'data_received' => $api->get_last_data_received(),
277
  'url_request' => $api->get_last_url_request(),
278
+ 'subscriber_email' => $api->get_last_data_received(), // for delete reference.
279
+ 'list_id' => $list_id, // for delete reference.
280
  );
281
 
282
  } catch ( Forminator_Addon_Campaignmonitor_Exception $e ) {
316
  * @since 1.3
317
  *
318
  * @param array $addon_meta_data
319
+ * @param int $form_id current Form ID.
320
+ * @param Forminator_Addon_Campaignmonitor_Form_Settings $form_settings_instance Campaign Monitor Addon Form Settings instance.
321
  */
322
  $addon_meta_data = apply_filters(
323
  'forminator_addon_campaignmonitor_metadata',
405
  }
406
 
407
  if ( Forminator_Addon_Campaignmonitor::is_show_full_log() ) {
408
+ // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_CAMPAIGNMONITOR_SHOW_FULL_LOG', true)`.
409
  if ( isset( $status['url_request'] ) ) {
410
  $sub_entries[] = array(
411
  'label' => __( 'API URL', 'forminator' ),
430
 
431
  $additional_entry_item['sub_entries'] = $sub_entries;
432
 
433
+ // return single array.
434
  return $additional_entry_item;
435
  }
436
 
455
  *
456
  * @since 1.3
457
  *
458
+ * @param array $export_headers headers to be displayed on export file.
459
+ * @param int $form_id current Form ID.
460
+ * @param Forminator_Addon_Campaignmonitor_Form_Settings $form_settings_instance Campaign Monitor Addon Form Settings instance.
461
  */
462
  $export_headers = apply_filters(
463
  'forminator_addon_campaignmonitor_export_headers',
492
  * @since 1.3
493
  *
494
  * @param array $addon_meta_data
495
+ * @param int $form_id current Form ID.
496
+ * @param Forminator_Addon_Campaignmonitor_Form_Settings $form_settings_instance Campaign Monitor Addon Form Settings instance.
497
  */
498
  $addon_meta_data = apply_filters(
499
  'forminator_addon_campaignmonitor_metadata',
511
  *
512
  * @since 1.3
513
  *
514
+ * @param array $export_columns column to be exported.
515
+ * @param int $form_id current Form ID.
516
+ * @param Forminator_Form_Entry_Model $entry_model Form Entry Model.
517
+ * @param array $addon_meta_data meta data saved by addon on entry fields.
518
+ * @param Forminator_Addon_Campaignmonitor_Form_Settings $form_settings_instance Campaign Monitor Addon Form Settings instance.
519
  */
520
  $export_columns = apply_filters(
521
  'forminator_addon_campaignmonitor_export_columns',
548
 
549
  $addon_meta_data = $addon_meta_data[0];
550
 
551
+ // make sure its `status`, because we only add this.
552
  if ( 'status' !== $addon_meta_data['name'] ) {
553
  if ( stripos( $addon_meta_data['name'], 'status-' ) === 0 ) {
554
  $meta_data = array();
555
  foreach ( $addon_meta_datas as $addon_meta_data ) {
556
+ // make it like single value so it will be processed like single meta data.
557
  $addon_meta_data['name'] = 'status';
558
 
559
+ // add it on an array for next recursive process.
560
  $meta_data[] = $this->get_from_addon_meta_data( array( $addon_meta_data ), $key, $default );
561
  }
562
 
596
  * @return bool
597
  */
598
  public function on_before_delete_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {
599
+ // attach hook first.
600
  $form_id = $this->form_id;
601
  $form_settings_instance = $this->form_settings_instance;
602
 
607
  * @since 1.1
608
  *
609
  * @param array $addon_meta_data
610
+ * @param int $form_id current Form ID.
611
+ * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model.
612
+ * @param Forminator_Addon_Campaignmonitor_Form_Settings $form_settings_instance Campaign Monitor Addon Form Settings instance.
613
  */
614
  $addon_meta_data = apply_filters(
615
  'forminator_addon_campaignmonitor_metadata',
624
  *
625
  * @since 1.1
626
  *
627
+ * @param int $form_id current Form ID.
628
+ * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model.
629
+ * @param array $addon_meta_data addon meta data.
630
+ * @param Forminator_Addon_Campaignmonitor_Form_Settings $form_settings_instance Campaign Monitor Addon Form Settings instance.
631
  */
632
  do_action(
633
  'forminator_addon_campaignmonitor_on_before_delete_submission',
670
  * @since 1.3
671
  *
672
  * @param array $subscriber_ids_to_delete
673
+ * @param int $form_id current Form ID.
674
+ * @param array $addon_meta_data addon meta data.
675
+ * @param Forminator_Addon_Campaignmonitor_Form_Settings $form_settings_instance Campaign Monitor Addon Form Settings instance.
676
  *
677
  */
678
  $subscribers_to_delete = apply_filters(
696
  return true;
697
 
698
  } catch ( Forminator_Addon_Campaignmonitor_Exception $e ) {
699
+ // handle all internal addon exceptions with `Forminator_Addon_Campaignmonitor_Exception`.
700
 
701
+ // use wp_error, for future usage it can be returned to page entries.
702
  $wp_error = new WP_Error( 'forminator_addon_campaignmonitor_delete_subscriber', $e->getMessage() );
703
+ // handle this in addon by self, since page entries cant handle error messages on delete yet.
704
  wp_die(
705
  esc_html( $wp_error->get_error_message() ),
706
  esc_html( $this->addon->get_title() ),
addons/pro/campaignmonitor/class-forminator-addon-campaignmonitor-form-settings.php CHANGED
@@ -42,7 +42,7 @@ class Forminator_Addon_Campaignmonitor_Form_Settings extends Forminator_Addon_Fo
42
  * @return array
43
  */
44
  public function form_settings_wizards() {
45
- // numerical array steps
46
  return array(
47
  array(
48
  'callback' => array( $this, 'pick_name' ),
@@ -318,11 +318,11 @@ class Forminator_Addon_Campaignmonitor_Form_Settings extends Forminator_Addon_Fo
318
  $multi_id = $submitted_data['multi_id'];
319
  unset( $submitted_data['multi_id'] );
320
 
321
- // find type of email
322
  $email_fields = array();
323
  $forminator_field_element_ids = array();
324
  foreach ( $this->form_fields as $form_field ) {
325
- // collect element ids
326
  $forminator_field_element_ids[] = $form_field['element_id'];
327
  if ( 'email' === $form_field['type'] ) {
328
  $email_fields[] = $form_field;
@@ -606,7 +606,7 @@ class Forminator_Addon_Campaignmonitor_Form_Settings extends Forminator_Addon_Fo
606
  * @return bool
607
  */
608
  public function setup_options_is_completed( $submitted_data ) {
609
- // all settings here are optional, so it can be marked as completed
610
  return true;
611
  }
612
 
@@ -662,7 +662,7 @@ class Forminator_Addon_Campaignmonitor_Form_Settings extends Forminator_Addon_Fo
662
  foreach ( $this->get_form_settings_values() as $key => $value ) {
663
  $multi_ids[] = array(
664
  'id' => $key,
665
- // use name that was added by user on creating connection
666
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
667
  );
668
  }
@@ -678,7 +678,7 @@ class Forminator_Addon_Campaignmonitor_Form_Settings extends Forminator_Addon_Fo
678
  * @param array $submitted_data
679
  */
680
  public function disconnect_form( $submitted_data ) {
681
- // only execute if multi_id provided on submitted data
682
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
683
  $addon_form_settings = $this->get_form_settings_values();
684
  unset( $addon_form_settings[ $submitted_data['multi_id'] ] );
42
  * @return array
43
  */
44
  public function form_settings_wizards() {
45
+ // numerical array steps.
46
  return array(
47
  array(
48
  'callback' => array( $this, 'pick_name' ),
318
  $multi_id = $submitted_data['multi_id'];
319
  unset( $submitted_data['multi_id'] );
320
 
321
+ // find type of email.
322
  $email_fields = array();
323
  $forminator_field_element_ids = array();
324
  foreach ( $this->form_fields as $form_field ) {
325
+ // collect element ids.
326
  $forminator_field_element_ids[] = $form_field['element_id'];
327
  if ( 'email' === $form_field['type'] ) {
328
  $email_fields[] = $form_field;
606
  * @return bool
607
  */
608
  public function setup_options_is_completed( $submitted_data ) {
609
+ // all settings here are optional, so it can be marked as completed.
610
  return true;
611
  }
612
 
662
  foreach ( $this->get_form_settings_values() as $key => $value ) {
663
  $multi_ids[] = array(
664
  'id' => $key,
665
+ // use name that was added by user on creating connection.
666
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
667
  );
668
  }
678
  * @param array $submitted_data
679
  */
680
  public function disconnect_form( $submitted_data ) {
681
+ // only execute if multi_id provided on submitted data.
682
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
683
  $addon_form_settings = $this->get_form_settings_values();
684
  unset( $addon_form_settings[ $submitted_data['multi_id'] ] );
addons/pro/campaignmonitor/class-forminator-addon-campaignmonitor-quiz-hooks.php CHANGED
@@ -64,8 +64,8 @@ class Forminator_Addon_Campaignmonitor_Quiz_Hooks extends Forminator_Addon_Quiz_
64
  * @since 1.3
65
  *
66
  * @param array $submitted_data
67
- * @param int $quiz_id current Quiz ID
68
- * @param Forminator_Addon_Campaignmonitor_Quiz_Settings $quiz_settings_instance Campaign Monitor Addon Quiz Settings instance
69
  */
70
  $submitted_data = apply_filters(
71
  'forminator_addon_campaignmonitor_quiz_submitted_data',
@@ -93,16 +93,16 @@ class Forminator_Addon_Campaignmonitor_Quiz_Hooks extends Forminator_Addon_Quiz_
93
  *
94
  * @since 1.3
95
  *
96
- * @param int $quiz_id current Quiz ID
97
  * @param array $submitted_data
98
- * @param Forminator_Addon_Campaignmonitor_Quiz_Settings $quiz_settings_instance Campaign Monitor Addon Quiz Settings instance
99
  */
100
  do_action( 'forminator_addon_campaignmonitor_before_add_subscriber', $quiz_id, $submitted_data, $quiz_settings_instance );
101
 
102
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
103
- // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to campaign monitor
104
  if ( $quiz_settings_instance->is_multi_quiz_settings_complete( $key ) ) {
105
- // exec only on completed connection
106
  $data[] = array(
107
  'name' => 'status-' . $key,
108
  'value' => $this->get_status_on_add_subscriber( $key, $submitted_data, $addon_setting_value, $quiz_settings, $form_entry_fields ),
@@ -117,9 +117,9 @@ class Forminator_Addon_Campaignmonitor_Quiz_Hooks extends Forminator_Addon_Quiz_
117
  * @since 1.3
118
  *
119
  * @param array $entry_fields
120
- * @param int $quiz_id current Quiz ID
121
  * @param array $submitted_data
122
- * @param Forminator_Addon_Campaignmonitor_Quiz_Settings $quiz_settings_instance Campaign Monitor Addon Quiz Settings instance
123
  */
124
  $data = apply_filters(
125
  'forminator_addon_campaignmonitor_entry_fields',
@@ -148,7 +148,7 @@ class Forminator_Addon_Campaignmonitor_Quiz_Hooks extends Forminator_Addon_Quiz_
148
  * @return array `is_sent` true means its success send data to ampaign Monitor, false otherwise
149
  */
150
  private function get_status_on_add_subscriber( $connection_id, $submitted_data, $connection_settings, $quiz_settings, $form_entry_fields = array() ) {
151
- // initialize as null
152
  $api = null;
153
 
154
  $quiz_id = $this->quiz_id;
@@ -176,7 +176,7 @@ class Forminator_Addon_Campaignmonitor_Quiz_Hooks extends Forminator_Addon_Quiz_
176
  $email = $submitted_data[ $email_element_id ];
177
  $email = strtolower( trim( $email ) );
178
 
179
- // processed
180
  unset( $fields_map['default_field_email'] );
181
 
182
  $name_element_id = $connection_settings['fields_map']['default_field_name'];
@@ -192,11 +192,11 @@ class Forminator_Addon_Campaignmonitor_Quiz_Hooks extends Forminator_Addon_Quiz_
192
  $args['Name'] = $submitted_data[ $name_element_id ];
193
  }
194
 
195
- // processed
196
  unset( $fields_map['default_field_name'] );
197
 
198
  $custom_fields = array();
199
- // process rest extra fields if available
200
  foreach ( $fields_map as $field_id => $element_id ) {
201
  if ( ! empty( $element_id ) ) {
202
  if ( isset( $submitted_data[ $element_id ] ) && ( ! empty( $submitted_data[ $element_id ] ) || 0 === (int) $submitted_data[ $element_id ] ) ) {
@@ -211,7 +211,7 @@ class Forminator_Addon_Campaignmonitor_Quiz_Hooks extends Forminator_Addon_Quiz_
211
  'Key' => $field_id,
212
  'Value' => $element_value,
213
  );
214
- unset( $element_value ); // unset for next loop
215
  }
216
  }
217
  }
@@ -238,12 +238,12 @@ class Forminator_Addon_Campaignmonitor_Quiz_Hooks extends Forminator_Addon_Quiz_
238
  * @since 1.3
239
  *
240
  * @param array $args
241
- * @param int $quiz_id Current Quiz id
242
- * @param string $connection_id ID of current connection
243
  * @param array $submitted_data
244
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
245
- * @param array $quiz_settings Displayed Quiz settings
246
- * @param Forminator_Addon_Campaignmonitor_Quiz_Settings $quiz_settings_instance Campaign Monitor Addon Quiz Settings instance
247
  */
248
  $args = apply_filters(
249
  'forminator_addon_campaignmonitor_add_subscriber_args',
@@ -268,8 +268,8 @@ class Forminator_Addon_Campaignmonitor_Quiz_Hooks extends Forminator_Addon_Quiz_
268
  'data_sent' => $api->get_last_data_sent(),
269
  'data_received' => $api->get_last_data_received(),
270
  'url_request' => $api->get_last_url_request(),
271
- 'subscriber_email' => $api->get_last_data_received(), // for delete reference
272
- 'list_id' => $list_id, // for delete reference
273
  );
274
 
275
  } catch ( Forminator_Addon_Campaignmonitor_Exception $e ) {
@@ -309,8 +309,8 @@ class Forminator_Addon_Campaignmonitor_Quiz_Hooks extends Forminator_Addon_Quiz_
309
  * @since 1.3
310
  *
311
  * @param array $addon_meta_data
312
- * @param int $quiz_id current Quiz ID
313
- * @param Forminator_Addon_Campaignmonitor_Quiz_Settings $quiz_settings_instance Campaign Monitor Addon Quiz Settings instance
314
  */
315
  $addon_meta_data = apply_filters(
316
  'forminator_addon_campaignmonitor_metadata',
@@ -398,7 +398,7 @@ class Forminator_Addon_Campaignmonitor_Quiz_Hooks extends Forminator_Addon_Quiz_
398
  }
399
 
400
  if ( Forminator_Addon_Campaignmonitor::is_show_full_log() ) {
401
- // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_CAMPAIGNMONITOR_SHOW_FULL_LOG', true)`
402
  if ( isset( $status['url_request'] ) ) {
403
  $sub_entries[] = array(
404
  'label' => __( 'API URL', 'forminator' ),
@@ -423,7 +423,7 @@ class Forminator_Addon_Campaignmonitor_Quiz_Hooks extends Forminator_Addon_Quiz_
423
 
424
  $additional_entry_item['sub_entries'] = $sub_entries;
425
 
426
- // return single array
427
  return $additional_entry_item;
428
  }
429
 
@@ -448,9 +448,9 @@ class Forminator_Addon_Campaignmonitor_Quiz_Hooks extends Forminator_Addon_Quiz_
448
  *
449
  * @since 1.3
450
  *
451
- * @param array $export_headers headers to be displayed on export file
452
- * @param int $quiz_id current Quiz ID
453
- * @param Forminator_Addon_Campaignmonitor_Quiz_Settings $quiz_settings_instance Campaign Monitor Addon Quiz Settings instance
454
  */
455
  $export_headers = apply_filters(
456
  'forminator_addon_campaignmonitor_export_headers',
@@ -485,8 +485,8 @@ class Forminator_Addon_Campaignmonitor_Quiz_Hooks extends Forminator_Addon_Quiz_
485
  * @since 1.3
486
  *
487
  * @param array $addon_meta_data
488
- * @param int $quiz_id current Quiz ID
489
- * @param Forminator_Addon_Campaignmonitor_Quiz_Settings $quiz_settings_instance Campaign Monitor Addon Quiz Settings instance
490
  */
491
  $addon_meta_data = apply_filters(
492
  'forminator_addon_campaignmonitor_metadata',
@@ -504,11 +504,11 @@ class Forminator_Addon_Campaignmonitor_Quiz_Hooks extends Forminator_Addon_Quiz_
504
  *
505
  * @since 1.3
506
  *
507
- * @param array $export_columns column to be exported
508
- * @param int $quiz_id current Quiz ID
509
- * @param Forminator_Form_Entry_Model $entry_model Form Entry Model
510
- * @param array $addon_meta_data meta data saved by addon on entry fields
511
- * @param Forminator_Addon_Campaignmonitor_Quiz_Settings $quiz_settings_instance Campaign Monitor Addon Quiz Settings instance
512
  */
513
  $export_columns = apply_filters(
514
  'forminator_addon_campaignmonitor_export_columns',
@@ -541,15 +541,15 @@ class Forminator_Addon_Campaignmonitor_Quiz_Hooks extends Forminator_Addon_Quiz_
541
 
542
  $addon_meta_data = $addon_meta_data[0];
543
 
544
- // make sure its `status`, because we only add this
545
  if ( 'status' !== $addon_meta_data['name'] ) {
546
  if ( stripos( $addon_meta_data['name'], 'status-' ) === 0 ) {
547
  $meta_data = array();
548
  foreach ( $addon_meta_datas as $addon_meta_data ) {
549
- // make it like single value so it will be processed like single meta data
550
  $addon_meta_data['name'] = 'status';
551
 
552
- // add it on an array for next recursive process
553
  $meta_data[] = $this->get_from_addon_meta_data( array( $addon_meta_data ), $key, $default );
554
  }
555
 
@@ -589,7 +589,7 @@ class Forminator_Addon_Campaignmonitor_Quiz_Hooks extends Forminator_Addon_Quiz_
589
  * @return bool
590
  */
591
  public function on_before_delete_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {
592
- // attach hook first
593
  $quiz_id = $this->quiz_id;
594
  $quiz_settings_instance = $this->quiz_settings_instance;
595
 
@@ -600,9 +600,9 @@ class Forminator_Addon_Campaignmonitor_Quiz_Hooks extends Forminator_Addon_Quiz_
600
  * @since 1.1
601
  *
602
  * @param array $addon_meta_data
603
- * @param int $quiz_id current Quiz ID
604
- * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model
605
- * @param Forminator_Addon_Campaignmonitor_Quiz_Settings $quiz_settings_instance Campaign Monitor Addon Quiz Settings instance
606
  */
607
  $addon_meta_data = apply_filters(
608
  'forminator_addon_campaignmonitor_metadata',
@@ -617,10 +617,10 @@ class Forminator_Addon_Campaignmonitor_Quiz_Hooks extends Forminator_Addon_Quiz_
617
  *
618
  * @since 1.1
619
  *
620
- * @param int $quiz_id current Quiz ID
621
- * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model
622
- * @param array $addon_meta_data addon meta data
623
- * @param Forminator_Addon_Campaignmonitor_Quiz_Settings $quiz_settings_instance Campaign Monitor Addon Quiz Settings instance
624
  */
625
  do_action(
626
  'forminator_addon_campaignmonitor_on_before_delete_submission',
@@ -663,9 +663,9 @@ class Forminator_Addon_Campaignmonitor_Quiz_Hooks extends Forminator_Addon_Quiz_
663
  * @since 1.3
664
  *
665
  * @param array $subscriber_ids_to_delete
666
- * @param int $quiz_id current Quiz ID
667
- * @param array $addon_meta_data addon meta data
668
- * @param Forminator_Addon_Campaignmonitor_Quiz_Settings $quiz_settings_instance Campaign Monitor Addon Quiz Settings instance
669
  *
670
  */
671
  $subscribers_to_delete = apply_filters(
@@ -689,11 +689,11 @@ class Forminator_Addon_Campaignmonitor_Quiz_Hooks extends Forminator_Addon_Quiz_
689
  return true;
690
 
691
  } catch ( Forminator_Addon_Campaignmonitor_Exception $e ) {
692
- // handle all internal addon exceptions with `Forminator_Addon_Campaignmonitor_Exception`
693
 
694
- // use wp_error, for future usage it can be returned to page entries
695
  $wp_error = new WP_Error( 'forminator_addon_campaignmonitor_delete_subscriber', $e->getMessage() );
696
- // handle this in addon by self, since page entries cant handle error messages on delete yet
697
  wp_die(
698
  esc_html( $wp_error->get_error_message() ),
699
  esc_html( $this->addon->get_title() ),
64
  * @since 1.3
65
  *
66
  * @param array $submitted_data
67
+ * @param int $quiz_id current Quiz ID.
68
+ * @param Forminator_Addon_Campaignmonitor_Quiz_Settings $quiz_settings_instance Campaign Monitor Addon Quiz Settings instance.
69
  */
70
  $submitted_data = apply_filters(
71
  'forminator_addon_campaignmonitor_quiz_submitted_data',
93
  *
94
  * @since 1.3
95
  *
96
+ * @param int $quiz_id current Quiz ID.
97
  * @param array $submitted_data
98
+ * @param Forminator_Addon_Campaignmonitor_Quiz_Settings $quiz_settings_instance Campaign Monitor Addon Quiz Settings instance.
99
  */
100
  do_action( 'forminator_addon_campaignmonitor_before_add_subscriber', $quiz_id, $submitted_data, $quiz_settings_instance );
101
 
102
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
103
+ // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to campaign monitor.
104
  if ( $quiz_settings_instance->is_multi_quiz_settings_complete( $key ) ) {
105
+ // exec only on completed connection.
106
  $data[] = array(
107
  'name' => 'status-' . $key,
108
  'value' => $this->get_status_on_add_subscriber( $key, $submitted_data, $addon_setting_value, $quiz_settings, $form_entry_fields ),
117
  * @since 1.3
118
  *
119
  * @param array $entry_fields
120
+ * @param int $quiz_id current Quiz ID.
121
  * @param array $submitted_data
122
+ * @param Forminator_Addon_Campaignmonitor_Quiz_Settings $quiz_settings_instance Campaign Monitor Addon Quiz Settings instance.
123
  */
124
  $data = apply_filters(
125
  'forminator_addon_campaignmonitor_entry_fields',
148
  * @return array `is_sent` true means its success send data to ampaign Monitor, false otherwise
149
  */
150
  private function get_status_on_add_subscriber( $connection_id, $submitted_data, $connection_settings, $quiz_settings, $form_entry_fields = array() ) {
151
+ // initialize as null.
152
  $api = null;
153
 
154
  $quiz_id = $this->quiz_id;
176
  $email = $submitted_data[ $email_element_id ];
177
  $email = strtolower( trim( $email ) );
178
 
179
+ // processed.
180
  unset( $fields_map['default_field_email'] );
181
 
182
  $name_element_id = $connection_settings['fields_map']['default_field_name'];
192
  $args['Name'] = $submitted_data[ $name_element_id ];
193
  }
194
 
195
+ // processed.
196
  unset( $fields_map['default_field_name'] );
197
 
198
  $custom_fields = array();
199
+ // process rest extra fields if available.
200
  foreach ( $fields_map as $field_id => $element_id ) {
201
  if ( ! empty( $element_id ) ) {
202
  if ( isset( $submitted_data[ $element_id ] ) && ( ! empty( $submitted_data[ $element_id ] ) || 0 === (int) $submitted_data[ $element_id ] ) ) {
211
  'Key' => $field_id,
212
  'Value' => $element_value,
213
  );
214
+ unset( $element_value ); // unset for next loop.
215
  }
216
  }
217
  }
238
  * @since 1.3
239
  *
240
  * @param array $args
241
+ * @param int $quiz_id Current Quiz id.
242
+ * @param string $connection_id ID of current connection.
243
  * @param array $submitted_data
244
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
245
+ * @param array $quiz_settings Displayed Quiz settings.
246
+ * @param Forminator_Addon_Campaignmonitor_Quiz_Settings $quiz_settings_instance Campaign Monitor Addon Quiz Settings instance.
247
  */
248
  $args = apply_filters(
249
  'forminator_addon_campaignmonitor_add_subscriber_args',
268
  'data_sent' => $api->get_last_data_sent(),
269
  'data_received' => $api->get_last_data_received(),
270
  'url_request' => $api->get_last_url_request(),
271
+ 'subscriber_email' => $api->get_last_data_received(), // for delete reference.
272
+ 'list_id' => $list_id, // for delete reference.
273
  );
274
 
275
  } catch ( Forminator_Addon_Campaignmonitor_Exception $e ) {
309
  * @since 1.3
310
  *
311
  * @param array $addon_meta_data
312
+ * @param int $quiz_id current Quiz ID.
313
+ * @param Forminator_Addon_Campaignmonitor_Quiz_Settings $quiz_settings_instance Campaign Monitor Addon Quiz Settings instance.
314
  */
315
  $addon_meta_data = apply_filters(
316
  'forminator_addon_campaignmonitor_metadata',
398
  }
399
 
400
  if ( Forminator_Addon_Campaignmonitor::is_show_full_log() ) {
401
+ // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_CAMPAIGNMONITOR_SHOW_FULL_LOG', true)`.
402
  if ( isset( $status['url_request'] ) ) {
403
  $sub_entries[] = array(
404
  'label' => __( 'API URL', 'forminator' ),
423
 
424
  $additional_entry_item['sub_entries'] = $sub_entries;
425
 
426
+ // return single array.
427
  return $additional_entry_item;
428
  }
429
 
448
  *
449
  * @since 1.3
450
  *
451
+ * @param array $export_headers headers to be displayed on export file.
452
+ * @param int $quiz_id current Quiz ID.
453
+ * @param Forminator_Addon_Campaignmonitor_Quiz_Settings $quiz_settings_instance Campaign Monitor Addon Quiz Settings instance.
454
  */
455
  $export_headers = apply_filters(
456
  'forminator_addon_campaignmonitor_export_headers',
485
  * @since 1.3
486
  *
487
  * @param array $addon_meta_data
488
+ * @param int $quiz_id current Quiz ID.
489
+ * @param Forminator_Addon_Campaignmonitor_Quiz_Settings $quiz_settings_instance Campaign Monitor Addon Quiz Settings instance.
490
  */
491
  $addon_meta_data = apply_filters(
492
  'forminator_addon_campaignmonitor_metadata',
504
  *
505
  * @since 1.3
506
  *
507
+ * @param array $export_columns column to be exported.
508
+ * @param int $quiz_id current Quiz ID.
509
+ * @param Forminator_Form_Entry_Model $entry_model Form Entry Model.
510
+ * @param array $addon_meta_data meta data saved by addon on entry fields.
511
+ * @param Forminator_Addon_Campaignmonitor_Quiz_Settings $quiz_settings_instance Campaign Monitor Addon Quiz Settings instance.
512
  */
513
  $export_columns = apply_filters(
514
  'forminator_addon_campaignmonitor_export_columns',
541
 
542
  $addon_meta_data = $addon_meta_data[0];
543
 
544
+ // make sure its `status`, because we only add this.
545
  if ( 'status' !== $addon_meta_data['name'] ) {
546
  if ( stripos( $addon_meta_data['name'], 'status-' ) === 0 ) {
547
  $meta_data = array();
548
  foreach ( $addon_meta_datas as $addon_meta_data ) {
549
+ // make it like single value so it will be processed like single meta data.
550
  $addon_meta_data['name'] = 'status';
551
 
552
+ // add it on an array for next recursive process.
553
  $meta_data[] = $this->get_from_addon_meta_data( array( $addon_meta_data ), $key, $default );
554
  }
555
 
589
  * @return bool
590
  */
591
  public function on_before_delete_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {
592
+ // attach hook first.
593
  $quiz_id = $this->quiz_id;
594
  $quiz_settings_instance = $this->quiz_settings_instance;
595
 
600
  * @since 1.1
601
  *
602
  * @param array $addon_meta_data
603
+ * @param int $quiz_id current Quiz ID.
604
+ * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model.
605
+ * @param Forminator_Addon_Campaignmonitor_Quiz_Settings $quiz_settings_instance Campaign Monitor Addon Quiz Settings instance.
606
  */
607
  $addon_meta_data = apply_filters(
608
  'forminator_addon_campaignmonitor_metadata',
617
  *
618
  * @since 1.1
619
  *
620
+ * @param int $quiz_id current Quiz ID.
621
+ * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model.
622
+ * @param array $addon_meta_data addon meta data.
623
+ * @param Forminator_Addon_Campaignmonitor_Quiz_Settings $quiz_settings_instance Campaign Monitor Addon Quiz Settings instance.
624
  */
625
  do_action(
626
  'forminator_addon_campaignmonitor_on_before_delete_submission',
663
  * @since 1.3
664
  *
665
  * @param array $subscriber_ids_to_delete
666
+ * @param int $quiz_id current Quiz ID.
667
+ * @param array $addon_meta_data addon meta data.
668
+ * @param Forminator_Addon_Campaignmonitor_Quiz_Settings $quiz_settings_instance Campaign Monitor Addon Quiz Settings instance.
669
  *
670
  */
671
  $subscribers_to_delete = apply_filters(
689
  return true;
690
 
691
  } catch ( Forminator_Addon_Campaignmonitor_Exception $e ) {
692
+ // handle all internal addon exceptions with `Forminator_Addon_Campaignmonitor_Exception`.
693
 
694
+ // use wp_error, for future usage it can be returned to page entries.
695
  $wp_error = new WP_Error( 'forminator_addon_campaignmonitor_delete_subscriber', $e->getMessage() );
696
+ // handle this in addon by self, since page entries cant handle error messages on delete yet.
697
  wp_die(
698
  esc_html( $wp_error->get_error_message() ),
699
  esc_html( $this->addon->get_title() ),
addons/pro/campaignmonitor/class-forminator-addon-campaignmonitor-quiz-settings.php CHANGED
@@ -42,7 +42,7 @@ class Forminator_Addon_Campaignmonitor_Quiz_Settings extends Forminator_Addon_Qu
42
  * @return array
43
  */
44
  public function quiz_settings_wizards() {
45
- // numerical array steps
46
  return array(
47
  array(
48
  'callback' => array( $this, 'pick_name' ),
@@ -318,12 +318,12 @@ class Forminator_Addon_Campaignmonitor_Quiz_Settings extends Forminator_Addon_Qu
318
  $multi_id = $submitted_data['multi_id'];
319
  unset( $submitted_data['multi_id'] );
320
 
321
- // find type of email
322
  $email_fields = array();
323
  $forminator_field_element_ids = array();
324
  $forminator_quiz_element_ids = array();
325
  foreach ( $this->form_fields as $form_field ) {
326
- // collect element ids
327
  $forminator_field_element_ids[] = $form_field['element_id'];
328
  if ( 'email' === $form_field['type'] ) {
329
  $email_fields[] = $form_field;
@@ -335,7 +335,7 @@ class Forminator_Addon_Campaignmonitor_Quiz_Settings extends Forminator_Addon_Qu
335
  'quiz-name' => __( 'Quiz Name', 'forminator' ),
336
  );
337
  foreach ( $quiz_questions as $quiz_question ) {
338
- // collect element ids
339
  $forminator_quiz_element_ids[] = $quiz_question['slug'];
340
  $quiz_fields[ $quiz_question['slug'] ] = $quiz_question['title'];
341
  }
@@ -628,7 +628,7 @@ class Forminator_Addon_Campaignmonitor_Quiz_Settings extends Forminator_Addon_Qu
628
  * @return bool
629
  */
630
  public function setup_options_is_completed( $submitted_data ) {
631
- // all settings here are optional, so it can be marked as completed
632
  return true;
633
  }
634
 
@@ -684,7 +684,7 @@ class Forminator_Addon_Campaignmonitor_Quiz_Settings extends Forminator_Addon_Qu
684
  foreach ( $this->get_quiz_settings_values() as $key => $value ) {
685
  $multi_ids[] = array(
686
  'id' => $key,
687
- // use name that was added by user on creating connection
688
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
689
  );
690
  }
@@ -700,7 +700,7 @@ class Forminator_Addon_Campaignmonitor_Quiz_Settings extends Forminator_Addon_Qu
700
  * @param array $submitted_data
701
  */
702
  public function disconnect_form( $submitted_data ) {
703
- // only execute if multi_id provided on submitted data
704
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
705
  $addon_form_settings = $this->get_quiz_settings_values();
706
  unset( $addon_form_settings[ $submitted_data['multi_id'] ] );
42
  * @return array
43
  */
44
  public function quiz_settings_wizards() {
45
+ // numerical array steps.
46
  return array(
47
  array(
48
  'callback' => array( $this, 'pick_name' ),
318
  $multi_id = $submitted_data['multi_id'];
319
  unset( $submitted_data['multi_id'] );
320
 
321
+ // find type of email.
322
  $email_fields = array();
323
  $forminator_field_element_ids = array();
324
  $forminator_quiz_element_ids = array();
325
  foreach ( $this->form_fields as $form_field ) {
326
+ // collect element ids.
327
  $forminator_field_element_ids[] = $form_field['element_id'];
328
  if ( 'email' === $form_field['type'] ) {
329
  $email_fields[] = $form_field;
335
  'quiz-name' => __( 'Quiz Name', 'forminator' ),
336
  );
337
  foreach ( $quiz_questions as $quiz_question ) {
338
+ // collect element ids.
339
  $forminator_quiz_element_ids[] = $quiz_question['slug'];
340
  $quiz_fields[ $quiz_question['slug'] ] = $quiz_question['title'];
341
  }
628
  * @return bool
629
  */
630
  public function setup_options_is_completed( $submitted_data ) {
631
+ // all settings here are optional, so it can be marked as completed.
632
  return true;
633
  }
634
 
684
  foreach ( $this->get_quiz_settings_values() as $key => $value ) {
685
  $multi_ids[] = array(
686
  'id' => $key,
687
+ // use name that was added by user on creating connection.
688
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
689
  );
690
  }
700
  * @param array $submitted_data
701
  */
702
  public function disconnect_form( $submitted_data ) {
703
+ // only execute if multi_id provided on submitted data.
704
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
705
  $addon_form_settings = $this->get_quiz_settings_values();
706
  unset( $addon_form_settings[ $submitted_data['multi_id'] ] );
addons/pro/campaignmonitor/class-forminator-addon-campaignmonitor.php CHANGED
@@ -37,7 +37,7 @@ final class Forminator_Addon_Campaignmonitor extends Forminator_Addon_Abstract {
37
  * @since 1.0 Campaignmonitor Addon
38
  */
39
  public function __construct() {
40
- // late init to allow translation
41
  $this->_description = __( 'Get awesome by your form.', 'forminator' );
42
  $this->_activation_error_message = __( 'Sorry but we failed to activate Campaign Monitor Integration, don\'t hesitate to contact us', 'forminator' );
43
  $this->_deactivation_error_message = __( 'Sorry but we failed to deactivate Campaign Monitor Integration, please try again', 'forminator' );
@@ -78,12 +78,12 @@ final class Forminator_Addon_Campaignmonitor extends Forminator_Addon_Abstract {
78
  */
79
  public function is_connected() {
80
  try {
81
- // check if its active
82
  if ( ! $this->is_active() ) {
83
  throw new Forminator_Addon_Campaignmonitor_Exception( __( 'Campaign Monitor is not active', 'forminator' ) );
84
  }
85
 
86
- // if user completed api setup
87
  $is_connected = $this->is_api_completed();
88
 
89
  } catch ( Forminator_Addon_Campaignmonitor_Exception $e ) {
@@ -123,7 +123,7 @@ final class Forminator_Addon_Campaignmonitor extends Forminator_Addon_Abstract {
123
  throw new Forminator_Addon_Campaignmonitor_Exception( __( 'Invalid Form Settings of Campaign Monitor', 'forminator' ) );
124
  }
125
 
126
- // Mark as active when there is at least one active connection
127
  if ( false === $form_settings_instance->find_one_active_connection() ) {
128
  throw new Forminator_Addon_Campaignmonitor_Exception( __( 'No active Campaign Monitor connection found in this form', 'forminator' ) );
129
  }
@@ -141,8 +141,8 @@ final class Forminator_Addon_Campaignmonitor extends Forminator_Addon_Abstract {
141
  * @since 1.3
142
  *
143
  * @param bool $is_form_connected
144
- * @param int $form_id Current Form ID
145
- * @param Forminator_Addon_Campaignmonitor_Form_Settings|null $form_settings_instance Instance of form settings, or null when unavailable
146
  *
147
  */
148
  $is_form_connected = apply_filters( 'forminator_addon_campaignmonitor_is_form_connected', $is_form_connected, $form_id, $form_settings_instance );
@@ -285,7 +285,7 @@ final class Forminator_Addon_Campaignmonitor extends Forminator_Addon_Abstract {
285
  }
286
 
287
  if ( ! $has_errors ) {
288
- // validate api
289
  try {
290
 
291
  $this->validate_api( $api_key );
@@ -331,7 +331,7 @@ final class Forminator_Addon_Campaignmonitor extends Forminator_Addon_Abstract {
331
  );
332
  $this->save_settings_values( $settings_values );
333
 
334
- // no form_id its on global settings
335
  if ( empty( $form_id ) ) {
336
  $show_success = true;
337
  }
@@ -388,7 +388,7 @@ final class Forminator_Addon_Campaignmonitor extends Forminator_Addon_Abstract {
388
  public function is_api_completed() {
389
  $setting_values = $this->get_settings_values();
390
 
391
- // check api_key set up
392
  return ( isset( $setting_values['api_key'] ) && ! empty( $setting_values['api_key'] ) );
393
  }
394
 
@@ -533,7 +533,7 @@ final class Forminator_Addon_Campaignmonitor extends Forminator_Addon_Abstract {
533
  throw new Forminator_Addon_Campaignmonitor_Exception( __( 'Invalid Quiz Settings of Campaign Monitor', 'forminator' ) );
534
  }
535
 
536
- // Mark as active when there is at least one active connection
537
  if ( false === $quiz_settings_instance->find_one_active_connection() ) {
538
  throw new Forminator_Addon_Campaignmonitor_Exception( __( 'No active Campaign Monitor connection found in this quiz', 'forminator' ) );
539
  }
@@ -551,8 +551,8 @@ final class Forminator_Addon_Campaignmonitor extends Forminator_Addon_Abstract {
551
  * @since 1.3
552
  *
553
  * @param bool $is_quiz_connected
554
- * @param int $quiz_id Current Quiz ID
555
- * @param Forminator_Addon_Campaignmonitor_Quiz_Settings|null $quiz_settings_instance Instance of quiz settings, or null when unavailable
556
  *
557
  */
558
  $is_quiz_connected = apply_filters( 'forminator_addon_campaignmonitor_is_quiz_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
@@ -573,7 +573,7 @@ final class Forminator_Addon_Campaignmonitor extends Forminator_Addon_Abstract {
573
  public function is_quiz_lead_connected( $quiz_id ) {
574
 
575
  try {
576
- // initialize with null
577
  $quiz_settings_instance = null;
578
  if ( ! $this->is_connected() ) {
579
  throw new Forminator_Addon_Campaignmonitor_Exception( __( ' Campaign Monitor is not connected', 'forminator' ) );
@@ -603,8 +603,8 @@ final class Forminator_Addon_Campaignmonitor extends Forminator_Addon_Abstract {
603
  * @since 1.1
604
  *
605
  * @param bool $is_quiz_connected
606
- * @param int $quiz_id Current Form ID
607
- * @param Forminator_Addon_Campaignmonitor_Quiz_Settings|null $quiz_settings_instance Instance of quiz settings, or null when unavailable
608
  *
609
  */
610
  $is_quiz_connected = apply_filters( 'forminator_addon_campaignmonitor_is_quiz_lead_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
37
  * @since 1.0 Campaignmonitor Addon
38
  */
39
  public function __construct() {
40
+ // late init to allow translation.
41
  $this->_description = __( 'Get awesome by your form.', 'forminator' );
42
  $this->_activation_error_message = __( 'Sorry but we failed to activate Campaign Monitor Integration, don\'t hesitate to contact us', 'forminator' );
43
  $this->_deactivation_error_message = __( 'Sorry but we failed to deactivate Campaign Monitor Integration, please try again', 'forminator' );
78
  */
79
  public function is_connected() {
80
  try {
81
+ // check if its active.
82
  if ( ! $this->is_active() ) {
83
  throw new Forminator_Addon_Campaignmonitor_Exception( __( 'Campaign Monitor is not active', 'forminator' ) );
84
  }
85
 
86
+ // if user completed api setup.
87
  $is_connected = $this->is_api_completed();
88
 
89
  } catch ( Forminator_Addon_Campaignmonitor_Exception $e ) {
123
  throw new Forminator_Addon_Campaignmonitor_Exception( __( 'Invalid Form Settings of Campaign Monitor', 'forminator' ) );
124
  }
125
 
126
+ // Mark as active when there is at least one active connection.
127
  if ( false === $form_settings_instance->find_one_active_connection() ) {
128
  throw new Forminator_Addon_Campaignmonitor_Exception( __( 'No active Campaign Monitor connection found in this form', 'forminator' ) );
129
  }
141
  * @since 1.3
142
  *
143
  * @param bool $is_form_connected
144
+ * @param int $form_id Current Form ID.
145
+ * @param Forminator_Addon_Campaignmonitor_Form_Settings|null $form_settings_instance Instance of form settings, or null when unavailable.
146
  *
147
  */
148
  $is_form_connected = apply_filters( 'forminator_addon_campaignmonitor_is_form_connected', $is_form_connected, $form_id, $form_settings_instance );
285
  }
286
 
287
  if ( ! $has_errors ) {
288
+ // validate api.
289
  try {
290
 
291
  $this->validate_api( $api_key );
331
  );
332
  $this->save_settings_values( $settings_values );
333
 
334
+ // no form_id its on global settings.
335
  if ( empty( $form_id ) ) {
336
  $show_success = true;
337
  }
388
  public function is_api_completed() {
389
  $setting_values = $this->get_settings_values();
390
 
391
+ // check api_key set up.
392
  return ( isset( $setting_values['api_key'] ) && ! empty( $setting_values['api_key'] ) );
393
  }
394
 
533
  throw new Forminator_Addon_Campaignmonitor_Exception( __( 'Invalid Quiz Settings of Campaign Monitor', 'forminator' ) );
534
  }
535
 
536
+ // Mark as active when there is at least one active connection.
537
  if ( false === $quiz_settings_instance->find_one_active_connection() ) {
538
  throw new Forminator_Addon_Campaignmonitor_Exception( __( 'No active Campaign Monitor connection found in this quiz', 'forminator' ) );
539
  }
551
  * @since 1.3
552
  *
553
  * @param bool $is_quiz_connected
554
+ * @param int $quiz_id Current Quiz ID.
555
+ * @param Forminator_Addon_Campaignmonitor_Quiz_Settings|null $quiz_settings_instance Instance of quiz settings, or null when unavailable.
556
  *
557
  */
558
  $is_quiz_connected = apply_filters( 'forminator_addon_campaignmonitor_is_quiz_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
573
  public function is_quiz_lead_connected( $quiz_id ) {
574
 
575
  try {
576
+ // initialize with null.
577
  $quiz_settings_instance = null;
578
  if ( ! $this->is_connected() ) {
579
  throw new Forminator_Addon_Campaignmonitor_Exception( __( ' Campaign Monitor is not connected', 'forminator' ) );
603
  * @since 1.1
604
  *
605
  * @param bool $is_quiz_connected
606
+ * @param int $quiz_id Current Form ID.
607
+ * @param Forminator_Addon_Campaignmonitor_Quiz_Settings|null $quiz_settings_instance Instance of quiz settings, or null when unavailable.
608
  *
609
  */
610
  $is_quiz_connected = apply_filters( 'forminator_addon_campaignmonitor_is_quiz_lead_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
addons/pro/campaignmonitor/lib/class-forminator-addon-campaignmonitor-wp-api.php CHANGED
@@ -107,7 +107,7 @@ class Forminator_Addon_Campaignmonitor_Wp_Api {
107
  *
108
  * @since 1.1
109
  *
110
- * @param string $user_agent current user agent
111
  */
112
  $user_agent = apply_filters( 'forminator_addon_campaignmonitor_api_user_agent', $user_agent );
113
 
@@ -128,7 +128,7 @@ class Forminator_Addon_Campaignmonitor_Wp_Api {
128
  * @throws Forminator_Addon_Campaignmonitor_Wp_Api_Not_Found_Exception
129
  */
130
  private function request( $verb, $path, $args = array() ) {
131
- // Adding extra user agent for wp remote request
132
  add_filter( 'http_headers_useragent', array( $this, 'filter_user_agent' ) );
133
 
134
  $url = trailingslashit( $this->_endpoint ) . $path;
@@ -139,10 +139,10 @@ class Forminator_Addon_Campaignmonitor_Wp_Api {
139
  *
140
  * @since 1.1
141
  *
142
- * @param string $url full url with scheme
143
- * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`
144
- * @param string $path requested path resource
145
- * @param array $args argument sent to this function
146
  */
147
  $url = apply_filters( 'forminator_addon_campaignmonitor_api_url', $url, $verb, $path, $args );
148
 
@@ -159,9 +159,9 @@ class Forminator_Addon_Campaignmonitor_Wp_Api {
159
  * @since 1.1
160
  *
161
  * @param array $headers
162
- * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`
163
- * @param string $path requested path resource
164
- * @param array $args argument sent to this function
165
  */
166
  $headers = apply_filters( 'forminator_addon_campaignmonitor_api_request_headers', $headers, $verb, $path, $args );
167
 
@@ -176,9 +176,9 @@ class Forminator_Addon_Campaignmonitor_Wp_Api {
176
  *
177
  * @since 1.1
178
  *
179
- * @param array $request_data it will be `http_build_query`-ed when `GET` or `wp_json_encode`-ed otherwise
180
- * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`
181
- * @param string $path requested path resource
182
  */
183
  $args = apply_filters( 'forminator_addon_campaignmonitor_api_request_data', $request_data, $verb, $path );
184
 
@@ -227,7 +227,7 @@ class Forminator_Addon_Campaignmonitor_Wp_Api {
227
 
228
  $body = wp_remote_retrieve_body( $res );
229
 
230
- // probably silent mode
231
  if ( ! empty( $body ) ) {
232
  $res = json_decode( $body );
233
  }
@@ -238,9 +238,9 @@ class Forminator_Addon_Campaignmonitor_Wp_Api {
238
  *
239
  * @since 1.1
240
  *
241
- * @param mixed $response original wp remote request response or decoded body if available
242
- * @param string $body original content of http response's body
243
- * @param array|WP_Error $wp_response original wp remote request response
244
  */
245
  $res = apply_filters( 'forminator_addon_campaignmonitor_api_response', $response, $body, $wp_response );
246
 
107
  *
108
  * @since 1.1
109
  *
110
+ * @param string $user_agent current user agent.
111
  */
112
  $user_agent = apply_filters( 'forminator_addon_campaignmonitor_api_user_agent', $user_agent );
113
 
128
  * @throws Forminator_Addon_Campaignmonitor_Wp_Api_Not_Found_Exception
129
  */
130
  private function request( $verb, $path, $args = array() ) {
131
+ // Adding extra user agent for wp remote request.
132
  add_filter( 'http_headers_useragent', array( $this, 'filter_user_agent' ) );
133
 
134
  $url = trailingslashit( $this->_endpoint ) . $path;
139
  *
140
  * @since 1.1
141
  *
142
+ * @param string $url full url with scheme.
143
+ * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`.
144
+ * @param string $path requested path resource.
145
+ * @param array $args argument sent to this function.
146
  */
147
  $url = apply_filters( 'forminator_addon_campaignmonitor_api_url', $url, $verb, $path, $args );
148
 
159
  * @since 1.1
160
  *
161
  * @param array $headers
162
+ * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`.
163
+ * @param string $path requested path resource.
164
+ * @param array $args argument sent to this function.
165
  */
166
  $headers = apply_filters( 'forminator_addon_campaignmonitor_api_request_headers', $headers, $verb, $path, $args );
167
 
176
  *
177
  * @since 1.1
178
  *
179
+ * @param array $request_data it will be `http_build_query`-ed when `GET` or `wp_json_encode`-ed otherwise.
180
+ * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`.
181
+ * @param string $path requested path resource.
182
  */
183
  $args = apply_filters( 'forminator_addon_campaignmonitor_api_request_data', $request_data, $verb, $path );
184
 
227
 
228
  $body = wp_remote_retrieve_body( $res );
229
 
230
+ // probably silent mode.
231
  if ( ! empty( $body ) ) {
232
  $res = json_decode( $body );
233
  }
238
  *
239
  * @since 1.1
240
  *
241
+ * @param mixed $response original wp remote request response or decoded body if available.
242
+ * @param string $body original content of http response's body.
243
+ * @param array|WP_Error $wp_response original wp remote request response.
244
  */
245
  $res = apply_filters( 'forminator_addon_campaignmonitor_api_response', $response, $body, $wp_response );
246
 
addons/pro/campaignmonitor/views/form-settings/map-fields.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // Defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'multi_id' => '',
1
  <?php
2
+ // Defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'multi_id' => '',
addons/pro/campaignmonitor/views/form-settings/pick-name.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // Defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
1
  <?php
2
+ // Defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
addons/pro/campaignmonitor/views/form-settings/setup-list.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // Defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'list_id' => '',
1
  <?php
2
+ // Defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'list_id' => '',
addons/pro/campaignmonitor/views/form-settings/setup-options.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // Defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'multi_id' => '',
1
  <?php
2
+ // Defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'multi_id' => '',
addons/pro/campaignmonitor/views/quiz-settings/map-fields.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // Defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'multi_id' => '',
1
  <?php
2
+ // Defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'multi_id' => '',
addons/pro/campaignmonitor/views/quiz-settings/pick-name.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // Defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
1
  <?php
2
+ // Defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
addons/pro/campaignmonitor/views/quiz-settings/setup-list.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // Defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'list_id' => '',
1
  <?php
2
+ // Defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'list_id' => '',
addons/pro/campaignmonitor/views/quiz-settings/setup-options.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // Defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'multi_id' => '',
1
  <?php
2
+ // Defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'multi_id' => '',
addons/pro/campaignmonitor/views/settings/setup-api.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // Defaults
3
  $vars = array(
4
  'identifier' => '',
5
  'error_message' => '',
1
  <?php
2
+ // Defaults.
3
  $vars = array(
4
  'identifier' => '',
5
  'error_message' => '',
addons/pro/fortressdb/fortressdb.php CHANGED
@@ -31,5 +31,5 @@ require_once dirname( __FILE__ ) . '/class-fortressdb-forminator.php';
31
  try {
32
  Forminator_Addon_Loader::get_instance()->register( 'FortressDB_Forminator_Addon' );
33
  } catch ( Exception $e ) {
34
- echo $e->getMessage();
35
  }
31
  try {
32
  Forminator_Addon_Loader::get_instance()->register( 'FortressDB_Forminator_Addon' );
33
  } catch ( Exception $e ) {
34
+ echo wp_kses_post( $e->getMessage() );
35
  }
addons/pro/googlesheet/class-forminator-addon-googlesheet-form-hooks.php CHANGED
@@ -64,8 +64,8 @@ class Forminator_Addon_Googlesheet_Form_Hooks extends Forminator_Addon_Form_Hook
64
  *
65
  * @param array $submitted_data
66
  * @param array $form_entry_fields
67
- * @param int $form_id current Form ID
68
- * @param Forminator_Addon_Googlesheet_Form_Settings $form_settings_instance Google Sheets Addon Form Settings instance
69
  */
70
  $submitted_data = apply_filters(
71
  'forminator_addon_googlesheet_form_submitted_data',
@@ -82,8 +82,8 @@ class Forminator_Addon_Googlesheet_Form_Hooks extends Forminator_Addon_Form_Hook
82
  *
83
  * @param array $form_entry_fields
84
  * @param array $submitted_data
85
- * @param int $form_id current Form ID
86
- * @param Forminator_Addon_Googlesheet_Form_Settings $form_settings_instance Google Sheets Addon Form Settings instance
87
  */
88
  $form_entry_fields = apply_filters(
89
  'forminator_addon_googlesheet_form_entry_fields',
@@ -104,16 +104,16 @@ class Forminator_Addon_Googlesheet_Form_Hooks extends Forminator_Addon_Form_Hook
104
  *
105
  * @since 1.2
106
  *
107
- * @param int $form_id current Form ID
108
  * @param array $submitted_data
109
- * @param Forminator_Addon_Googlesheet_Form_Settings $form_settings_instance Google Sheets Addon Form Settings instance
110
  */
111
  do_action( 'forminator_addon_googlesheet_before_create_row', $form_id, $submitted_data, $form_settings_instance );
112
 
113
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
114
- // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to Google Sheets
115
  if ( $form_settings_instance->is_multi_form_settings_complete( $key ) ) {
116
- // exec only on completed connection
117
  $data[] = array(
118
  'name' => 'status-' . $key,
119
  'value' => $this->get_status_on_create_row( $key, $submitted_data, $addon_setting_value, $form_entry_fields ),
@@ -128,10 +128,10 @@ class Forminator_Addon_Googlesheet_Form_Hooks extends Forminator_Addon_Form_Hook
128
  * @since 1.2
129
  *
130
  * @param array $entry_fields
131
- * @param int $form_id current Form ID
132
  * @param array $submitted_data
133
  * @param array $form_entry_fields
134
- * @param Forminator_Addon_Googlesheet_Form_Settings $form_settings_instance Google Sheets Addon Form Settings instance
135
  */
136
  $data = apply_filters(
137
  'forminator_addon_googlesheet_entry_fields',
@@ -159,7 +159,7 @@ class Forminator_Addon_Googlesheet_Form_Hooks extends Forminator_Addon_Form_Hook
159
  * @return array `is_sent` true means its success send data to Google Sheets, false otherwise
160
  */
161
  public function get_status_on_create_row( $connection_id, $submitted_data, $connection_settings, $form_entry_fields ) {
162
- // initialize as null
163
  $api = null;
164
 
165
  $form_id = $this->form_id;
@@ -172,14 +172,14 @@ class Forminator_Addon_Googlesheet_Form_Hooks extends Forminator_Addon_Form_Hook
172
  * @since 1.2
173
  *
174
  * @param array $connection_settings
175
- * @param int $form_id current Form ID
176
  * @param array $submitted_data
177
  * @param array $form_entry_fields
178
- * @param Forminator_Addon_Googlesheet_Form_Settings $form_settings_instance Google Sheets Addon Form Settings instance
179
  */
180
  do_action( 'forminator_addon_googlesheet_before_prepare_sheet_headers', $connection_settings, $form_id, $submitted_data, $form_entry_fields, $form_settings_instance );
181
 
182
- // prepare headers
183
  $header_fields = $this->get_sheet_headers( $connection_settings['file_id'] );
184
 
185
  /**
@@ -187,12 +187,12 @@ class Forminator_Addon_Googlesheet_Form_Hooks extends Forminator_Addon_Form_Hook
187
  *
188
  * @since 1.2
189
  *
190
- * @param array $header_fields sheet headers
191
  * @param array $connection_settings
192
- * @param int $form_id current Form ID
193
  * @param array $submitted_data
194
  * @param array $form_entry_fields
195
- * @param Forminator_Addon_Googlesheet_Form_Settings $form_settings_instance Google Sheets Addon Form Settings instance
196
  */
197
  $header_fields = apply_filters(
198
  'forminator_addon_googlesheet_sheet_headers',
@@ -209,12 +209,12 @@ class Forminator_Addon_Googlesheet_Form_Hooks extends Forminator_Addon_Form_Hook
209
  *
210
  * @since 1.2
211
  *
212
- * @param array $header_fields sheet headers
213
  * @param array $connection_settings
214
- * @param int $form_id current Form ID
215
  * @param array $submitted_data
216
  * @param array $form_entry_fields
217
- * @param Forminator_Addon_Googlesheet_Form_Settings $form_settings_instance Google Sheets Addon Form Settings instance
218
  */
219
  do_action( 'forminator_addon_googlesheet_after_prepare_sheet_headers', $header_fields, $connection_settings, $form_id, $submitted_data, $form_entry_fields, $form_settings_instance );
220
 
@@ -229,11 +229,11 @@ class Forminator_Addon_Googlesheet_Form_Hooks extends Forminator_Addon_Form_Hook
229
  }
230
  $form_entry_fields = $keyed_form_entry_fields;
231
 
232
- // all avail fields on library
233
  $fields = forminator_fields_to_array();
234
  $field_types = array_keys( $fields );
235
 
236
- // sort by length, so stripos will work by traverse from longest field type first
237
  $field_types_strlen = array_map( 'strlen', $field_types );
238
  array_multisort( $field_types_strlen, $field_types );
239
  $field_types = array_reverse( $field_types );
@@ -250,11 +250,11 @@ class Forminator_Addon_Googlesheet_Form_Hooks extends Forminator_Addon_Form_Hook
250
  }
251
 
252
  $meta_value = array();
253
- // take from entry fields (to be saved)
254
  if ( isset( $form_entry_fields[ $element_id ] ) ) {
255
  $meta_value = $form_entry_fields[ $element_id ]['value'];
256
  } elseif ( isset( $submitted_data[ $element_id ] ) ) {
257
- // fallback to submitted_data
258
  $meta_value = $submitted_data[ $element_id ];
259
  }
260
  forminator_addon_maybe_log( __METHOD__, $field_type, $meta_value );
@@ -268,24 +268,24 @@ class Forminator_Addon_Googlesheet_Form_Hooks extends Forminator_Addon_Form_Hook
268
  $values[] = $cell_data;
269
  }
270
 
271
- // Build the RowData
272
  $row_data = new Forminator_Google_Service_Sheets_RowData();
273
  $row_data->setValues( $values );
274
 
275
- // Prepare the request
276
  $append_request = new Forminator_Google_Service_Sheets_AppendCellsRequest();
277
  $append_request->setSheetId( 0 );
278
  $append_request->setRows( $row_data );
279
  $append_request->setFields( 'userEnteredValue' );
280
 
281
- // Set the request
282
  $request = new Forminator_Google_Service_Sheets_Request();
283
  $request->setAppendCells( $append_request );
284
- // Add the request to the requests array
285
  $requests = array();
286
  $requests[] = $request;
287
 
288
- // Prepare the update
289
  $batch_update_request = new Forminator_Google_Service_Sheets_BatchUpdateSpreadsheetRequest(
290
  array(
291
 
@@ -379,7 +379,7 @@ class Forminator_Addon_Googlesheet_Form_Hooks extends Forminator_Addon_Form_Hook
379
  if ( isset( $values[0] ) && is_array( $values[0] ) ) {
380
  foreach ( $values[0] as $value ) {
381
  $key_range = $sheet_title . '!' . self::column_number_to_letter( $column_number ) . '1';
382
- // forminator header field format = 'FIELD-label|field-id'
383
  $header_values = explode( '|', $value );
384
  $element_id = end( $header_values );
385
  $header_fields[ $element_id ] = array(
@@ -400,13 +400,13 @@ class Forminator_Addon_Googlesheet_Form_Hooks extends Forminator_Addon_Form_Hook
400
  //add
401
  $new_range = $sheet_title . '!' . self::column_number_to_letter( $column_number ) . '1';
402
 
403
- // update headers map
404
  $header_fields[ $element_id ] = array(
405
  'range' => $new_range,
406
  'value' => $expected_header_value,
407
  );
408
 
409
- // increment for next usage
410
  $column_number ++;
411
  $update_body = new Forminator_Google_Service_Sheets_ValueRange();
412
  $update_body->setRange( $new_range );
@@ -416,10 +416,10 @@ class Forminator_Addon_Googlesheet_Form_Hooks extends Forminator_Addon_Form_Hook
416
  } else {
417
  $header_field = $header_fields[ $element_id ];
418
  if ( $expected_header_value !== $header_field['value'] ) {
419
- // update headers map
420
  $header_fields[ $element_id ]['value'] = $expected_header_value;
421
 
422
- // update sheet
423
  $update_body = new Forminator_Google_Service_Sheets_ValueRange();
424
  $update_body->setRange( $header_field['range'] );
425
  $update_body->setValues( array( array( $expected_header_value ) ) );
@@ -507,8 +507,8 @@ class Forminator_Addon_Googlesheet_Form_Hooks extends Forminator_Addon_Form_Hook
507
  * @since 1.2
508
  *
509
  * @param array $addon_meta_data
510
- * @param int $form_id current Form ID
511
- * @param Forminator_Addon_Googlesheet_Form_Settings $form_settings_instance Google Sheets Addon Form Settings instance
512
  */
513
  $addon_meta_data = apply_filters(
514
  'forminator_addon_googlesheet_metadata',
@@ -593,7 +593,7 @@ class Forminator_Addon_Googlesheet_Form_Hooks extends Forminator_Addon_Form_Hook
593
 
594
  $additional_entry_item['sub_entries'] = $sub_entries;
595
 
596
- // return single array
597
  return $additional_entry_item;
598
  }
599
 
@@ -618,9 +618,9 @@ class Forminator_Addon_Googlesheet_Form_Hooks extends Forminator_Addon_Form_Hook
618
  *
619
  * @since 1.2
620
  *
621
- * @param array $export_headers headers to be displayed on export file
622
- * @param int $form_id current Form ID
623
- * @param Forminator_Addon_Googlesheet_Form_Settings $form_settings_instance Google Sheets Addon Form Settings instance
624
  */
625
  $export_headers = apply_filters(
626
  'forminator_addon_googlesheet_export_headers',
@@ -655,8 +655,8 @@ class Forminator_Addon_Googlesheet_Form_Hooks extends Forminator_Addon_Form_Hook
655
  * @since 1.2
656
  *
657
  * @param array $addon_meta_data
658
- * @param int $form_id current Form ID
659
- * @param Forminator_Addon_Googlesheet_Form_Settings $form_settings_instance Google Sheets Addon Form Settings instance
660
  */
661
  $addon_meta_data = apply_filters(
662
  'forminator_addon_googlesheet_metadata',
@@ -674,11 +674,11 @@ class Forminator_Addon_Googlesheet_Form_Hooks extends Forminator_Addon_Form_Hook
674
  *
675
  * @since 1.2
676
  *
677
- * @param array $export_columns column to be exported
678
- * @param int $form_id current Form ID
679
- * @param Forminator_Form_Entry_Model $entry_model Form Entry Model
680
- * @param array $addon_meta_data meta data saved by addon on entry fields
681
- * @param Forminator_Addon_Googlesheet_Form_Settings $form_settings_instance Google Sheets Addon Form Settings instance
682
  */
683
  $export_columns = apply_filters(
684
  'forminator_addon_googlesheet_export_columns',
@@ -711,15 +711,15 @@ class Forminator_Addon_Googlesheet_Form_Hooks extends Forminator_Addon_Form_Hook
711
 
712
  $addon_meta_data = $addon_meta_data[0];
713
 
714
- // make sure its `status`, because we only add this
715
  if ( 'status' !== $addon_meta_data['name'] ) {
716
  if ( stripos( $addon_meta_data['name'], 'status-' ) === 0 ) {
717
  $meta_data = array();
718
  foreach ( $addon_meta_datas as $addon_meta_data ) {
719
- // make it like single value so it will be processed like single meta data
720
  $addon_meta_data['name'] = 'status';
721
 
722
- // add it on an array for next recursive process
723
  $meta_data[] = $this->get_from_addon_meta_data( array( $addon_meta_data ), $key, $default );
724
  }
725
 
64
  *
65
  * @param array $submitted_data
66
  * @param array $form_entry_fields
67
+ * @param int $form_id current Form ID.
68
+ * @param Forminator_Addon_Googlesheet_Form_Settings $form_settings_instance Google Sheets Addon Form Settings instance.
69
  */
70
  $submitted_data = apply_filters(
71
  'forminator_addon_googlesheet_form_submitted_data',
82
  *
83
  * @param array $form_entry_fields
84
  * @param array $submitted_data
85
+ * @param int $form_id current Form ID.
86
+ * @param Forminator_Addon_Googlesheet_Form_Settings $form_settings_instance Google Sheets Addon Form Settings instance.
87
  */
88
  $form_entry_fields = apply_filters(
89
  'forminator_addon_googlesheet_form_entry_fields',
104
  *
105
  * @since 1.2
106
  *
107
+ * @param int $form_id current Form ID.
108
  * @param array $submitted_data
109
+ * @param Forminator_Addon_Googlesheet_Form_Settings $form_settings_instance Google Sheets Addon Form Settings instance.
110
  */
111
  do_action( 'forminator_addon_googlesheet_before_create_row', $form_id, $submitted_data, $form_settings_instance );
112
 
113
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
114
+ // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to Google Sheets.
115
  if ( $form_settings_instance->is_multi_form_settings_complete( $key ) ) {
116
+ // exec only on completed connection.
117
  $data[] = array(
118
  'name' => 'status-' . $key,
119
  'value' => $this->get_status_on_create_row( $key, $submitted_data, $addon_setting_value, $form_entry_fields ),
128
  * @since 1.2
129
  *
130
  * @param array $entry_fields
131
+ * @param int $form_id current Form ID.
132
  * @param array $submitted_data
133
  * @param array $form_entry_fields
134
+ * @param Forminator_Addon_Googlesheet_Form_Settings $form_settings_instance Google Sheets Addon Form Settings instance.
135
  */
136
  $data = apply_filters(
137
  'forminator_addon_googlesheet_entry_fields',
159
  * @return array `is_sent` true means its success send data to Google Sheets, false otherwise
160
  */
161
  public function get_status_on_create_row( $connection_id, $submitted_data, $connection_settings, $form_entry_fields ) {
162
+ // initialize as null.
163
  $api = null;
164
 
165
  $form_id = $this->form_id;
172
  * @since 1.2
173
  *
174
  * @param array $connection_settings
175
+ * @param int $form_id current Form ID.
176
  * @param array $submitted_data
177
  * @param array $form_entry_fields
178
+ * @param Forminator_Addon_Googlesheet_Form_Settings $form_settings_instance Google Sheets Addon Form Settings instance.
179
  */
180
  do_action( 'forminator_addon_googlesheet_before_prepare_sheet_headers', $connection_settings, $form_id, $submitted_data, $form_entry_fields, $form_settings_instance );
181
 
182
+ // prepare headers.
183
  $header_fields = $this->get_sheet_headers( $connection_settings['file_id'] );
184
 
185
  /**
187
  *
188
  * @since 1.2
189
  *
190
+ * @param array $header_fields sheet headers.
191
  * @param array $connection_settings
192
+ * @param int $form_id current Form ID.
193
  * @param array $submitted_data
194
  * @param array $form_entry_fields
195
+ * @param Forminator_Addon_Googlesheet_Form_Settings $form_settings_instance Google Sheets Addon Form Settings instance.
196
  */
197
  $header_fields = apply_filters(
198
  'forminator_addon_googlesheet_sheet_headers',
209
  *
210
  * @since 1.2
211
  *
212
+ * @param array $header_fields sheet headers.
213
  * @param array $connection_settings
214
+ * @param int $form_id current Form ID.
215
  * @param array $submitted_data
216
  * @param array $form_entry_fields
217
+ * @param Forminator_Addon_Googlesheet_Form_Settings $form_settings_instance Google Sheets Addon Form Settings instance.
218
  */
219
  do_action( 'forminator_addon_googlesheet_after_prepare_sheet_headers', $header_fields, $connection_settings, $form_id, $submitted_data, $form_entry_fields, $form_settings_instance );
220
 
229
  }
230
  $form_entry_fields = $keyed_form_entry_fields;
231
 
232
+ // all avail fields on library.
233
  $fields = forminator_fields_to_array();
234
  $field_types = array_keys( $fields );
235
 
236
+ // sort by length, so stripos will work by traverse from longest field type first.
237
  $field_types_strlen = array_map( 'strlen', $field_types );
238
  array_multisort( $field_types_strlen, $field_types );
239
  $field_types = array_reverse( $field_types );
250
  }
251
 
252
  $meta_value = array();
253
+ // take from entry fields (to be saved).
254
  if ( isset( $form_entry_fields[ $element_id ] ) ) {
255
  $meta_value = $form_entry_fields[ $element_id ]['value'];
256
  } elseif ( isset( $submitted_data[ $element_id ] ) ) {
257
+ // fallback to submitted_data.
258
  $meta_value = $submitted_data[ $element_id ];
259
  }
260
  forminator_addon_maybe_log( __METHOD__, $field_type, $meta_value );
268
  $values[] = $cell_data;
269
  }
270
 
271
+ // Build the RowData.
272
  $row_data = new Forminator_Google_Service_Sheets_RowData();
273
  $row_data->setValues( $values );
274
 
275
+ // Prepare the request.
276
  $append_request = new Forminator_Google_Service_Sheets_AppendCellsRequest();
277
  $append_request->setSheetId( 0 );
278
  $append_request->setRows( $row_data );
279
  $append_request->setFields( 'userEnteredValue' );
280
 
281
+ // Set the request.
282
  $request = new Forminator_Google_Service_Sheets_Request();
283
  $request->setAppendCells( $append_request );
284
+ // Add the request to the requests array.
285
  $requests = array();
286
  $requests[] = $request;
287
 
288
+ // Prepare the update.
289
  $batch_update_request = new Forminator_Google_Service_Sheets_BatchUpdateSpreadsheetRequest(
290
  array(
291
 
379
  if ( isset( $values[0] ) && is_array( $values[0] ) ) {
380
  foreach ( $values[0] as $value ) {
381
  $key_range = $sheet_title . '!' . self::column_number_to_letter( $column_number ) . '1';
382
+ // forminator header field format = 'FIELD-label|field-id'.
383
  $header_values = explode( '|', $value );
384
  $element_id = end( $header_values );
385
  $header_fields[ $element_id ] = array(
400
  //add
401
  $new_range = $sheet_title . '!' . self::column_number_to_letter( $column_number ) . '1';
402
 
403
+ // update headers map.
404
  $header_fields[ $element_id ] = array(
405
  'range' => $new_range,
406
  'value' => $expected_header_value,
407
  );
408
 
409
+ // increment for next usage.
410
  $column_number ++;
411
  $update_body = new Forminator_Google_Service_Sheets_ValueRange();
412
  $update_body->setRange( $new_range );
416
  } else {
417
  $header_field = $header_fields[ $element_id ];
418
  if ( $expected_header_value !== $header_field['value'] ) {
419
+ // update headers map.
420
  $header_fields[ $element_id ]['value'] = $expected_header_value;
421
 
422
+ // update sheet.
423
  $update_body = new Forminator_Google_Service_Sheets_ValueRange();
424
  $update_body->setRange( $header_field['range'] );
425
  $update_body->setValues( array( array( $expected_header_value ) ) );
507
  * @since 1.2
508
  *
509
  * @param array $addon_meta_data
510
+ * @param int $form_id current Form ID.
511
+ * @param Forminator_Addon_Googlesheet_Form_Settings $form_settings_instance Google Sheets Addon Form Settings instance.
512
  */
513
  $addon_meta_data = apply_filters(
514
  'forminator_addon_googlesheet_metadata',
593
 
594
  $additional_entry_item['sub_entries'] = $sub_entries;
595
 
596
+ // return single array.
597
  return $additional_entry_item;
598
  }
599
 
618
  *
619
  * @since 1.2
620
  *
621
+ * @param array $export_headers headers to be displayed on export file.
622
+ * @param int $form_id current Form ID.
623
+ * @param Forminator_Addon_Googlesheet_Form_Settings $form_settings_instance Google Sheets Addon Form Settings instance.
624
  */
625
  $export_headers = apply_filters(
626
  'forminator_addon_googlesheet_export_headers',
655
  * @since 1.2
656
  *
657
  * @param array $addon_meta_data
658
+ * @param int $form_id current Form ID.
659
+ * @param Forminator_Addon_Googlesheet_Form_Settings $form_settings_instance Google Sheets Addon Form Settings instance.
660
  */
661
  $addon_meta_data = apply_filters(
662
  'forminator_addon_googlesheet_metadata',
674
  *
675
  * @since 1.2
676
  *
677
+ * @param array $export_columns column to be exported.
678
+ * @param int $form_id current Form ID.
679
+ * @param Forminator_Form_Entry_Model $entry_model Form Entry Model.
680
+ * @param array $addon_meta_data meta data saved by addon on entry fields.
681
+ * @param Forminator_Addon_Googlesheet_Form_Settings $form_settings_instance Google Sheets Addon Form Settings instance.
682
  */
683
  $export_columns = apply_filters(
684
  'forminator_addon_googlesheet_export_columns',
711
 
712
  $addon_meta_data = $addon_meta_data[0];
713
 
714
+ // make sure its `status`, because we only add this.
715
  if ( 'status' !== $addon_meta_data['name'] ) {
716
  if ( stripos( $addon_meta_data['name'], 'status-' ) === 0 ) {
717
  $meta_data = array();
718
  foreach ( $addon_meta_datas as $addon_meta_data ) {
719
+ // make it like single value so it will be processed like single meta data.
720
  $addon_meta_data['name'] = 'status';
721
 
722
+ // add it on an array for next recursive process.
723
  $meta_data[] = $this->get_from_addon_meta_data( array( $addon_meta_data ), $key, $default );
724
  }
725
 
addons/pro/googlesheet/class-forminator-addon-googlesheet-form-settings.php CHANGED
@@ -42,7 +42,7 @@ class Forminator_Addon_Googlesheet_Form_Settings extends Forminator_Addon_Form_S
42
  * @return array
43
  */
44
  public function form_settings_wizards() {
45
- // numerical array steps
46
  return array(
47
  array(
48
  'callback' => array( $this, 'pick_name' ),
@@ -210,13 +210,13 @@ class Forminator_Addon_Googlesheet_Form_Settings extends Forminator_Addon_Form_S
210
  try {
211
  $folder = $drive->files->get( $folder_id );
212
 
213
- // its from API var
214
  // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
215
  if ( Forminator_Addon_Googlesheet::MIME_TYPE_GOOGLE_DRIVE_FOLDER !== $folder->mimeType ) {
216
  $input_exceptions->add_input_exception( __( 'This is not a folder, please use a valid Folder ID.', 'forminator' ), 'folder_id_error' );
217
  }
218
  } catch ( Forminator_Google_Exception $google_exception ) {
219
- // catch 404
220
  if ( false !== stripos( $google_exception->getMessage(), 'File not found' ) ) {
221
  $input_exceptions->add_input_exception( __( 'Folder not found, please put Folder ID.', 'forminator' ), 'folder_id_error' );
222
  } else {
@@ -349,7 +349,7 @@ class Forminator_Addon_Googlesheet_Form_Settings extends Forminator_Addon_Form_S
349
  foreach ( $this->get_form_settings_values() as $key => $value ) {
350
  $multi_ids[] = array(
351
  'id' => $key,
352
- // use name that was added by user on creating connection
353
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
354
  );
355
  }
@@ -365,7 +365,7 @@ class Forminator_Addon_Googlesheet_Form_Settings extends Forminator_Addon_Form_S
365
  * @param array $submitted_data
366
  */
367
  public function disconnect_form( $submitted_data ) {
368
- // only execute if multi_id provided on submitted data
369
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
370
  $addon_form_settings = $this->get_form_settings_values();
371
  unset( $addon_form_settings[ $submitted_data['multi_id'] ] );
42
  * @return array
43
  */
44
  public function form_settings_wizards() {
45
+ // numerical array steps.
46
  return array(
47
  array(
48
  'callback' => array( $this, 'pick_name' ),
210
  try {
211
  $folder = $drive->files->get( $folder_id );
212
 
213
+ // its from API var.
214
  // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
215
  if ( Forminator_Addon_Googlesheet::MIME_TYPE_GOOGLE_DRIVE_FOLDER !== $folder->mimeType ) {
216
  $input_exceptions->add_input_exception( __( 'This is not a folder, please use a valid Folder ID.', 'forminator' ), 'folder_id_error' );
217
  }
218
  } catch ( Forminator_Google_Exception $google_exception ) {
219
+ // catch 404.
220
  if ( false !== stripos( $google_exception->getMessage(), 'File not found' ) ) {
221
  $input_exceptions->add_input_exception( __( 'Folder not found, please put Folder ID.', 'forminator' ), 'folder_id_error' );
222
  } else {
349
  foreach ( $this->get_form_settings_values() as $key => $value ) {
350
  $multi_ids[] = array(
351
  'id' => $key,
352
+ // use name that was added by user on creating connection.
353
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
354
  );
355
  }
365
  * @param array $submitted_data
366
  */
367
  public function disconnect_form( $submitted_data ) {
368
+ // only execute if multi_id provided on submitted data.
369
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
370
  $addon_form_settings = $this->get_form_settings_values();
371
  unset( $addon_form_settings[ $submitted_data['multi_id'] ] );
addons/pro/googlesheet/class-forminator-addon-googlesheet-poll-hooks.php CHANGED
@@ -69,8 +69,8 @@ class Forminator_Addon_Googlesheet_Poll_Hooks extends Forminator_Addon_Poll_Hook
69
  *
70
  * @param array $submitted_data
71
  * @param array $current_entry_fields
72
- * @param int $poll_id current Poll ID
73
- * @param Forminator_Addon_Googlesheet_Poll_Settings $poll_settings_instance Google Sheets Addon poll Settings instance
74
  */
75
  $submitted_data = apply_filters(
76
  'forminator_addon_googlesheet_poll_submitted_data',
@@ -87,8 +87,8 @@ class Forminator_Addon_Googlesheet_Poll_Hooks extends Forminator_Addon_Poll_Hook
87
  *
88
  * @param array $current_entry_fields
89
  * @param array $submitted_data
90
- * @param int $poll_id current Poll ID
91
- * @param Forminator_Addon_Googlesheet_Poll_Settings $poll_settings_instance Google Sheets Addon Poll Settings instance
92
  */
93
  $current_entry_fields = apply_filters(
94
  'forminator_addon_googlesheet_poll_entry_fields',
@@ -109,16 +109,16 @@ class Forminator_Addon_Googlesheet_Poll_Hooks extends Forminator_Addon_Poll_Hook
109
  *
110
  * @since 1.6.1
111
  *
112
- * @param int $poll_id current Poll ID
113
  * @param array $submitted_data
114
- * @param Forminator_Addon_Googlesheet_Poll_Settings $poll_settings_instance Google Sheets Addon Poll Settings instance
115
  */
116
  do_action( 'forminator_addon_googlesheet_poll_before_create_row', $poll_id, $submitted_data, $poll_settings_instance );
117
 
118
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
119
- // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to Google Sheets
120
  if ( $poll_settings_instance->is_multi_poll_settings_complete( $key ) ) {
121
- // exec only on completed connection
122
  $data[] = array(
123
  'name' => 'status-' . $key,
124
  'value' => $this->get_status_on_create_row( $key, $submitted_data, $addon_setting_value, $current_entry_fields ),
@@ -133,10 +133,10 @@ class Forminator_Addon_Googlesheet_Poll_Hooks extends Forminator_Addon_Poll_Hook
133
  * @since 1.6.1
134
  *
135
  * @param array $entry_fields
136
- * @param int $poll_id current Poll ID
137
  * @param array $submitted_data
138
  * @param array $current_entry_fields
139
- * @param Forminator_Addon_Googlesheet_Poll_Settings $poll_settings_instance Google Sheets Addon Poll Settings instance
140
  */
141
  $data = apply_filters(
142
  'forminator_addon_poll_googlesheet_entry_fields',
@@ -163,7 +163,7 @@ class Forminator_Addon_Googlesheet_Poll_Hooks extends Forminator_Addon_Poll_Hook
163
  * @return array `is_sent` true means its success send data to Google Sheets, false otherwise
164
  */
165
  public function get_status_on_create_row( $connection_id, $submitted_data, $connection_settings, $poll_entry_fields ) {
166
- // initialize as null
167
  $api = null;
168
 
169
  $poll_id = $this->poll_id;
@@ -177,14 +177,14 @@ class Forminator_Addon_Googlesheet_Poll_Hooks extends Forminator_Addon_Poll_Hook
177
  * @since 1.6.1
178
  *
179
  * @param array $connection_settings
180
- * @param int $poll_id current Poll ID
181
  * @param array $submitted_data
182
  * @param array $poll_entry_fields
183
- * @param Forminator_Addon_Googlesheet_Poll_Settings $poll_settings_instance Google Sheets Addon Poll Settings instance
184
  */
185
  do_action( 'forminator_addon_poll_googlesheet_before_prepare_sheet_headers', $connection_settings, $poll_id, $submitted_data, $poll_entry_fields, $poll_settings_instance );
186
 
187
- // prepare headers
188
  $header_fields = $this->get_sheet_headers( $connection_settings['file_id'] );
189
 
190
  /**
@@ -192,12 +192,12 @@ class Forminator_Addon_Googlesheet_Poll_Hooks extends Forminator_Addon_Poll_Hook
192
  *
193
  * @since 1.6.1
194
  *
195
- * @param array $header_fields sheet headers
196
  * @param array $connection_settings
197
- * @param int $poll_id current Poll ID
198
  * @param array $submitted_data
199
  * @param array $poll_entry_fields
200
- * @param Forminator_Addon_Googlesheet_Poll_Settings $poll_settings_instance Google Sheets Addon Poll Settings instance
201
  */
202
  $header_fields = apply_filters(
203
  'forminator_addon_poll_googlesheet_sheet_headers',
@@ -214,12 +214,12 @@ class Forminator_Addon_Googlesheet_Poll_Hooks extends Forminator_Addon_Poll_Hook
214
  *
215
  * @since 1.6.1
216
  *
217
- * @param array $header_fields sheet headers
218
  * @param array $connection_settings
219
- * @param int $poll_id current Poll ID
220
  * @param array $submitted_data
221
  * @param array $poll_entry_fields
222
- * @param Forminator_Addon_Googlesheet_Poll_Settings $poll_settings_instance Google Sheets Addon Poll Settings instance
223
  */
224
  do_action( 'forminator_addon_poll_googlesheet_after_prepare_sheet_headers', $header_fields, $connection_settings, $poll_id, $submitted_data, $poll_entry_fields, $poll_settings_instance );
225
 
@@ -252,7 +252,7 @@ class Forminator_Addon_Googlesheet_Poll_Hooks extends Forminator_Addon_Poll_Hook
252
  $cell_data->setUserEnteredValue( $value );
253
  $values[] = $cell_data;
254
  } else {
255
- // unknown column, set empty
256
  $value = new Forminator_Google_Service_Sheets_ExtendedValue();
257
  $cell_data = new Forminator_Google_Service_Sheets_CellData();
258
  $value->setStringValue( '' );
@@ -261,24 +261,24 @@ class Forminator_Addon_Googlesheet_Poll_Hooks extends Forminator_Addon_Poll_Hook
261
  }
262
  }
263
 
264
- // Build the RowData
265
  $row_data = new Forminator_Google_Service_Sheets_RowData();
266
  $row_data->setValues( $values );
267
 
268
- // Prepare the request
269
  $append_request = new Forminator_Google_Service_Sheets_AppendCellsRequest();
270
  $append_request->setSheetId( 0 );
271
  $append_request->setRows( $row_data );
272
  $append_request->setFields( 'userEnteredValue' );
273
 
274
- // Set the request
275
  $request = new Forminator_Google_Service_Sheets_Request();
276
  $request->setAppendCells( $append_request );
277
- // Add the request to the requests array
278
  $requests = array();
279
  $requests[] = $request;
280
 
281
- // Prepare the update
282
  $batch_update_request = new Forminator_Google_Service_Sheets_BatchUpdateSpreadsheetRequest(
283
  array(
284
  'requests' => $requests,
@@ -381,7 +381,7 @@ class Forminator_Addon_Googlesheet_Poll_Hooks extends Forminator_Addon_Poll_Hook
381
  if ( isset( $values[0] ) && is_array( $values[0] ) ) {
382
  foreach ( $values[0] as $value ) {
383
  $key_range = $sheet_title . '!' . Forminator_Addon_Googlesheet_Form_Hooks::column_number_to_letter( $column_number ) . '1';
384
- // forminator poll header format = 'Answer,Extra'
385
  $header_fields[ $value ] = array(
386
  'range' => $key_range,
387
  'value' => $value,
@@ -391,7 +391,7 @@ class Forminator_Addon_Googlesheet_Poll_Hooks extends Forminator_Addon_Poll_Hook
391
  }
392
  }
393
 
394
- // dont use translation because it will be used as reference
395
  $required_header_columns = array( self::GSHEET_ANSWER_COLUMN_NAME, self::GSHEET_EXTRA_COLUMN_NAME );
396
 
397
  $new_column_count = 0;
@@ -402,13 +402,13 @@ class Forminator_Addon_Googlesheet_Poll_Hooks extends Forminator_Addon_Poll_Hook
402
  //add
403
  $new_range = $sheet_title . '!' . Forminator_Addon_Googlesheet_Form_Hooks::column_number_to_letter( $column_number ) . '1';
404
 
405
- // update headers map
406
  $header_fields[ $required_header_column ] = array(
407
  'range' => $new_range,
408
  'value' => $expected_header_value,
409
  );
410
 
411
- // increment for next usage
412
  $column_number ++;
413
  $update_body = new Forminator_Google_Service_Sheets_ValueRange();
414
  $update_body->setRange( $new_range );
@@ -418,10 +418,10 @@ class Forminator_Addon_Googlesheet_Poll_Hooks extends Forminator_Addon_Poll_Hook
418
  } else {
419
  $header_field = $header_fields[ $required_header_column ];
420
  if ( $expected_header_value !== $header_field['value'] ) {
421
- // update headers map
422
  $header_fields[ $required_header_column ]['value'] = $expected_header_value;
423
 
424
- // update sheet
425
  $update_body = new Forminator_Google_Service_Sheets_ValueRange();
426
  $update_body->setRange( $header_field['range'] );
427
  $update_body->setValues( array( array( $expected_header_value ) ) );
@@ -507,9 +507,9 @@ class Forminator_Addon_Googlesheet_Poll_Hooks extends Forminator_Addon_Poll_Hook
507
  *
508
  * @since 1.6.1
509
  *
510
- * @param array $export_headers headers to be displayed on export file
511
- * @param int $poll_id current Poll ID
512
- * @param Forminator_Addon_Googlesheet_Poll_Settings $poll_settings_instance Google Sheets Addon Poll Settings instance
513
  */
514
  $export_headers = apply_filters(
515
  'forminator_addon_poll_googlesheet_export_headers',
@@ -544,8 +544,8 @@ class Forminator_Addon_Googlesheet_Poll_Hooks extends Forminator_Addon_Poll_Hook
544
  * @since 1.6.1
545
  *
546
  * @param array $addon_meta_data
547
- * @param int $poll_id current Poll ID
548
- * @param Forminator_Addon_Googlesheet_Poll_Settings $poll_settings_instance Google Sheets Addon Form Settings instance
549
  */
550
  $addon_meta_data = apply_filters(
551
  'forminator_addon_poll_googlesheet_metadata',
@@ -563,11 +563,11 @@ class Forminator_Addon_Googlesheet_Poll_Hooks extends Forminator_Addon_Poll_Hook
563
  *
564
  * @since 1.2
565
  *
566
- * @param array $export_columns column to be exported
567
- * @param int $poll_id current Poll ID
568
- * @param Forminator_Form_Entry_Model $entry_model Form Entry Model
569
- * @param array $addon_meta_data meta data saved by addon on entry fields
570
- * @param Forminator_Addon_Googlesheet_Poll_Settings $poll_settings_instance Google Sheets Addon Poll Settings instance
571
  */
572
  $export_columns = apply_filters(
573
  'forminator_addon_poll_googlesheet_export_columns',
69
  *
70
  * @param array $submitted_data
71
  * @param array $current_entry_fields
72
+ * @param int $poll_id current Poll ID.
73
+ * @param Forminator_Addon_Googlesheet_Poll_Settings $poll_settings_instance Google Sheets Addon poll Settings instance.
74
  */
75
  $submitted_data = apply_filters(
76
  'forminator_addon_googlesheet_poll_submitted_data',
87
  *
88
  * @param array $current_entry_fields
89
  * @param array $submitted_data
90
+ * @param int $poll_id current Poll ID.
91
+ * @param Forminator_Addon_Googlesheet_Poll_Settings $poll_settings_instance Google Sheets Addon Poll Settings instance.
92
  */
93
  $current_entry_fields = apply_filters(
94
  'forminator_addon_googlesheet_poll_entry_fields',
109
  *
110
  * @since 1.6.1
111
  *
112
+ * @param int $poll_id current Poll ID.
113
  * @param array $submitted_data
114
+ * @param Forminator_Addon_Googlesheet_Poll_Settings $poll_settings_instance Google Sheets Addon Poll Settings instance.
115
  */
116
  do_action( 'forminator_addon_googlesheet_poll_before_create_row', $poll_id, $submitted_data, $poll_settings_instance );
117
 
118
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
119
+ // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to Google Sheets.
120
  if ( $poll_settings_instance->is_multi_poll_settings_complete( $key ) ) {
121
+ // exec only on completed connection.
122
  $data[] = array(
123
  'name' => 'status-' . $key,
124
  'value' => $this->get_status_on_create_row( $key, $submitted_data, $addon_setting_value, $current_entry_fields ),
133
  * @since 1.6.1
134
  *
135
  * @param array $entry_fields
136
+ * @param int $poll_id current Poll ID.
137
  * @param array $submitted_data
138
  * @param array $current_entry_fields
139
+ * @param Forminator_Addon_Googlesheet_Poll_Settings $poll_settings_instance Google Sheets Addon Poll Settings instance.
140
  */
141
  $data = apply_filters(
142
  'forminator_addon_poll_googlesheet_entry_fields',
163
  * @return array `is_sent` true means its success send data to Google Sheets, false otherwise
164
  */
165
  public function get_status_on_create_row( $connection_id, $submitted_data, $connection_settings, $poll_entry_fields ) {
166
+ // initialize as null.
167
  $api = null;
168
 
169
  $poll_id = $this->poll_id;
177
  * @since 1.6.1
178
  *
179
  * @param array $connection_settings
180
+ * @param int $poll_id current Poll ID.
181
  * @param array $submitted_data
182
  * @param array $poll_entry_fields
183
+ * @param Forminator_Addon_Googlesheet_Poll_Settings $poll_settings_instance Google Sheets Addon Poll Settings instance.
184
  */
185
  do_action( 'forminator_addon_poll_googlesheet_before_prepare_sheet_headers', $connection_settings, $poll_id, $submitted_data, $poll_entry_fields, $poll_settings_instance );
186
 
187
+ // prepare headers.
188
  $header_fields = $this->get_sheet_headers( $connection_settings['file_id'] );
189
 
190
  /**
192
  *
193
  * @since 1.6.1
194
  *
195
+ * @param array $header_fields sheet headers.
196
  * @param array $connection_settings
197
+ * @param int $poll_id current Poll ID.
198
  * @param array $submitted_data
199
  * @param array $poll_entry_fields
200
+ * @param Forminator_Addon_Googlesheet_Poll_Settings $poll_settings_instance Google Sheets Addon Poll Settings instance.
201
  */
202
  $header_fields = apply_filters(
203
  'forminator_addon_poll_googlesheet_sheet_headers',
214
  *
215
  * @since 1.6.1
216
  *
217
+ * @param array $header_fields sheet headers.
218
  * @param array $connection_settings
219
+ * @param int $poll_id current Poll ID.
220
  * @param array $submitted_data
221
  * @param array $poll_entry_fields
222
+ * @param Forminator_Addon_Googlesheet_Poll_Settings $poll_settings_instance Google Sheets Addon Poll Settings instance.
223
  */
224
  do_action( 'forminator_addon_poll_googlesheet_after_prepare_sheet_headers', $header_fields, $connection_settings, $poll_id, $submitted_data, $poll_entry_fields, $poll_settings_instance );
225
 
252
  $cell_data->setUserEnteredValue( $value );
253
  $values[] = $cell_data;
254
  } else {
255
+ // unknown column, set empty.
256
  $value = new Forminator_Google_Service_Sheets_ExtendedValue();
257
  $cell_data = new Forminator_Google_Service_Sheets_CellData();
258
  $value->setStringValue( '' );
261
  }
262
  }
263
 
264
+ // Build the RowData.
265
  $row_data = new Forminator_Google_Service_Sheets_RowData();
266
  $row_data->setValues( $values );
267
 
268
+ // Prepare the request.
269
  $append_request = new Forminator_Google_Service_Sheets_AppendCellsRequest();
270
  $append_request->setSheetId( 0 );
271
  $append_request->setRows( $row_data );
272
  $append_request->setFields( 'userEnteredValue' );
273
 
274
+ // Set the request.
275
  $request = new Forminator_Google_Service_Sheets_Request();
276
  $request->setAppendCells( $append_request );
277
+ // Add the request to the requests array.
278
  $requests = array();
279
  $requests[] = $request;
280
 
281
+ // Prepare the update.
282
  $batch_update_request = new Forminator_Google_Service_Sheets_BatchUpdateSpreadsheetRequest(
283
  array(
284
  'requests' => $requests,
381
  if ( isset( $values[0] ) && is_array( $values[0] ) ) {
382
  foreach ( $values[0] as $value ) {
383
  $key_range = $sheet_title . '!' . Forminator_Addon_Googlesheet_Form_Hooks::column_number_to_letter( $column_number ) . '1';
384
+ // forminator poll header format = 'Answer,Extra'.
385
  $header_fields[ $value ] = array(
386
  'range' => $key_range,
387
  'value' => $value,
391
  }
392
  }
393
 
394
+ // dont use translation because it will be used as reference.
395
  $required_header_columns = array( self::GSHEET_ANSWER_COLUMN_NAME, self::GSHEET_EXTRA_COLUMN_NAME );
396
 
397
  $new_column_count = 0;
402
  //add
403
  $new_range = $sheet_title . '!' . Forminator_Addon_Googlesheet_Form_Hooks::column_number_to_letter( $column_number ) . '1';
404
 
405
+ // update headers map.
406
  $header_fields[ $required_header_column ] = array(
407
  'range' => $new_range,
408
  'value' => $expected_header_value,
409
  );
410
 
411
+ // increment for next usage.
412
  $column_number ++;
413
  $update_body = new Forminator_Google_Service_Sheets_ValueRange();
414
  $update_body->setRange( $new_range );
418
  } else {
419
  $header_field = $header_fields[ $required_header_column ];
420
  if ( $expected_header_value !== $header_field['value'] ) {
421
+ // update headers map.
422
  $header_fields[ $required_header_column ]['value'] = $expected_header_value;
423
 
424
+ // update sheet.
425
  $update_body = new Forminator_Google_Service_Sheets_ValueRange();
426
  $update_body->setRange( $header_field['range'] );
427
  $update_body->setValues( array( array( $expected_header_value ) ) );
507
  *
508
  * @since 1.6.1
509
  *
510
+ * @param array $export_headers headers to be displayed on export file.
511
+ * @param int $poll_id current Poll ID.
512
+ * @param Forminator_Addon_Googlesheet_Poll_Settings $poll_settings_instance Google Sheets Addon Poll Settings instance.
513
  */
514
  $export_headers = apply_filters(
515
  'forminator_addon_poll_googlesheet_export_headers',
544
  * @since 1.6.1
545
  *
546
  * @param array $addon_meta_data
547
+ * @param int $poll_id current Poll ID.
548
+ * @param Forminator_Addon_Googlesheet_Poll_Settings $poll_settings_instance Google Sheets Addon Form Settings instance.
549
  */
550
  $addon_meta_data = apply_filters(
551
  'forminator_addon_poll_googlesheet_metadata',
563
  *
564
  * @since 1.2
565
  *
566
+ * @param array $export_columns column to be exported.
567
+ * @param int $poll_id current Poll ID.
568
+ * @param Forminator_Form_Entry_Model $entry_model Form Entry Model.
569
+ * @param array $addon_meta_data meta data saved by addon on entry fields.
570
+ * @param Forminator_Addon_Googlesheet_Poll_Settings $poll_settings_instance Google Sheets Addon Poll Settings instance.
571
  */
572
  $export_columns = apply_filters(
573
  'forminator_addon_poll_googlesheet_export_columns',
addons/pro/googlesheet/class-forminator-addon-googlesheet-poll-settings.php CHANGED
@@ -42,7 +42,7 @@ class Forminator_Addon_Googlesheet_Poll_Settings extends Forminator_Addon_Poll_S
42
  * @return array
43
  */
44
  public function poll_settings_wizards() {
45
- // numerical array steps
46
  return array(
47
  array(
48
  'callback' => array( $this, 'pick_name' ),
@@ -182,13 +182,13 @@ class Forminator_Addon_Googlesheet_Poll_Settings extends Forminator_Addon_Poll_S
182
  try {
183
  $folder = $drive->files->get( $folder_id );
184
 
185
- // its from API var
186
  // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
187
  if ( Forminator_Addon_Googlesheet::MIME_TYPE_GOOGLE_DRIVE_FOLDER !== $folder->mimeType ) {
188
  $input_exceptions->add_input_exception( __( 'This is not a folder, please use a valid Folder ID.', 'forminator' ), 'folder_id_error' );
189
  }
190
  } catch ( Forminator_Google_Exception $google_exception ) {
191
- // catch 404
192
  if ( false !== stripos( $google_exception->getMessage(), 'File not found' ) ) {
193
  $input_exceptions->add_input_exception( __( 'Folder not found, please put Folder ID.', 'forminator' ), 'folder_id_error' );
194
  } else {
@@ -349,7 +349,7 @@ class Forminator_Addon_Googlesheet_Poll_Settings extends Forminator_Addon_Poll_S
349
  foreach ( $this->get_poll_settings_values() as $key => $value ) {
350
  $multi_ids[] = array(
351
  'id' => $key,
352
- // use name that was added by user on creating connection
353
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
354
  );
355
  }
@@ -365,7 +365,7 @@ class Forminator_Addon_Googlesheet_Poll_Settings extends Forminator_Addon_Poll_S
365
  * @param array $submitted_data
366
  */
367
  public function disconnect_poll( $submitted_data ) {
368
- // only execute if multi_id provided on submitted data
369
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
370
  $addon_poll_settings = $this->get_poll_settings_values();
371
  unset( $addon_poll_settings[ $submitted_data['multi_id'] ] );
42
  * @return array
43
  */
44
  public function poll_settings_wizards() {
45
+ // numerical array steps.
46
  return array(
47
  array(
48
  'callback' => array( $this, 'pick_name' ),
182
  try {
183
  $folder = $drive->files->get( $folder_id );
184
 
185
+ // its from API var.
186
  // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
187
  if ( Forminator_Addon_Googlesheet::MIME_TYPE_GOOGLE_DRIVE_FOLDER !== $folder->mimeType ) {
188
  $input_exceptions->add_input_exception( __( 'This is not a folder, please use a valid Folder ID.', 'forminator' ), 'folder_id_error' );
189
  }
190
  } catch ( Forminator_Google_Exception $google_exception ) {
191
+ // catch 404.
192
  if ( false !== stripos( $google_exception->getMessage(), 'File not found' ) ) {
193
  $input_exceptions->add_input_exception( __( 'Folder not found, please put Folder ID.', 'forminator' ), 'folder_id_error' );
194
  } else {
349
  foreach ( $this->get_poll_settings_values() as $key => $value ) {
350
  $multi_ids[] = array(
351
  'id' => $key,
352
+ // use name that was added by user on creating connection.
353
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
354
  );
355
  }
365
  * @param array $submitted_data
366
  */
367
  public function disconnect_poll( $submitted_data ) {
368
+ // only execute if multi_id provided on submitted data.
369
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
370
  $addon_poll_settings = $this->get_poll_settings_values();
371
  unset( $addon_poll_settings[ $submitted_data['multi_id'] ] );
addons/pro/googlesheet/class-forminator-addon-googlesheet-quiz-hooks.php CHANGED
@@ -71,8 +71,8 @@ class Forminator_Addon_Googlesheet_Quiz_Hooks extends Forminator_Addon_Quiz_Hook
71
  *
72
  * @param array $submitted_data
73
  * @param array $current_entry_fields
74
- * @param int $quiz_id current quiz ID
75
- * @param Forminator_Addon_Googlesheet_Quiz_Settings $quiz_settings_instance Google Sheets Addon quiz Settings instance
76
  */
77
  $submitted_data = apply_filters(
78
  'forminator_addon_googlesheet_quiz_submitted_data',
@@ -89,8 +89,8 @@ class Forminator_Addon_Googlesheet_Quiz_Hooks extends Forminator_Addon_Quiz_Hook
89
  *
90
  * @param array $current_entry_fields
91
  * @param array $submitted_data
92
- * @param int $quiz_id current Quiz ID
93
- * @param Forminator_Addon_Googlesheet_Quiz_Settings $quiz_settings_instance Google Sheets Addon Quiz Settings instance
94
  */
95
  $current_entry_fields = apply_filters(
96
  'forminator_addon_googlesheet_quiz_entry_fields',
@@ -111,16 +111,16 @@ class Forminator_Addon_Googlesheet_Quiz_Hooks extends Forminator_Addon_Quiz_Hook
111
  *
112
  * @since 1.6.2
113
  *
114
- * @param int $quiz_id current Quiz ID
115
  * @param array $submitted_data
116
- * @param Forminator_Addon_Googlesheet_Quiz_Settings $quiz_settings_instance Google Sheets Addon Quiz Settings instance
117
  */
118
  do_action( 'forminator_addon_googlesheet_quiz_before_create_row', $quiz_id, $submitted_data, $quiz_settings_instance );
119
 
120
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
121
- // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to Google Sheets
122
  if ( $quiz_settings_instance->is_multi_quiz_settings_complete( $key ) ) {
123
- // exec only on completed connection
124
  $data[] = array(
125
  'name' => 'status-' . $key,
126
  'value' => $this->get_status_on_create_row( $key, $submitted_data, $addon_setting_value, $current_entry_fields ),
@@ -135,10 +135,10 @@ class Forminator_Addon_Googlesheet_Quiz_Hooks extends Forminator_Addon_Quiz_Hook
135
  * @since 1.6.2
136
  *
137
  * @param array $entry_fields
138
- * @param int $quiz_id current Quiz ID
139
  * @param array $submitted_data
140
  * @param array $current_entry_fields
141
- * @param Forminator_Addon_Googlesheet_Quiz_Settings $quiz_settings_instance Google Sheets Addon Quiz Settings instance
142
  */
143
  $data = apply_filters(
144
  'forminator_addon_quiz_googlesheet_entry_fields',
@@ -165,7 +165,7 @@ class Forminator_Addon_Googlesheet_Quiz_Hooks extends Forminator_Addon_Quiz_Hook
165
  * @return array `is_sent` true means its success send data to Google Sheets, false otherwise
166
  */
167
  public function get_status_on_create_row( $connection_id, $submitted_data, $connection_settings, $quiz_entry_fields ) {
168
- // initialize as null
169
  $api = null;
170
 
171
  $quiz_id = $this->quiz_id;
@@ -181,14 +181,14 @@ class Forminator_Addon_Googlesheet_Quiz_Hooks extends Forminator_Addon_Quiz_Hook
181
  * @since 1.6.2
182
  *
183
  * @param array $connection_settings
184
- * @param int $quiz_id current Quiz ID
185
  * @param array $submitted_data
186
  * @param array $quiz_entry_fields
187
- * @param Forminator_Addon_Googlesheet_Quiz_Settings $quiz_settings_instance Google Sheets Addon Quiz Settings instance
188
  */
189
  do_action( 'forminator_addon_quiz_googlesheet_before_prepare_sheet_headers', $connection_settings, $quiz_id, $submitted_data, $quiz_entry_fields, $quiz_settings_instance );
190
 
191
- // prepare headers
192
  $header_fields = $this->get_sheet_headers( $connection_settings['file_id'], $quiz_settings );
193
 
194
  /**
@@ -196,12 +196,12 @@ class Forminator_Addon_Googlesheet_Quiz_Hooks extends Forminator_Addon_Quiz_Hook
196
  *
197
  * @since 1.6.2
198
  *
199
- * @param array $header_fields sheet headers
200
  * @param array $connection_settings
201
- * @param int $quiz_id current Quiz ID
202
  * @param array $submitted_data
203
  * @param array $quiz_entry_fields
204
- * @param Forminator_Addon_Googlesheet_Quiz_Settings $quiz_settings_instance Google Sheets Addon Quiz Settings instance
205
  */
206
  $header_fields = apply_filters(
207
  'forminator_addon_quiz_googlesheet_sheet_headers',
@@ -218,12 +218,12 @@ class Forminator_Addon_Googlesheet_Quiz_Hooks extends Forminator_Addon_Quiz_Hook
218
  *
219
  * @since 1.6.2
220
  *
221
- * @param array $header_fields sheet headers
222
  * @param array $connection_settings
223
- * @param int $quiz_id current Quiz ID
224
  * @param array $submitted_data
225
  * @param array $quiz_entry_fields
226
- * @param Forminator_Addon_Googlesheet_Quiz_Settings $quiz_settings_instance Google Sheets Addon Quiz Settings instance
227
  */
228
  do_action( 'forminator_addon_quiz_googlesheet_after_prepare_sheet_headers', $header_fields, $connection_settings, $quiz_id, $submitted_data, $quiz_entry_fields, $quiz_settings_instance );
229
 
@@ -234,7 +234,7 @@ class Forminator_Addon_Googlesheet_Quiz_Hooks extends Forminator_Addon_Quiz_Hook
234
  if ( isset( $quiz_entry['name'] ) && isset( $quiz_entry['value'] ) && 'entry' === $quiz_entry['name'] ) {
235
  if ( is_array( $quiz_entry['value'] ) ) {
236
 
237
- // KNOWLEDGE
238
  if ( 'knowledge' === $this->quiz->quiz_type ) {
239
  foreach ( $quiz_entry['value'] as $data ) {
240
  $question = isset( $data['question'] ) ? $data['question'] : '';
@@ -277,11 +277,11 @@ class Forminator_Addon_Googlesheet_Quiz_Hooks extends Forminator_Addon_Quiz_Hook
277
 
278
  $form_entry_fields = get_addons_lead_form_entry_data( $quiz_settings, $submitted_data, $addons_fields );
279
 
280
- // all avail fields on library
281
  $fields = forminator_fields_to_array();
282
  $field_types = array_keys( $fields );
283
 
284
- // sort by length, so stripos will work by traverse from longest field type first
285
  $field_types_strlen = array_map( 'strlen', $field_types );
286
  array_multisort( $field_types_strlen, $field_types );
287
  $field_types = array_reverse( $field_types );
@@ -296,7 +296,7 @@ class Forminator_Addon_Googlesheet_Quiz_Hooks extends Forminator_Addon_Quiz_Hook
296
  $value = new Forminator_Google_Service_Sheets_ExtendedValue();
297
  $cell_data = new Forminator_Google_Service_Sheets_CellData();
298
 
299
- // only once
300
  $date_value = 0 === $i ? $date : '';
301
  $value->setStringValue( $date_value );
302
  $cell_data->setUserEnteredValue( $value );
@@ -317,7 +317,7 @@ class Forminator_Addon_Googlesheet_Quiz_Hooks extends Forminator_Addon_Quiz_Hook
317
  $value = new Forminator_Google_Service_Sheets_ExtendedValue();
318
  $cell_data = new Forminator_Google_Service_Sheets_CellData();
319
 
320
- // only once for nowrong
321
  $result_value = $answer['result'];
322
  if ( 'nowrong' === $this->quiz->quiz_type ) {
323
  $result_value = 0 === $i ? $result_value : '';
@@ -338,7 +338,7 @@ class Forminator_Addon_Googlesheet_Quiz_Hooks extends Forminator_Addon_Quiz_Hook
338
  }
339
 
340
  $meta_value = array();
341
- // take from entry fields (to be saved)
342
  if ( isset( $form_entry_fields[ $form_column_name ] ) ) {
343
  $meta_value = $form_entry_fields[ $form_column_name ];
344
  }
@@ -352,7 +352,7 @@ class Forminator_Addon_Googlesheet_Quiz_Hooks extends Forminator_Addon_Quiz_Hook
352
  $cell_data->setUserEnteredValue( $value );
353
  $values[] = $cell_data;
354
  } else {
355
- // unknown column, set empty
356
  $value = new Forminator_Google_Service_Sheets_ExtendedValue();
357
  $cell_data = new Forminator_Google_Service_Sheets_CellData();
358
  $value->setStringValue( '' );
@@ -361,21 +361,21 @@ class Forminator_Addon_Googlesheet_Quiz_Hooks extends Forminator_Addon_Quiz_Hook
361
  }
362
  }
363
 
364
- // Build the RowData
365
  $row_data = new Forminator_Google_Service_Sheets_RowData();
366
  $row_data->setValues( $values );
367
 
368
- // Prepare the request
369
  $append_request = new Forminator_Google_Service_Sheets_AppendCellsRequest();
370
  $append_request->setSheetId( 0 );
371
  $append_request->setRows( $row_data );
372
  $append_request->setFields( 'userEnteredValue' );
373
 
374
- // Set the request
375
  $request = new Forminator_Google_Service_Sheets_Request();
376
  $request->setAppendCells( $append_request );
377
 
378
- // Add the request to the requests array
379
  $requests[] = $request;
380
  }
381
 
@@ -383,7 +383,7 @@ class Forminator_Addon_Googlesheet_Quiz_Hooks extends Forminator_Addon_Quiz_Hook
383
  throw new Forminator_Addon_Googlesheet_Exception( __( 'No data to be send to GoogleSheet', 'forminator' ) );
384
  }
385
 
386
- // Prepare the update
387
  $batch_update_request = new Forminator_Google_Service_Sheets_BatchUpdateSpreadsheetRequest(
388
  array(
389
  'requests' => $requests,
@@ -496,7 +496,7 @@ class Forminator_Addon_Googlesheet_Quiz_Hooks extends Forminator_Addon_Quiz_Hook
496
  }
497
  }
498
 
499
- // dont use translation because it will be used as reference
500
  $required_header_columns = array(
501
  self::GSHEET_DATE_COLUMN_NAME,
502
  self::GSHEET_QUESTION_COLUMN_NAME,
@@ -525,13 +525,13 @@ class Forminator_Addon_Googlesheet_Quiz_Hooks extends Forminator_Addon_Quiz_Hook
525
  //add
526
  $new_range = $sheet_title . '!' . Forminator_Addon_Googlesheet_Form_Hooks::column_number_to_letter( $column_number ) . '1';
527
 
528
- // update headers map
529
  $header_fields[ $required_header_column ] = array(
530
  'range' => $new_range,
531
  'value' => $expected_header_value,
532
  );
533
 
534
- // increment for next usage
535
  $column_number ++;
536
  $update_body = new Forminator_Google_Service_Sheets_ValueRange();
537
  $update_body->setRange( $new_range );
@@ -541,10 +541,10 @@ class Forminator_Addon_Googlesheet_Quiz_Hooks extends Forminator_Addon_Quiz_Hook
541
  } else {
542
  $header_field = $header_fields[ $required_header_column ];
543
  if ( $expected_header_value !== $header_field['value'] ) {
544
- // update headers map
545
  $header_fields[ $required_header_column ]['value'] = $expected_header_value;
546
 
547
- // update sheet
548
  $update_body = new Forminator_Google_Service_Sheets_ValueRange();
549
  $update_body->setRange( $header_field['range'] );
550
  $update_body->setValues( array( array( $expected_header_value ) ) );
@@ -630,9 +630,9 @@ class Forminator_Addon_Googlesheet_Quiz_Hooks extends Forminator_Addon_Quiz_Hook
630
  *
631
  * @since 1.6.2
632
  *
633
- * @param array $export_headers headers to be displayed on export file
634
- * @param int $quiz_id current Quiz ID
635
- * @param Forminator_Addon_Googlesheet_Quiz_Settings $quiz_settings_instance Google Sheets Addon Quiz Settings instance
636
  */
637
  $export_headers = apply_filters(
638
  'forminator_addon_quiz_googlesheet_export_headers',
@@ -667,8 +667,8 @@ class Forminator_Addon_Googlesheet_Quiz_Hooks extends Forminator_Addon_Quiz_Hook
667
  * @since 1.6.2
668
  *
669
  * @param array $addon_meta_data
670
- * @param int $quiz_id current Quiz ID
671
- * @param Forminator_Addon_Googlesheet_Quiz_Settings $quiz_settings_instance Google Sheets Addon Quiz Settings instance
672
  */
673
  $addon_meta_data = apply_filters(
674
  'forminator_addon_quiz_googlesheet_metadata',
@@ -686,11 +686,11 @@ class Forminator_Addon_Googlesheet_Quiz_Hooks extends Forminator_Addon_Quiz_Hook
686
  *
687
  * @since 1.2
688
  *
689
- * @param array $export_columns column to be exported
690
- * @param int $quiz_id current Quiz ID
691
- * @param Forminator_Form_Entry_Model $entry_model Form Entry Model
692
- * @param array $addon_meta_data meta data saved by addon on entry fields
693
- * @param Forminator_Addon_Googlesheet_Quiz_Settings $quiz_settings_instance Google Sheets Addon Quiz Settings instance
694
  */
695
  $export_columns = apply_filters(
696
  'forminator_addon_quiz_googlesheet_export_columns',
@@ -727,8 +727,8 @@ class Forminator_Addon_Googlesheet_Quiz_Hooks extends Forminator_Addon_Quiz_Hook
727
  * @since 1.6.2
728
  *
729
  * @param array $addon_meta_data
730
- * @param int $quiz_id current Form ID
731
- * @param Forminator_Addon_Googlesheet_Quiz_Settings $quiz_settings_instance Google Sheets Addon Form Settings instance
732
  */
733
  $addon_meta_data = apply_filters(
734
  'forminator_addon_quiz_googlesheet_metadata',
@@ -813,7 +813,7 @@ class Forminator_Addon_Googlesheet_Quiz_Hooks extends Forminator_Addon_Quiz_Hook
813
 
814
  $additional_entry_item['sub_entries'] = $sub_entries;
815
 
816
- // return single array
817
  return $additional_entry_item;
818
  }
819
  }
71
  *
72
  * @param array $submitted_data
73
  * @param array $current_entry_fields
74
+ * @param int $quiz_id current quiz ID.
75
+ * @param Forminator_Addon_Googlesheet_Quiz_Settings $quiz_settings_instance Google Sheets Addon quiz Settings instance.
76
  */
77
  $submitted_data = apply_filters(
78
  'forminator_addon_googlesheet_quiz_submitted_data',
89
  *
90
  * @param array $current_entry_fields
91
  * @param array $submitted_data
92
+ * @param int $quiz_id current Quiz ID.
93
+ * @param Forminator_Addon_Googlesheet_Quiz_Settings $quiz_settings_instance Google Sheets Addon Quiz Settings instance.
94
  */
95
  $current_entry_fields = apply_filters(
96
  'forminator_addon_googlesheet_quiz_entry_fields',
111
  *
112
  * @since 1.6.2
113
  *
114
+ * @param int $quiz_id current Quiz ID.
115
  * @param array $submitted_data
116
+ * @param Forminator_Addon_Googlesheet_Quiz_Settings $quiz_settings_instance Google Sheets Addon Quiz Settings instance.
117
  */
118
  do_action( 'forminator_addon_googlesheet_quiz_before_create_row', $quiz_id, $submitted_data, $quiz_settings_instance );
119
 
120
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
121
+ // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to Google Sheets.
122
  if ( $quiz_settings_instance->is_multi_quiz_settings_complete( $key ) ) {
123
+ // exec only on completed connection.
124
  $data[] = array(
125
  'name' => 'status-' . $key,
126
  'value' => $this->get_status_on_create_row( $key, $submitted_data, $addon_setting_value, $current_entry_fields ),
135
  * @since 1.6.2
136
  *
137
  * @param array $entry_fields
138
+ * @param int $quiz_id current Quiz ID.
139
  * @param array $submitted_data
140
  * @param array $current_entry_fields
141
+ * @param Forminator_Addon_Googlesheet_Quiz_Settings $quiz_settings_instance Google Sheets Addon Quiz Settings instance.
142
  */
143
  $data = apply_filters(
144
  'forminator_addon_quiz_googlesheet_entry_fields',
165
  * @return array `is_sent` true means its success send data to Google Sheets, false otherwise
166
  */
167
  public function get_status_on_create_row( $connection_id, $submitted_data, $connection_settings, $quiz_entry_fields ) {
168
+ // initialize as null.
169
  $api = null;
170
 
171
  $quiz_id = $this->quiz_id;
181
  * @since 1.6.2
182
  *
183
  * @param array $connection_settings
184
+ * @param int $quiz_id current Quiz ID.
185
  * @param array $submitted_data
186
  * @param array $quiz_entry_fields
187
+ * @param Forminator_Addon_Googlesheet_Quiz_Settings $quiz_settings_instance Google Sheets Addon Quiz Settings instance.
188
  */
189
  do_action( 'forminator_addon_quiz_googlesheet_before_prepare_sheet_headers', $connection_settings, $quiz_id, $submitted_data, $quiz_entry_fields, $quiz_settings_instance );
190
 
191
+ // prepare headers.
192
  $header_fields = $this->get_sheet_headers( $connection_settings['file_id'], $quiz_settings );
193
 
194
  /**
196
  *
197
  * @since 1.6.2
198
  *
199
+ * @param array $header_fields sheet headers.
200
  * @param array $connection_settings
201
+ * @param int $quiz_id current Quiz ID.
202
  * @param array $submitted_data
203
  * @param array $quiz_entry_fields
204
+ * @param Forminator_Addon_Googlesheet_Quiz_Settings $quiz_settings_instance Google Sheets Addon Quiz Settings instance.
205
  */
206
  $header_fields = apply_filters(
207
  'forminator_addon_quiz_googlesheet_sheet_headers',
218
  *
219
  * @since 1.6.2
220
  *
221
+ * @param array $header_fields sheet headers.
222
  * @param array $connection_settings
223
+ * @param int $quiz_id current Quiz ID.
224
  * @param array $submitted_data
225
  * @param array $quiz_entry_fields
226
+ * @param Forminator_Addon_Googlesheet_Quiz_Settings $quiz_settings_instance Google Sheets Addon Quiz Settings instance.
227
  */
228
  do_action( 'forminator_addon_quiz_googlesheet_after_prepare_sheet_headers', $header_fields, $connection_settings, $quiz_id, $submitted_data, $quiz_entry_fields, $quiz_settings_instance );
229
 
234
  if ( isset( $quiz_entry['name'] ) && isset( $quiz_entry['value'] ) && 'entry' === $quiz_entry['name'] ) {
235
  if ( is_array( $quiz_entry['value'] ) ) {
236
 
237
+ // KNOWLEDGE.
238
  if ( 'knowledge' === $this->quiz->quiz_type ) {
239
  foreach ( $quiz_entry['value'] as $data ) {
240
  $question = isset( $data['question'] ) ? $data['question'] : '';
277
 
278
  $form_entry_fields = get_addons_lead_form_entry_data( $quiz_settings, $submitted_data, $addons_fields );
279
 
280
+ // all avail fields on library.
281
  $fields = forminator_fields_to_array();
282
  $field_types = array_keys( $fields );
283
 
284
+ // sort by length, so stripos will work by traverse from longest field type first.
285
  $field_types_strlen = array_map( 'strlen', $field_types );
286
  array_multisort( $field_types_strlen, $field_types );
287
  $field_types = array_reverse( $field_types );
296
  $value = new Forminator_Google_Service_Sheets_ExtendedValue();
297
  $cell_data = new Forminator_Google_Service_Sheets_CellData();
298
 
299
+ // only once.
300
  $date_value = 0 === $i ? $date : '';
301
  $value->setStringValue( $date_value );
302
  $cell_data->setUserEnteredValue( $value );
317
  $value = new Forminator_Google_Service_Sheets_ExtendedValue();
318
  $cell_data = new Forminator_Google_Service_Sheets_CellData();
319
 
320
+ // only once for nowrong.
321
  $result_value = $answer['result'];
322
  if ( 'nowrong' === $this->quiz->quiz_type ) {
323
  $result_value = 0 === $i ? $result_value : '';
338
  }
339
 
340
  $meta_value = array();
341
+ // take from entry fields (to be saved).
342
  if ( isset( $form_entry_fields[ $form_column_name ] ) ) {
343
  $meta_value = $form_entry_fields[ $form_column_name ];
344
  }
352
  $cell_data->setUserEnteredValue( $value );
353
  $values[] = $cell_data;
354
  } else {
355
+ // unknown column, set empty.
356
  $value = new Forminator_Google_Service_Sheets_ExtendedValue();
357
  $cell_data = new Forminator_Google_Service_Sheets_CellData();
358
  $value->setStringValue( '' );
361
  }
362
  }
363
 
364
+ // Build the RowData.
365
  $row_data = new Forminator_Google_Service_Sheets_RowData();
366
  $row_data->setValues( $values );
367
 
368
+ // Prepare the request.
369
  $append_request = new Forminator_Google_Service_Sheets_AppendCellsRequest();
370
  $append_request->setSheetId( 0 );
371
  $append_request->setRows( $row_data );
372
  $append_request->setFields( 'userEnteredValue' );
373
 
374
+ // Set the request.
375
  $request = new Forminator_Google_Service_Sheets_Request();
376
  $request->setAppendCells( $append_request );
377
 
378
+ // Add the request to the requests array.
379
  $requests[] = $request;
380
  }
381
 
383
  throw new Forminator_Addon_Googlesheet_Exception( __( 'No data to be send to GoogleSheet', 'forminator' ) );
384
  }
385
 
386
+ // Prepare the update.
387
  $batch_update_request = new Forminator_Google_Service_Sheets_BatchUpdateSpreadsheetRequest(
388
  array(
389
  'requests' => $requests,
496
  }
497
  }
498
 
499
+ // dont use translation because it will be used as reference.
500
  $required_header_columns = array(
501
  self::GSHEET_DATE_COLUMN_NAME,
502
  self::GSHEET_QUESTION_COLUMN_NAME,
525
  //add
526
  $new_range = $sheet_title . '!' . Forminator_Addon_Googlesheet_Form_Hooks::column_number_to_letter( $column_number ) . '1';
527
 
528
+ // update headers map.
529
  $header_fields[ $required_header_column ] = array(
530
  'range' => $new_range,
531
  'value' => $expected_header_value,
532
  );
533
 
534
+ // increment for next usage.
535
  $column_number ++;
536
  $update_body = new Forminator_Google_Service_Sheets_ValueRange();
537
  $update_body->setRange( $new_range );
541
  } else {
542
  $header_field = $header_fields[ $required_header_column ];
543
  if ( $expected_header_value !== $header_field['value'] ) {
544
+ // update headers map.
545
  $header_fields[ $required_header_column ]['value'] = $expected_header_value;
546
 
547
+ // update sheet.
548
  $update_body = new Forminator_Google_Service_Sheets_ValueRange();
549
  $update_body->setRange( $header_field['range'] );
550
  $update_body->setValues( array( array( $expected_header_value ) ) );
630
  *
631
  * @since 1.6.2
632
  *
633
+ * @param array $export_headers headers to be displayed on export file.
634
+ * @param int $quiz_id current Quiz ID.
635
+ * @param Forminator_Addon_Googlesheet_Quiz_Settings $quiz_settings_instance Google Sheets Addon Quiz Settings instance.
636
  */
637
  $export_headers = apply_filters(
638
  'forminator_addon_quiz_googlesheet_export_headers',
667
  * @since 1.6.2
668
  *
669
  * @param array $addon_meta_data
670
+ * @param int $quiz_id current Quiz ID.
671
+ * @param Forminator_Addon_Googlesheet_Quiz_Settings $quiz_settings_instance Google Sheets Addon Quiz Settings instance.
672
  */
673
  $addon_meta_data = apply_filters(
674
  'forminator_addon_quiz_googlesheet_metadata',
686
  *
687
  * @since 1.2
688
  *
689
+ * @param array $export_columns column to be exported.
690
+ * @param int $quiz_id current Quiz ID.
691
+ * @param Forminator_Form_Entry_Model $entry_model Form Entry Model.
692
+ * @param array $addon_meta_data meta data saved by addon on entry fields.
693
+ * @param Forminator_Addon_Googlesheet_Quiz_Settings $quiz_settings_instance Google Sheets Addon Quiz Settings instance.
694
  */
695
  $export_columns = apply_filters(
696
  'forminator_addon_quiz_googlesheet_export_columns',
727
  * @since 1.6.2
728
  *
729
  * @param array $addon_meta_data
730
+ * @param int $quiz_id current Form ID.
731
+ * @param Forminator_Addon_Googlesheet_Quiz_Settings $quiz_settings_instance Google Sheets Addon Form Settings instance.
732
  */
733
  $addon_meta_data = apply_filters(
734
  'forminator_addon_quiz_googlesheet_metadata',
813
 
814
  $additional_entry_item['sub_entries'] = $sub_entries;
815
 
816
+ // return single array.
817
  return $additional_entry_item;
818
  }
819
  }
addons/pro/googlesheet/class-forminator-addon-googlesheet-quiz-settings.php CHANGED
@@ -42,7 +42,7 @@ class Forminator_Addon_Googlesheet_Quiz_Settings extends Forminator_Addon_Quiz_S
42
  * @return array
43
  */
44
  public function quiz_settings_wizards() {
45
- // numerical array steps
46
  return array(
47
  array(
48
  'callback' => array( $this, 'pick_name' ),
@@ -182,13 +182,13 @@ class Forminator_Addon_Googlesheet_Quiz_Settings extends Forminator_Addon_Quiz_S
182
  try {
183
  $folder = $drive->files->get( $folder_id );
184
 
185
- // its from API var
186
  // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
187
  if ( Forminator_Addon_Googlesheet::MIME_TYPE_GOOGLE_DRIVE_FOLDER !== $folder->mimeType ) {
188
  $input_exceptions->add_input_exception( __( 'This is not a folder, please use a valid Folder ID.', 'forminator' ), 'folder_id_error' );
189
  }
190
  } catch ( Forminator_Google_Exception $google_exception ) {
191
- // catch 404
192
  if ( false !== stripos( $google_exception->getMessage(), 'File not found' ) ) {
193
  $input_exceptions->add_input_exception( __( 'Folder not found, please put Folder ID.', 'forminator' ), 'folder_id_error' );
194
  } else {
@@ -349,7 +349,7 @@ class Forminator_Addon_Googlesheet_Quiz_Settings extends Forminator_Addon_Quiz_S
349
  foreach ( $this->get_quiz_settings_values() as $key => $value ) {
350
  $multi_ids[] = array(
351
  'id' => $key,
352
- // use name that was added by user on creating connection
353
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
354
  );
355
  }
@@ -365,7 +365,7 @@ class Forminator_Addon_Googlesheet_Quiz_Settings extends Forminator_Addon_Quiz_S
365
  * @param array $submitted_data
366
  */
367
  public function disconnect_quiz( $submitted_data ) {
368
- // only execute if multi_id provided on submitted data
369
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
370
  $addon_quiz_settings = $this->get_quiz_settings_values();
371
  unset( $addon_quiz_settings[ $submitted_data['multi_id'] ] );
42
  * @return array
43
  */
44
  public function quiz_settings_wizards() {
45
+ // numerical array steps.
46
  return array(
47
  array(
48
  'callback' => array( $this, 'pick_name' ),
182
  try {
183
  $folder = $drive->files->get( $folder_id );
184
 
185
+ // its from API var.
186
  // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
187
  if ( Forminator_Addon_Googlesheet::MIME_TYPE_GOOGLE_DRIVE_FOLDER !== $folder->mimeType ) {
188
  $input_exceptions->add_input_exception( __( 'This is not a folder, please use a valid Folder ID.', 'forminator' ), 'folder_id_error' );
189
  }
190
  } catch ( Forminator_Google_Exception $google_exception ) {
191
+ // catch 404.
192
  if ( false !== stripos( $google_exception->getMessage(), 'File not found' ) ) {
193
  $input_exceptions->add_input_exception( __( 'Folder not found, please put Folder ID.', 'forminator' ), 'folder_id_error' );
194
  } else {
349
  foreach ( $this->get_quiz_settings_values() as $key => $value ) {
350
  $multi_ids[] = array(
351
  'id' => $key,
352
+ // use name that was added by user on creating connection.
353
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
354
  );
355
  }
365
  * @param array $submitted_data
366
  */
367
  public function disconnect_quiz( $submitted_data ) {
368
+ // only execute if multi_id provided on submitted data.
369
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
370
  $addon_quiz_settings = $this->get_quiz_settings_values();
371
  unset( $addon_quiz_settings[ $submitted_data['multi_id'] ] );
addons/pro/googlesheet/class-forminator-addon-googlesheet.php CHANGED
@@ -43,7 +43,7 @@ final class Forminator_Addon_Googlesheet extends Forminator_Addon_Abstract {
43
  * @since 1.0 Google Sheets Addon
44
  */
45
  public function __construct() {
46
- // late init to allow translation
47
  $this->_description = __( 'Get awesome by your form.', 'forminator' );
48
  $this->_activation_error_message = __( 'Sorry but we failed to activate GoogleSheet Integration, don\'t hesitate to contact us', 'forminator' );
49
  $this->_deactivation_error_message = __( 'Sorry but we failed to deactivate GoogleSheet Integration, please try again', 'forminator' );
@@ -86,7 +86,7 @@ final class Forminator_Addon_Googlesheet extends Forminator_Addon_Abstract {
86
  */
87
  public function is_connected() {
88
  try {
89
- // check if its active
90
  if ( ! $this->is_active() ) {
91
  throw new Forminator_Addon_Googlesheet_Exception( __( 'Google Sheets is not active', 'forminator' ) );
92
  }
@@ -94,7 +94,7 @@ final class Forminator_Addon_Googlesheet extends Forminator_Addon_Abstract {
94
  $is_connected = false;
95
  $setting_values = $this->get_all_settings_values();
96
  $tokens = array_column( $setting_values,'token' );
97
- // if user completed api setup
98
  if ( ! empty( $tokens ) ) {
99
  $is_connected = true;
100
  }
@@ -135,7 +135,7 @@ final class Forminator_Addon_Googlesheet extends Forminator_Addon_Abstract {
135
  throw new Forminator_Addon_Googlesheet_Exception( __( 'Invalid Form Settings of GoogleSheet', 'forminator' ) );
136
  }
137
 
138
- // Mark as active when there is at least one active connection
139
  if ( false === $form_settings_instance->find_one_active_connection() ) {
140
  throw new Forminator_Addon_Googlesheet_Exception( __( 'No active GoogleSheet connection found in this form', 'forminator' ) );
141
  }
@@ -152,8 +152,8 @@ final class Forminator_Addon_Googlesheet extends Forminator_Addon_Abstract {
152
  * @since 1.0
153
  *
154
  * @param bool $is_form_connected
155
- * @param int $form_id Current Form ID
156
- * @param Forminator_Addon_Googlesheet_Form_Settings|null $form_settings_instance Instance of form settings, or null when unavailable
157
  *
158
  */
159
  $is_form_connected = apply_filters( 'forminator_addon_googlesheet_is_form_connected', $is_form_connected, $form_id, $form_settings_instance );
@@ -308,7 +308,7 @@ final class Forminator_Addon_Googlesheet extends Forminator_Addon_Abstract {
308
  }
309
 
310
  if ( ! $has_errors ) {
311
- // validate api
312
  try {
313
  if ( $this->get_client_id() !== $client_id || $this->get_client_secret() !== $client_secret ) {
314
  // reset connection!
@@ -440,7 +440,7 @@ final class Forminator_Addon_Googlesheet extends Forminator_Addon_Abstract {
440
  public function is_authorized( $submitted_data ) {
441
  $setting_values = $this->get_settings_values();
442
 
443
- // check api_key and and api_url set up
444
  return isset( $setting_values['token'] ) && ! empty( $setting_values['token'] );
445
  }
446
 
@@ -525,7 +525,7 @@ final class Forminator_Addon_Googlesheet extends Forminator_Addon_Abstract {
525
  *
526
  * @since 1.2
527
  *
528
- * @param string $token (json encoded)
529
  */
530
  $token = apply_filters( 'forminator_addon_googlesheet_client_access_token', $token );
531
 
@@ -602,7 +602,7 @@ final class Forminator_Addon_Googlesheet extends Forminator_Addon_Abstract {
602
  $this->save_settings_values( $settings );
603
  $template_params['is_close'] = true;
604
  } catch ( Exception $e ) {
605
- // catch all exception
606
  $template_params['error_message'] = $e->getMessage();
607
  }
608
  }
@@ -708,7 +708,7 @@ final class Forminator_Addon_Googlesheet extends Forminator_Addon_Abstract {
708
  throw new Forminator_Addon_Googlesheet_Exception( __( 'Invalid Poll Settings of GoogleSheet', 'forminator' ) );
709
  }
710
 
711
- // Mark as active when there is at least one active connection
712
  if ( false === $poll_settings_instance->find_one_active_connection() ) {
713
  throw new Forminator_Addon_Googlesheet_Exception( __( 'No active GoogleSheet connection found in this poll', 'forminator' ) );
714
  }
@@ -726,8 +726,8 @@ final class Forminator_Addon_Googlesheet extends Forminator_Addon_Abstract {
726
  * @since 1.6.1
727
  *
728
  * @param bool $is_poll_connected
729
- * @param int $poll_id Current Poll ID
730
- * @param Forminator_Addon_Googlesheet_Poll_Settings|null $poll_settings_instance Instance of poll settings, or null when unavailable
731
  *
732
  */
733
  $is_poll_connected = apply_filters( 'forminator_addon_googlesheet_is_poll_connected', $is_poll_connected, $poll_id, $poll_settings_instance );
@@ -768,7 +768,7 @@ final class Forminator_Addon_Googlesheet extends Forminator_Addon_Abstract {
768
  throw new Forminator_Addon_Googlesheet_Exception( __( 'Invalid Quiz Settings of GoogleSheet', 'forminator' ) );
769
  }
770
 
771
- // Mark as active when there is at least one active connection
772
  if ( false === $quiz_settings_instance->find_one_active_connection() ) {
773
  throw new Forminator_Addon_Googlesheet_Exception( __( 'No active GoogleSheet connection found in this quiz', 'forminator' ) );
774
  }
@@ -786,8 +786,8 @@ final class Forminator_Addon_Googlesheet extends Forminator_Addon_Abstract {
786
  * @since 1.6.1
787
  *
788
  * @param bool $is_quiz_connected
789
- * @param int $quiz_id Current Quiz ID
790
- * @param Forminator_Addon_Googlesheet_Quiz_Settings|null $quiz_settings_instance Instance of quiz settings, or null when unavailable
791
  *
792
  */
793
  $is_quiz_connected = apply_filters( 'forminator_addon_googlesheet_is_quiz_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
43
  * @since 1.0 Google Sheets Addon
44
  */
45
  public function __construct() {
46
+ // late init to allow translation.
47
  $this->_description = __( 'Get awesome by your form.', 'forminator' );
48
  $this->_activation_error_message = __( 'Sorry but we failed to activate GoogleSheet Integration, don\'t hesitate to contact us', 'forminator' );
49
  $this->_deactivation_error_message = __( 'Sorry but we failed to deactivate GoogleSheet Integration, please try again', 'forminator' );
86
  */
87
  public function is_connected() {
88
  try {
89
+ // check if its active.
90
  if ( ! $this->is_active() ) {
91
  throw new Forminator_Addon_Googlesheet_Exception( __( 'Google Sheets is not active', 'forminator' ) );
92
  }
94
  $is_connected = false;
95
  $setting_values = $this->get_all_settings_values();
96
  $tokens = array_column( $setting_values,'token' );
97
+ // if user completed api setup.
98
  if ( ! empty( $tokens ) ) {
99
  $is_connected = true;
100
  }
135
  throw new Forminator_Addon_Googlesheet_Exception( __( 'Invalid Form Settings of GoogleSheet', 'forminator' ) );
136
  }
137
 
138
+ // Mark as active when there is at least one active connection.
139
  if ( false === $form_settings_instance->find_one_active_connection() ) {
140
  throw new Forminator_Addon_Googlesheet_Exception( __( 'No active GoogleSheet connection found in this form', 'forminator' ) );
141
  }
152
  * @since 1.0
153
  *
154
  * @param bool $is_form_connected
155
+ * @param int $form_id Current Form ID.
156
+ * @param Forminator_Addon_Googlesheet_Form_Settings|null $form_settings_instance Instance of form settings, or null when unavailable.
157
  *
158
  */
159
  $is_form_connected = apply_filters( 'forminator_addon_googlesheet_is_form_connected', $is_form_connected, $form_id, $form_settings_instance );
308
  }
309
 
310
  if ( ! $has_errors ) {
311
+ // validate api.
312
  try {
313
  if ( $this->get_client_id() !== $client_id || $this->get_client_secret() !== $client_secret ) {
314
  // reset connection!
440
  public function is_authorized( $submitted_data ) {
441
  $setting_values = $this->get_settings_values();
442
 
443
+ // check api_key and and api_url set up.
444
  return isset( $setting_values['token'] ) && ! empty( $setting_values['token'] );
445
  }
446
 
525
  *
526
  * @since 1.2
527
  *
528
+ * @param string $token (json encoded).
529
  */
530
  $token = apply_filters( 'forminator_addon_googlesheet_client_access_token', $token );
531
 
602
  $this->save_settings_values( $settings );
603
  $template_params['is_close'] = true;
604
  } catch ( Exception $e ) {
605
+ // catch all exception.
606
  $template_params['error_message'] = $e->getMessage();
607
  }
608
  }
708
  throw new Forminator_Addon_Googlesheet_Exception( __( 'Invalid Poll Settings of GoogleSheet', 'forminator' ) );
709
  }
710
 
711
+ // Mark as active when there is at least one active connection.
712
  if ( false === $poll_settings_instance->find_one_active_connection() ) {
713
  throw new Forminator_Addon_Googlesheet_Exception( __( 'No active GoogleSheet connection found in this poll', 'forminator' ) );
714
  }
726
  * @since 1.6.1
727
  *
728
  * @param bool $is_poll_connected
729
+ * @param int $poll_id Current Poll ID.
730
+ * @param Forminator_Addon_Googlesheet_Poll_Settings|null $poll_settings_instance Instance of poll settings, or null when unavailable.
731
  *
732
  */
733
  $is_poll_connected = apply_filters( 'forminator_addon_googlesheet_is_poll_connected', $is_poll_connected, $poll_id, $poll_settings_instance );
768
  throw new Forminator_Addon_Googlesheet_Exception( __( 'Invalid Quiz Settings of GoogleSheet', 'forminator' ) );
769
  }
770
 
771
+ // Mark as active when there is at least one active connection.
772
  if ( false === $quiz_settings_instance->find_one_active_connection() ) {
773
  throw new Forminator_Addon_Googlesheet_Exception( __( 'No active GoogleSheet connection found in this quiz', 'forminator' ) );
774
  }
786
  * @since 1.6.1
787
  *
788
  * @param bool $is_quiz_connected
789
+ * @param int $quiz_id Current Quiz ID.
790
+ * @param Forminator_Addon_Googlesheet_Quiz_Settings|null $quiz_settings_instance Instance of quiz settings, or null when unavailable.
791
  *
792
  */
793
  $is_quiz_connected = apply_filters( 'forminator_addon_googlesheet_is_quiz_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
addons/pro/googlesheet/googlesheet.php CHANGED
@@ -39,7 +39,7 @@ function forminator_addon_googlesheet_google_api_client_autoload( $class_name )
39
  }
40
  }
41
 
42
- // only enable autoload when needed to avoid further conflicts
43
  //spl_autoload_register( 'forminator_addon_googlesheet_google_api_client_autoload' );
44
 
45
  require_once dirname( __FILE__ ) . '/class-forminator-addon-googlesheet.php';
39
  }
40
  }
41
 
42
+ // only enable autoload when needed to avoid further conflicts.
43
  //spl_autoload_register( 'forminator_addon_googlesheet_google_api_client_autoload' );
44
 
45
  require_once dirname( __FILE__ ) . '/class-forminator-addon-googlesheet.php';
addons/pro/googlesheet/lib/class-forminator-addon-wp-googlesheet-client-logger.php CHANGED
@@ -18,7 +18,7 @@ class Forminator_Addon_Wp_Googlesheet_Client_Logger extends Forminator_Google_Lo
18
  /**
19
  * Writes a message to the current log implementation.
20
  *
21
- * @param string $message The message
22
  */
23
  protected function write( $message ) {
24
  forminator_addon_maybe_log( $message );
18
  /**
19
  * Writes a message to the current log implementation.
20
  *
21
+ * @param string $message The message.
22
  */
23
  protected function write( $message ) {
24
  forminator_addon_maybe_log( $message );
addons/pro/googlesheet/lib/external/Google/Auth/AppIdentity.php CHANGED
@@ -110,7 +110,7 @@ class Forminator_Google_Auth_AppIdentity extends Forminator_Google_Auth_Abstract
110
 
111
  $this->client->getLogger()->debug('App Identity authentication');
112
 
113
- // Add the OAuth2 header to the request
114
  $request->setRequestHeaders(
115
  array('Authorization' => 'Bearer ' . $this->token['access_token'])
116
  );
110
 
111
  $this->client->getLogger()->debug('App Identity authentication');
112
 
113
+ // Add the OAuth2 header to the request.
114
  $request->setRequestHeaders(
115
  array('Authorization' => 'Bearer ' . $this->token['access_token'])
116
  );
addons/pro/googlesheet/lib/external/Google/Auth/AssertionCredentials.php CHANGED
@@ -117,7 +117,7 @@ class Forminator_Google_Auth_AssertionCredentials
117
  $header = array('typ' => 'JWT', 'alg' => 'RS256');
118
 
119
  $payload = json_encode($payload);
120
- // Handle some overzealous escaping in PHP json that seemed to cause some errors
121
  // with claimsets.
122
  $payload = str_replace('\/', '/', $payload);
123
 
117
  $header = array('typ' => 'JWT', 'alg' => 'RS256');
118
 
119
  $payload = json_encode($payload);
120
+ // Handle some overzealous escaping in PHP json that seemed to cause some errors.
121
  // with claimsets.
122
  $payload = str_replace('\/', '/', $payload);
123
 
addons/pro/googlesheet/lib/external/Google/Auth/OAuth2.php CHANGED
@@ -28,9 +28,9 @@ class Forminator_Google_Auth_OAuth2 extends Forminator_Google_Auth_Abstract
28
  const OAUTH2_REVOKE_URI = 'https://accounts.google.com/o/oauth2/revoke';
29
  const OAUTH2_TOKEN_URI = 'https://accounts.google.com/o/oauth2/token';
30
  const OAUTH2_AUTH_URL = 'https://accounts.google.com/o/oauth2/auth';
31
- const CLOCK_SKEW_SECS = 300; // five minutes in seconds
32
- const AUTH_TOKEN_LIFETIME_SECS = 300; // five minutes in seconds
33
- const MAX_TOKEN_LIFETIME_SECS = 86400; // one day in seconds
34
  const OAUTH2_ISSUER = 'accounts.google.com';
35
  const OAUTH2_ISSUER_HTTPS = 'https://accounts.google.com';
36
 
@@ -100,8 +100,8 @@ class Forminator_Google_Auth_OAuth2 extends Forminator_Google_Auth_Abstract
100
  $arguments['redirect_uri'] = $this->client->getClassConfig($this, 'redirect_uri');
101
  }
102
 
103
- // We got here from the redirect from a successful authorization grant,
104
- // fetch the access token
105
  $request = new Forminator_Google_Http_Request(
106
  self::OAUTH2_TOKEN_URI,
107
  'POST',
@@ -161,7 +161,7 @@ class Forminator_Google_Auth_OAuth2 extends Forminator_Google_Auth_Abstract
161
  $params = $this->maybeAddParam($params, 'openid.realm');
162
  $params = $this->maybeAddParam($params, 'include_granted_scopes');
163
 
164
- // If the list of scopes contains plus.login, add request_visible_actions
165
  // to auth URL.
166
  $rva = $this->client->getClassConfig($this, 'request_visible_actions');
167
  if (strpos($scope, 'plus.login') && strlen($rva) > 0) {
@@ -223,7 +223,7 @@ class Forminator_Google_Auth_OAuth2 extends Forminator_Google_Auth_Abstract
223
  */
224
  public function sign(Forminator_Google_Http_Request $request)
225
  {
226
- // add the developer key to the request before signing it
227
  if ($this->client->getClassConfig($this, 'developer_key')) {
228
  $request->setQueryParam('key', $this->client->getClassConfig($this, 'developer_key'));
229
  }
@@ -233,7 +233,7 @@ class Forminator_Google_Auth_OAuth2 extends Forminator_Google_Auth_Abstract
233
  return $request;
234
  }
235
 
236
- // Check if the token is set to expire in the next 30 seconds
237
  // (or has already expired).
238
  if ($this->isAccessTokenExpired()) {
239
  if ($this->assertionCredentials) {
@@ -254,7 +254,7 @@ class Forminator_Google_Auth_OAuth2 extends Forminator_Google_Auth_Abstract
254
 
255
  $this->client->getLogger()->debug('OAuth2 authentication');
256
 
257
- // Add the OAuth2 header to the request
258
  $request->setRequestHeaders(
259
  array('Authorization' => 'Bearer ' . $this->token['access_token'])
260
  );
@@ -293,8 +293,8 @@ class Forminator_Google_Auth_OAuth2 extends Forminator_Google_Auth_Abstract
293
  $cacheKey = $assertionCredentials->getCacheKey();
294
 
295
  if ($cacheKey) {
296
- // We can check whether we have a token available in the
297
- // cache. If it is expired, we can retrieve a new one from
298
  // the assertion.
299
  $token = $this->client->getCache()->get($cacheKey);
300
  if ($token) {
@@ -376,7 +376,7 @@ class Forminator_Google_Auth_OAuth2 extends Forminator_Google_Auth_Abstract
376
  {
377
  if (!$token) {
378
  if (!$this->token) {
379
- // Not initialized, no token to actually revoke
380
  return false;
381
  } elseif (array_key_exists('refresh_token', $this->token)) {
382
  $token = $this->token['refresh_token'];
@@ -419,7 +419,7 @@ class Forminator_Google_Auth_OAuth2 extends Forminator_Google_Auth_Abstract
419
  }
420
 
421
  // Gets federated sign-on certificates to use for verifying identity tokens.
422
- // Returns certs as array structure, where keys are key ids, and values
423
  // are PEM encoded certificates.
424
  private function getFederatedSignOnCerts()
425
  {
@@ -533,14 +533,14 @@ class Forminator_Google_Auth_OAuth2 extends Forminator_Google_Auth_Abstract
533
  throw new Forminator_Google_Auth_Exception("Can't parse token envelope: " . $segments[0]);
534
  }
535
 
536
- // Parse token
537
  $json_body = Forminator_Google_Utils::urlSafeB64Decode($segments[1]);
538
  $payload = json_decode($json_body, true);
539
  if (!$payload) {
540
  throw new Forminator_Google_Auth_Exception("Can't parse token payload: " . $segments[1]);
541
  }
542
 
543
- // Check signature
544
  $verified = false;
545
  foreach ($certs as $keyName => $pem) {
546
  $public_key = new Forminator_Google_Verifier_Pem($pem);
@@ -554,7 +554,7 @@ class Forminator_Google_Auth_OAuth2 extends Forminator_Google_Auth_Abstract
554
  throw new Forminator_Google_Auth_Exception("Invalid token signature: $jwt");
555
  }
556
 
557
- // Check issued-at timestamp
558
  $iat = 0;
559
  if (array_key_exists("iat", $payload)) {
560
  $iat = $payload["iat"];
@@ -564,7 +564,7 @@ class Forminator_Google_Auth_OAuth2 extends Forminator_Google_Auth_Abstract
564
  }
565
  $earliest = $iat - self::CLOCK_SKEW_SECS;
566
 
567
- // Check expiration timestamp
568
  $now = time();
569
  $exp = 0;
570
  if (array_key_exists("exp", $payload)) {
@@ -601,8 +601,8 @@ class Forminator_Google_Auth_OAuth2 extends Forminator_Google_Auth_Abstract
601
  );
602
  }
603
 
604
- // support HTTP and HTTPS issuers
605
- // @see https://developers.google.com/identity/sign-in/web/backend-auth
606
  $iss = $payload['iss'];
607
  if ($issuer && !in_array($iss, (array) $issuer)) {
608
  throw new Forminator_Google_Auth_Exception(
@@ -615,7 +615,7 @@ class Forminator_Google_Auth_OAuth2 extends Forminator_Google_Auth_Abstract
615
  );
616
  }
617
 
618
- // Check audience
619
  $aud = $payload["aud"];
620
  if ($aud != $required_audience) {
621
  throw new Forminator_Google_Auth_Exception(
28
  const OAUTH2_REVOKE_URI = 'https://accounts.google.com/o/oauth2/revoke';
29
  const OAUTH2_TOKEN_URI = 'https://accounts.google.com/o/oauth2/token';
30
  const OAUTH2_AUTH_URL = 'https://accounts.google.com/o/oauth2/auth';
31
+ const CLOCK_SKEW_SECS = 300; // five minutes in seconds.
32
+ const AUTH_TOKEN_LIFETIME_SECS = 300; // five minutes in seconds.
33
+ const MAX_TOKEN_LIFETIME_SECS = 86400; // one day in seconds.
34
  const OAUTH2_ISSUER = 'accounts.google.com';
35
  const OAUTH2_ISSUER_HTTPS = 'https://accounts.google.com';
36
 
100
  $arguments['redirect_uri'] = $this->client->getClassConfig($this, 'redirect_uri');
101
  }
102
 
103
+ // We got here from the redirect from a successful authorization grant,.
104
+ // fetch the access token.
105
  $request = new Forminator_Google_Http_Request(
106
  self::OAUTH2_TOKEN_URI,
107
  'POST',
161
  $params = $this->maybeAddParam($params, 'openid.realm');
162
  $params = $this->maybeAddParam($params, 'include_granted_scopes');
163
 
164
+ // If the list of scopes contains plus.login, add request_visible_actions.
165
  // to auth URL.
166
  $rva = $this->client->getClassConfig($this, 'request_visible_actions');
167
  if (strpos($scope, 'plus.login') && strlen($rva) > 0) {
223
  */
224
  public function sign(Forminator_Google_Http_Request $request)
225
  {
226
+ // add the developer key to the request before signing it.
227
  if ($this->client->getClassConfig($this, 'developer_key')) {
228
  $request->setQueryParam('key', $this->client->getClassConfig($this, 'developer_key'));
229
  }
233
  return $request;
234
  }
235
 
236
+ // Check if the token is set to expire in the next 30 seconds.
237
  // (or has already expired).
238
  if ($this->isAccessTokenExpired()) {
239
  if ($this->assertionCredentials) {
254
 
255
  $this->client->getLogger()->debug('OAuth2 authentication');
256
 
257
+ // Add the OAuth2 header to the request.
258
  $request->setRequestHeaders(
259
  array('Authorization' => 'Bearer ' . $this->token['access_token'])
260
  );
293
  $cacheKey = $assertionCredentials->getCacheKey();
294
 
295
  if ($cacheKey) {
296
+ // We can check whether we have a token available in the.
297
+ // cache. If it is expired, we can retrieve a new one from.
298
  // the assertion.
299
  $token = $this->client->getCache()->get($cacheKey);
300
  if ($token) {
376
  {
377
  if (!$token) {
378
  if (!$this->token) {
379
+ // Not initialized, no token to actually revoke.
380
  return false;
381
  } elseif (array_key_exists('refresh_token', $this->token)) {
382
  $token = $this->token['refresh_token'];
419
  }
420
 
421
  // Gets federated sign-on certificates to use for verifying identity tokens.
422
+ // Returns certs as array structure, where keys are key ids, and values.
423
  // are PEM encoded certificates.
424
  private function getFederatedSignOnCerts()
425
  {
533
  throw new Forminator_Google_Auth_Exception("Can't parse token envelope: " . $segments[0]);
534
  }
535
 
536
+ // Parse token.
537
  $json_body = Forminator_Google_Utils::urlSafeB64Decode($segments[1]);
538
  $payload = json_decode($json_body, true);
539
  if (!$payload) {
540
  throw new Forminator_Google_Auth_Exception("Can't parse token payload: " . $segments[1]);
541
  }
542
 
543
+ // Check signature.
544
  $verified = false;
545
  foreach ($certs as $keyName => $pem) {
546
  $public_key = new Forminator_Google_Verifier_Pem($pem);
554
  throw new Forminator_Google_Auth_Exception("Invalid token signature: $jwt");
555
  }
556
 
557
+ // Check issued-at timestamp.
558
  $iat = 0;
559
  if (array_key_exists("iat", $payload)) {
560
  $iat = $payload["iat"];
564
  }
565
  $earliest = $iat - self::CLOCK_SKEW_SECS;
566
 
567
+ // Check expiration timestamp.
568
  $now = time();
569
  $exp = 0;
570
  if (array_key_exists("exp", $payload)) {
601
  );
602
  }
603
 
604
+ // support HTTP and HTTPS issuers.
605
+ // @see https://developers.google.com/identity/sign-in/web/backend-auth.
606
  $iss = $payload['iss'];
607
  if ($issuer && !in_array($iss, (array) $issuer)) {
608
  throw new Forminator_Google_Auth_Exception(
615
  );
616
  }
617
 
618
+ // Check audience.
619
  $aud = $payload["aud"];
620
  if ($aud != $required_audience) {
621
  throw new Forminator_Google_Auth_Exception(
addons/pro/googlesheet/lib/external/Google/Cache/File.php CHANGED
@@ -94,7 +94,7 @@ class Forminator_Google_Cache_File extends Forminator_Google_Cache_Abstract
94
  {
95
  $storageFile = $this->getWriteableCacheFile($key);
96
  if ($this->acquireWriteLock($storageFile)) {
97
- // We serialize the whole request object, since we don't only want the
98
  // responseContent but also the postBody used, headers, size, etc.
99
  $data = serialize($value);
100
  $result = fwrite($this->fh, $data);
@@ -141,9 +141,9 @@ class Forminator_Google_Cache_File extends Forminator_Google_Cache_Abstract
141
 
142
  private function getCacheDir($file, $forWrite)
143
  {
144
- // use the first 2 characters of the hash as a directory prefix
145
- // this should prevent slowdowns due to huge directory listings
146
- // and thus give some basic amount of scalability
147
  $storageDir = $this->path . '/' . substr(md5($file), 0, 2);
148
  if ($forWrite && ! is_dir($storageDir)) {
149
  if (! mkdir($storageDir, 0700, true)) {
94
  {
95
  $storageFile = $this->getWriteableCacheFile($key);
96
  if ($this->acquireWriteLock($storageFile)) {
97
+ // We serialize the whole request object, since we don't only want the.
98
  // responseContent but also the postBody used, headers, size, etc.
99
  $data = serialize($value);
100
  $result = fwrite($this->fh, $data);
141
 
142
  private function getCacheDir($file, $forWrite)
143
  {
144
+ // use the first 2 characters of the hash as a directory prefix.
145
+ // this should prevent slowdowns due to huge directory listings.
146
+ // and thus give some basic amount of scalability.
147
  $storageDir = $this->path . '/' . substr(md5($file), 0, 2);
148
  if ($forWrite && ! is_dir($storageDir)) {
149
  if (! mkdir($storageDir, 0700, true)) {
addons/pro/googlesheet/lib/external/Google/Cache/Memcache.php CHANGED
@@ -113,7 +113,7 @@ class Forminator_Google_Cache_Memcache extends Forminator_Google_Cache_Abstract
113
  public function set($key, $value)
114
  {
115
  $this->connect();
116
- // we store it with the cache_time default expiration so objects will at
117
  // least get cleaned eventually.
118
  $data = array('time' => time(), 'data' => $value);
119
  $rc = false;
113
  public function set($key, $value)
114
  {
115
  $this->connect();
116
+ // we store it with the cache_time default expiration so objects will at.
117
  // least get cleaned eventually.
118
  $data = array('time' => time(), 'data' => $value);
119
  $rc = false;
addons/pro/googlesheet/lib/external/Google/Client.php CHANGED
@@ -58,13 +58,13 @@ class Forminator_Google_Client
58
  private $deferExecution = false;
59
 
60
  /** @var array $scopes */
61
- // Scopes requested by the client
62
  protected $requestedScopes = array();
63
 
64
  // definitions of services that are discovered.
65
  protected $services = array();
66
 
67
- // Used to track authenticated state, can't discover services after doing authenticate()
68
  private $authenticated = false;
69
 
70
  /**
@@ -280,7 +280,7 @@ class Forminator_Google_Client
280
  {
281
  $token = $this->getAuth()->getAccessToken();
282
  // The response is json encoded, so could be the string null.
283
- // It is arguable whether this check should be here or lower
284
  // in the library.
285
  return (null == $token || 'null' == $token || '[]' == $token) ? null : $token;
286
  }
58
  private $deferExecution = false;
59
 
60
  /** @var array $scopes */
61
+ // Scopes requested by the client.
62
  protected $requestedScopes = array();
63
 
64
  // definitions of services that are discovered.
65
  protected $services = array();
66
 
67
+ // Used to track authenticated state, can't discover services after doing authenticate().
68
  private $authenticated = false;
69
 
70
  /**
280
  {
281
  $token = $this->getAuth()->getAccessToken();
282
  // The response is json encoded, so could be the string null.
283
+ // It is arguable whether this check should be here or lower.
284
  // in the library.
285
  return (null == $token || 'null' == $token || '[]' == $token) ? null : $token;
286
  }
addons/pro/googlesheet/lib/external/Google/Config.php CHANGED
@@ -49,7 +49,7 @@ class Forminator_Google_Config
49
  'cache_class' => 'Forminator_Google_Cache_File',
50
  'logger_class' => 'Forminator_Google_Logger_Null',
51
 
52
- // Don't change these unless you're working against a special development
53
  // or testing environment.
54
  'base_path' => 'https://www.googleapis.com',
55
 
@@ -77,22 +77,22 @@ class Forminator_Google_Config
77
  // Disable the use of gzip on calls if set to true. Defaults to false.
78
  'disable_gzip' => self::GZIP_ENABLED,
79
 
80
- // We default gzip to disabled on uploads even if gzip is otherwise
81
  // enabled, due to some issues seen with small packet sizes for uploads.
82
- // Please test with this option before enabling gzip for uploads in
83
  // a production environment.
84
  'enable_gzip_for_uploads' => self::GZIP_UPLOADS_DISABLED,
85
  ),
86
- // If you want to pass in OAuth 2.0 settings, they will need to be
87
  // structured like this.
88
  'Forminator_Google_Auth_OAuth2' => array(
89
- // Keys for OAuth 2.0 access, see the API console at
90
- // https://developers.google.com/console
91
  'client_id' => '',
92
  'client_secret' => '',
93
  'redirect_uri' => '',
94
 
95
- // Simple API access key, also from the API console. Ensure you get
96
  // a Server key, and not a Browser key.
97
  'developer_key' => '',
98
 
@@ -109,16 +109,16 @@ class Forminator_Google_Config
109
  'https://www.googleapis.com/oauth2/v1/certs',
110
  ),
111
  'Forminator_Google_Task_Runner' => array(
112
- // Delays are specified in seconds
113
  'initial_delay' => 1,
114
  'max_delay' => 60,
115
- // Base number for exponential backoff
116
  'factor' => 2,
117
- // A random number between -jitter and jitter will be added to the
118
- // factor on each iteration to allow for better distribution of
119
  // retries.
120
  'jitter' => .5,
121
- // Maximum number of retries allowed
122
  'retries' => 0
123
  ),
124
  'Forminator_Google_Service_Exception' => array(
49
  'cache_class' => 'Forminator_Google_Cache_File',
50
  'logger_class' => 'Forminator_Google_Logger_Null',
51
 
52
+ // Don't change these unless you're working against a special development.
53
  // or testing environment.
54
  'base_path' => 'https://www.googleapis.com',
55
 
77
  // Disable the use of gzip on calls if set to true. Defaults to false.
78
  'disable_gzip' => self::GZIP_ENABLED,
79
 
80
+ // We default gzip to disabled on uploads even if gzip is otherwise.
81
  // enabled, due to some issues seen with small packet sizes for uploads.
82
+ // Please test with this option before enabling gzip for uploads in.
83
  // a production environment.
84
  'enable_gzip_for_uploads' => self::GZIP_UPLOADS_DISABLED,
85
  ),
86
+ // If you want to pass in OAuth 2.0 settings, they will need to be.
87
  // structured like this.
88
  'Forminator_Google_Auth_OAuth2' => array(
89
+ // Keys for OAuth 2.0 access, see the API console at.
90
+ // https://developers.google.com/console.
91
  'client_id' => '',
92
  'client_secret' => '',
93
  'redirect_uri' => '',
94
 
95
+ // Simple API access key, also from the API console. Ensure you get.
96
  // a Server key, and not a Browser key.
97
  'developer_key' => '',
98
 
109
  'https://www.googleapis.com/oauth2/v1/certs',
110
  ),
111
  'Forminator_Google_Task_Runner' => array(
112
+ // Delays are specified in seconds.
113
  'initial_delay' => 1,
114
  'max_delay' => 60,
115
+ // Base number for exponential backoff.
116
  'factor' => 2,
117
+ // A random number between -jitter and jitter will be added to the.
118
+ // factor on each iteration to allow for better distribution of.
119
  // retries.
120
  'jitter' => .5,
121
+ // Maximum number of retries allowed.
122
  'retries' => 0
123
  ),
124
  'Forminator_Google_Service_Exception' => array(
addons/pro/googlesheet/lib/external/Google/Http/Batch.php CHANGED
@@ -130,7 +130,7 @@ class Forminator_Google_Http_Batch
130
  $response = Forminator_Google_Http_REST::decodeHttpResponse($response, $this->client);
131
  $responses[$key] = $response;
132
  } catch (Forminator_Google_Service_Exception $e) {
133
- // Store the exception as the response, so successful responses
134
  // can be processed.
135
  $responses[$key] = $e;
136
  }
130
  $response = Forminator_Google_Http_REST::decodeHttpResponse($response, $this->client);
131
  $responses[$key] = $response;
132
  } catch (Forminator_Google_Service_Exception $e) {
133
+ // Store the exception as the response, so successful responses.
134
  // can be processed.
135
  $responses[$key] = $e;
136
  }
addons/pro/googlesheet/lib/external/Google/Http/CacheParser.php CHANGED
@@ -44,8 +44,8 @@ class Forminator_Google_Http_CacheParser
44
  }
45
 
46
  // Don't cache authorized requests/responses.
47
- // [rfc2616-14.8] When a shared cache receives a request containing an
48
- // Authorization field, it MUST NOT return the corresponding response
49
  // as a reply to any other request...
50
  if ($resp->getRequestHeader("authorization")) {
51
  return false;
@@ -64,7 +64,7 @@ class Forminator_Google_Http_CacheParser
64
  */
65
  public static function isResponseCacheable(Forminator_Google_Http_Request $resp)
66
  {
67
- // First, check if the HTTP request was cacheable before inspecting the
68
  // HTTP response.
69
  if (false == self::isRequestCacheable($resp)) {
70
  return false;
@@ -75,30 +75,30 @@ class Forminator_Google_Http_CacheParser
75
  return false;
76
  }
77
 
78
- // The resource is uncacheable if the resource is already expired and
79
  // the resource doesn't have an ETag for revalidation.
80
  $etag = $resp->getResponseHeader("etag");
81
  if (self::isExpired($resp) && $etag == false) {
82
  return false;
83
  }
84
 
85
- // [rfc2616-14.9.2] If [no-store is] sent in a response, a cache MUST NOT
86
  // store any part of either this response or the request that elicited it.
87
  $cacheControl = $resp->getParsedCacheControl();
88
  if (isset($cacheControl['no-store'])) {
89
  return false;
90
  }
91
 
92
- // Pragma: no-cache is an http request directive, but is occasionally
93
  // used as a response header incorrectly.
94
  $pragma = $resp->getResponseHeader('pragma');
95
  if ($pragma == 'no-cache' || strpos($pragma, 'no-cache') !== false) {
96
  return false;
97
  }
98
 
99
- // [rfc2616-14.44] Vary: * is extremely difficult to cache. "It implies that
100
- // a cache cannot determine from the request headers of a subsequent request
101
- // whether this response is the appropriate representation."
102
  // Given this, we deem responses with the Vary header as uncacheable.
103
  $vary = $resp->getResponseHeader('vary');
104
  if ($vary) {
@@ -116,7 +116,7 @@ class Forminator_Google_Http_CacheParser
116
  */
117
  public static function isExpired(Forminator_Google_Http_Request $resp)
118
  {
119
- // HTTP/1.1 clients and caches MUST treat other invalid date formats,
120
  // especially including the value “0”, as in the past.
121
  $parsedExpires = false;
122
  $responseHeaders = $resp->getResponseHeaders();
@@ -146,8 +146,8 @@ class Forminator_Google_Http_CacheParser
146
  $parsedDate = strtotime($rawDate);
147
 
148
  if (empty($rawDate) || false == $parsedDate) {
149
- // We can't default this to now, as that means future cache reads
150
- // will always pass with the logic below, so we will require a
151
  // date be injected if not supplied.
152
  throw new Forminator_Google_Exception("All cacheable requests must have creation dates.");
153
  }
@@ -177,8 +177,8 @@ class Forminator_Google_Http_CacheParser
177
  */
178
  public static function mustRevalidate(Forminator_Google_Http_Request $response)
179
  {
180
- // [13.3] When a cache has a stale entry that it would like to use as a
181
- // response to a client's request, it first has to check with the origin
182
  // server to see if its cached entry is still usable.
183
  return self::isExpired($response);
184
  }
44
  }
45
 
46
  // Don't cache authorized requests/responses.
47
+ // [rfc2616-14.8] When a shared cache receives a request containing an.
48
+ // Authorization field, it MUST NOT return the corresponding response.
49
  // as a reply to any other request...
50
  if ($resp->getRequestHeader("authorization")) {
51
  return false;
64
  */
65
  public static function isResponseCacheable(Forminator_Google_Http_Request $resp)
66
  {
67
+ // First, check if the HTTP request was cacheable before inspecting the.
68
  // HTTP response.
69
  if (false == self::isRequestCacheable($resp)) {
70
  return false;
75
  return false;
76
  }
77
 
78
+ // The resource is uncacheable if the resource is already expired and.
79
  // the resource doesn't have an ETag for revalidation.
80
  $etag = $resp->getResponseHeader("etag");
81
  if (self::isExpired($resp) && $etag == false) {
82
  return false;
83
  }
84
 
85
+ // [rfc2616-14.9.2] If [no-store is] sent in a response, a cache MUST NOT.
86
  // store any part of either this response or the request that elicited it.
87
  $cacheControl = $resp->getParsedCacheControl();
88
  if (isset($cacheControl['no-store'])) {
89
  return false;
90
  }
91
 
92
+ // Pragma: no-cache is an http request directive, but is occasionally.
93
  // used as a response header incorrectly.
94
  $pragma = $resp->getResponseHeader('pragma');
95
  if ($pragma == 'no-cache' || strpos($pragma, 'no-cache') !== false) {
96
  return false;
97
  }
98
 
99
+ // [rfc2616-14.44] Vary: * is extremely difficult to cache. "It implies that.
100
+ // a cache cannot determine from the request headers of a subsequent request.
101
+ // whether this response is the appropriate representation.".
102
  // Given this, we deem responses with the Vary header as uncacheable.
103
  $vary = $resp->getResponseHeader('vary');
104
  if ($vary) {
116
  */
117
  public static function isExpired(Forminator_Google_Http_Request $resp)
118
  {
119
+ // HTTP/1.1 clients and caches MUST treat other invalid date formats,.
120
  // especially including the value “0”, as in the past.
121
  $parsedExpires = false;
122
  $responseHeaders = $resp->getResponseHeaders();
146
  $parsedDate = strtotime($rawDate);
147
 
148
  if (empty($rawDate) || false == $parsedDate) {
149
+ // We can't default this to now, as that means future cache reads.
150
+ // will always pass with the logic below, so we will require a.
151
  // date be injected if not supplied.
152
  throw new Forminator_Google_Exception("All cacheable requests must have creation dates.");
153
  }
177
  */
178
  public static function mustRevalidate(Forminator_Google_Http_Request $response)
179
  {
180
+ // [13.3] When a cache has a stale entry that it would like to use as a.
181
+ // response to a client's request, it first has to check with the origin.
182
  // server to see if its cached entry is still usable.
183
  return self::isExpired($response);
184
  }
addons/pro/googlesheet/lib/external/Google/Http/MediaFileUpload.php CHANGED
@@ -94,7 +94,7 @@ class Forminator_Google_Http_MediaFileUpload
94
  $this->progress = 0;
95
  $this->boundary = $boundary;
96
 
97
- // Process Media Request
98
  $this->process();
99
  }
100
 
94
  $this->progress = 0;
95
  $this->boundary = $boundary;
96
 
97
+ // Process Media Request.
98
  $this->process();
99
  }
100
 
addons/pro/googlesheet/lib/external/Google/Http/REST.php CHANGED
@@ -82,8 +82,8 @@ class Forminator_Google_Http_REST
82
  if (isset($decoded['error']) &&
83
  isset($decoded['error']['message']) &&
84
  isset($decoded['error']['code'])) {
85
- // if we're getting a json encoded error definition, use that instead of the raw response
86
- // body for improved readability
87
  $err .= ": ({$decoded['error']['code']}) {$decoded['error']['message']}";
88
  } else {
89
  $err .= ": ($code) $body";
@@ -110,7 +110,7 @@ class Forminator_Google_Http_REST
110
  throw new Forminator_Google_Service_Exception($err, $code, null, $errors, $map);
111
  }
112
 
113
- // Only attempt to decode the response, if the response code wasn't (204) 'no content'
114
  if ($code != '204') {
115
  if ($response->getExpectedRaw()) {
116
  return $body;
82
  if (isset($decoded['error']) &&
83
  isset($decoded['error']['message']) &&
84
  isset($decoded['error']['code'])) {
85
+ // if we're getting a json encoded error definition, use that instead of the raw response.
86
+ // body for improved readability.
87
  $err .= ": ({$decoded['error']['code']}) {$decoded['error']['message']}";
88
  } else {
89
  $err .= ": ($code) $body";
110
  throw new Forminator_Google_Service_Exception($err, $code, null, $errors, $map);
111
  }
112
 
113
+ // Only attempt to decode the response, if the response code wasn't (204) 'no content'.
114
  if ($code != '204') {
115
  if ($response->getExpectedRaw()) {
116
  return $body;
addons/pro/googlesheet/lib/external/Google/IO/Abstract.php CHANGED
@@ -148,8 +148,8 @@ abstract class Forminator_Google_IO_Abstract
148
  $request->setResponseHttpCode($respHttpCode);
149
  $request->setResponseHeaders($responseHeaders);
150
  $request->setResponseBody($responseData);
151
- // Store the request in cache (the function checks to see if the request
152
- // can actually be cached)
153
  $this->setCachedRequest($request);
154
  return $request;
155
  }
@@ -214,7 +214,7 @@ abstract class Forminator_Google_IO_Abstract
214
  if (Forminator_Google_Http_CacheParser::mustRevalidate($cached)) {
215
  $addHeaders = array();
216
  if ($cached->getResponseHeader('etag')) {
217
- // [13.3.4] If an entity tag has been provided by the origin server,
218
  // we must use that entity tag in any cache-conditional request.
219
  $addHeaders['If-None-Match'] = $cached->getResponseHeader('etag');
220
  } elseif ($cached->getResponseHeader('date')) {
@@ -259,13 +259,13 @@ abstract class Forminator_Google_IO_Abstract
259
  */
260
  public function parseHttpResponse($respData, $headerSize)
261
  {
262
- // check proxy header
263
  foreach (self::$CONNECTION_ESTABLISHED_HEADERS as $established_header) {
264
  if (stripos($respData, $established_header) !== false) {
265
- // existed, remove it
266
  $respData = str_ireplace($established_header, '', $respData);
267
- // Subtract the proxy header size unless the cURL bug prior to 7.30.0
268
- // is present which prevented the proxy header size from being taken into
269
  // account.
270
  if (!$this->needsQuirk()) {
271
  $headerSize -= strlen($established_header);
148
  $request->setResponseHttpCode($respHttpCode);
149
  $request->setResponseHeaders($responseHeaders);
150
  $request->setResponseBody($responseData);
151
+ // Store the request in cache (the function checks to see if the request.
152
+ // can actually be cached).
153
  $this->setCachedRequest($request);
154
  return $request;
155
  }
214
  if (Forminator_Google_Http_CacheParser::mustRevalidate($cached)) {
215
  $addHeaders = array();
216
  if ($cached->getResponseHeader('etag')) {
217
+ // [13.3.4] If an entity tag has been provided by the origin server,.
218
  // we must use that entity tag in any cache-conditional request.
219
  $addHeaders['If-None-Match'] = $cached->getResponseHeader('etag');
220
  } elseif ($cached->getResponseHeader('date')) {
259
  */
260
  public function parseHttpResponse($respData, $headerSize)
261
  {
262
+ // check proxy header.
263
  foreach (self::$CONNECTION_ESTABLISHED_HEADERS as $established_header) {
264
  if (stripos($respData, $established_header) !== false) {
265
+ // existed, remove it.
266
  $respData = str_ireplace($established_header, '', $respData);
267
+ // Subtract the proxy header size unless the cURL bug prior to 7.30.0.
268
+ // is present which prevented the proxy header size from being taken into.
269
  // account.
270
  if (!$this->needsQuirk()) {
271
  $headerSize -= strlen($established_header);
addons/pro/googlesheet/lib/external/Google/IO/Curl.php CHANGED
@@ -27,7 +27,7 @@ if (!class_exists('Forminator_Google_Client')) {
27
 
28
  class Forminator_Google_IO_Curl extends Forminator_Google_IO_Abstract
29
  {
30
- // cURL hex representation of version 7.30.0
31
  const NO_QUIRK_VERSION = 0x071E00;
32
 
33
  private $options = array();
@@ -82,8 +82,8 @@ class Forminator_Google_IO_Curl extends Forminator_Google_IO_Abstract
82
  curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false);
83
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
84
 
85
- // The SSL version will be determined by the underlying library
86
- // @see https://github.com/google/google-api-php-client/pull/644
87
  //curl_setopt($curl, CURLOPT_SSLVERSION, 1);
88
 
89
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
@@ -157,9 +157,9 @@ class Forminator_Google_IO_Curl extends Forminator_Google_IO_Abstract
157
  */
158
  public function setTimeout($timeout)
159
  {
160
- // Since this timeout is really for putting a bound on the time
161
- // we'll set them both to the same. If you need to specify a longer
162
- // CURLOPT_TIMEOUT, or a higher CONNECTTIMEOUT, the best thing to
163
  // do is use the setOptions method for the values individually.
164
  $this->options[CURLOPT_CONNECTTIMEOUT] = $timeout;
165
  $this->options[CURLOPT_TIMEOUT] = $timeout;
27
 
28
  class Forminator_Google_IO_Curl extends Forminator_Google_IO_Abstract
29
  {
30
+ // cURL hex representation of version 7.30.0.
31
  const NO_QUIRK_VERSION = 0x071E00;
32
 
33
  private $options = array();
82
  curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false);
83
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
84
 
85
+ // The SSL version will be determined by the underlying library.
86
+ // @see https://github.com/google/google-api-php-client/pull/644.
87
  //curl_setopt($curl, CURLOPT_SSLVERSION, 1);
88
 
89
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
157
  */
158
  public function setTimeout($timeout)
159
  {
160
+ // Since this timeout is really for putting a bound on the time.
161
+ // we'll set them both to the same. If you need to specify a longer.
162
+ // CURLOPT_TIMEOUT, or a higher CONNECTTIMEOUT, the best thing to.
163
  // do is use the setOptions method for the values individually.
164
  $this->options[CURLOPT_CONNECTTIMEOUT] = $timeout;
165
  $this->options[CURLOPT_TIMEOUT] = $timeout;
addons/pro/googlesheet/lib/external/Google/IO/Stream.php CHANGED
@@ -120,7 +120,7 @@ class Forminator_Google_IO_Stream extends Forminator_Google_IO_Abstract
120
  )
121
  );
122
 
123
- // We are trapping any thrown errors in this method only and
124
  // throwing an exception.
125
  $this->trappedErrorNumber = null;
126
  $this->trappedErrorString = null;
120
  )
121
  );
122
 
123
+ // We are trapping any thrown errors in this method only and.
124
  // throwing an exception.
125
  $this->trappedErrorNumber = null;
126
  $this->trappedErrorString = null;
addons/pro/googlesheet/lib/external/Google/Model.php CHANGED
@@ -103,7 +103,7 @@ class Forminator_Google_Model implements ArrayAccess
103
  $this->$key = $val;
104
  unset($array[$key]);
105
  } elseif (property_exists($this, $camelKey = Forminator_Google_Utils::camelCase($key))) {
106
- // This checks if property exists as camelCase, leaving it in array as snake_case
107
  // in case of backwards compatibility issues.
108
  $this->$camelKey = $val;
109
  }
103
  $this->$key = $val;
104
  unset($array[$key]);
105
  } elseif (property_exists($this, $camelKey = Forminator_Google_Utils::camelCase($key))) {
106
+ // This checks if property exists as camelCase, leaving it in array as snake_case.
107
  // in case of backwards compatibility issues.
108
  $this->$camelKey = $val;
109
  }
addons/pro/googlesheet/lib/external/Google/Service/Resource.php CHANGED
@@ -99,17 +99,17 @@ class Forminator_Google_Service_Resource
99
  $method = $this->methods[$name];
100
  $parameters = $arguments[0];
101
 
102
- // postBody is a special case since it's not defined in the discovery
103
  // document as parameter, but we abuse the param entry for storing it.
104
  $postBody = null;
105
  if (isset($parameters['postBody'])) {
106
  if ($parameters['postBody'] instanceof Forminator_Google_Model) {
107
- // In the cases the post body is an existing object, we want
108
- // to use the smart method to create a simple object for
109
  // for JSONification.
110
  $parameters['postBody'] = $parameters['postBody']->toSimpleObject();
111
  } else if (is_object($parameters['postBody'])) {
112
- // If the post body is another kind of object, we will try and
113
  // wrangle it into a sensible format.
114
  $parameters['postBody'] =
115
  $this->convertToArrayAndStripNulls($parameters['postBody']);
@@ -121,7 +121,7 @@ class Forminator_Google_Service_Resource
121
  unset($parameters['postBody']);
122
  }
123
 
124
- // TODO: optParams here probably should have been
125
  // handled already - this may well be redundant code.
126
  if (isset($parameters['optParams'])) {
127
  $optParams = $parameters['optParams'];
99
  $method = $this->methods[$name];
100
  $parameters = $arguments[0];
101
 
102
+ // postBody is a special case since it's not defined in the discovery.
103
  // document as parameter, but we abuse the param entry for storing it.
104
  $postBody = null;
105
  if (isset($parameters['postBody'])) {
106
  if ($parameters['postBody'] instanceof Forminator_Google_Model) {
107
+ // In the cases the post body is an existing object, we want.
108
+ // to use the smart method to create a simple object for.
109
  // for JSONification.
110
  $parameters['postBody'] = $parameters['postBody']->toSimpleObject();
111
  } else if (is_object($parameters['postBody'])) {
112
+ // If the post body is another kind of object, we will try and.
113
  // wrangle it into a sensible format.
114
  $parameters['postBody'] =
115
  $this->convertToArrayAndStripNulls($parameters['postBody']);
121
  unset($parameters['postBody']);
122
  }
123
 
124
+ // TODO: optParams here probably should have been.
125
  // handled already - this may well be redundant code.
126
  if (isset($parameters['optParams'])) {
127
  $optParams = $parameters['optParams'];
addons/pro/googlesheet/lib/external/Google/Signer/P12.php CHANGED
@@ -28,7 +28,7 @@ if (!class_exists('Forminator_Google_Client')) {
28
  */
29
  class Forminator_Google_Signer_P12 extends Forminator_Google_Signer_Abstract
30
  {
31
- // OpenSSL private key resource
32
  private $privateKey;
33
 
34
  // Creates a new signer from a .p12 file.
@@ -40,16 +40,16 @@ class Forminator_Google_Signer_P12 extends Forminator_Google_Signer_Abstract
40
  );
41
  }
42
 
43
- // If the private key is provided directly, then this isn't in the p12
44
- // format. Different versions of openssl support different p12 formats
45
- // and the key from google wasn't being accepted by the version available
46
  // at the time.
47
  if (!$password && strpos($p12, "-----BEGIN RSA PRIVATE KEY-----") !== false) {
48
  $this->privateKey = openssl_pkey_get_private($p12);
49
  } elseif ($password === 'notasecret' && strpos($p12, "-----BEGIN PRIVATE KEY-----") !== false) {
50
  $this->privateKey = openssl_pkey_get_private($p12);
51
  } else {
52
- // This throws on error
53
  $certs = array();
54
  if (!openssl_pkcs12_read($p12, $certs, $password)) {
55
  throw new Forminator_Google_Auth_Exception(
@@ -58,7 +58,7 @@ class Forminator_Google_Signer_P12 extends Forminator_Google_Signer_Abstract
58
  openssl_error_string()
59
  );
60
  }
61
- // TODO(beaton): is this part of the contract for the openssl_pkcs12_read
62
  // method? What happens if there are multiple private keys? Do we care?
63
  if (!array_key_exists("pkey", $certs) || !$certs["pkey"]) {
64
  throw new Forminator_Google_Auth_Exception("No private key found in p12 file.");
28
  */
29
  class Forminator_Google_Signer_P12 extends Forminator_Google_Signer_Abstract
30
  {
31
+ // OpenSSL private key resource.
32
  private $privateKey;
33
 
34
  // Creates a new signer from a .p12 file.
40
  );
41
  }
42
 
43
+ // If the private key is provided directly, then this isn't in the p12.
44
+ // format. Different versions of openssl support different p12 formats.
45
+ // and the key from google wasn't being accepted by the version available.
46
  // at the time.
47
  if (!$password && strpos($p12, "-----BEGIN RSA PRIVATE KEY-----") !== false) {
48
  $this->privateKey = openssl_pkey_get_private($p12);
49
  } elseif ($password === 'notasecret' && strpos($p12, "-----BEGIN PRIVATE KEY-----") !== false) {
50
  $this->privateKey = openssl_pkey_get_private($p12);
51
  } else {
52
+ // This throws on error.
53
  $certs = array();
54
  if (!openssl_pkcs12_read($p12, $certs, $password)) {
55
  throw new Forminator_Google_Auth_Exception(
58
  openssl_error_string()
59
  );
60
  }
61
+ // TODO(beaton): is this part of the contract for the openssl_pkcs12_read.
62
  // method? What happens if there are multiple private keys? Do we care?
63
  if (!array_key_exists("pkey", $certs) || !$certs["pkey"]) {
64
  throw new Forminator_Google_Auth_Exception("No private key found in p12 file.");
addons/pro/googlesheet/lib/external/Google/Utils.php CHANGED
@@ -65,32 +65,32 @@ class Forminator_Google_Utils
65
  $ordinalValue = ord($str[$ret]);
66
  switch (true) {
67
  case (($ordinalValue >= 0x20) && ($ordinalValue <= 0x7F)):
68
- // characters U-00000000 - U-0000007F (same as ASCII)
69
  $ret ++;
70
  break;
71
  case (($ordinalValue & 0xE0) == 0xC0):
72
- // characters U-00000080 - U-000007FF, mask 110XXXXX
73
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
74
  $ret += 2;
75
  break;
76
  case (($ordinalValue & 0xF0) == 0xE0):
77
- // characters U-00000800 - U-0000FFFF, mask 1110XXXX
78
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
79
  $ret += 3;
80
  break;
81
  case (($ordinalValue & 0xF8) == 0xF0):
82
- // characters U-00010000 - U-001FFFFF, mask 11110XXX
83
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
84
  $ret += 4;
85
  break;
86
  case (($ordinalValue & 0xFC) == 0xF8):
87
- // characters U-00200000 - U-03FFFFFF, mask 111110XX
88
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
89
  $ret += 5;
90
  break;
91
  case (($ordinalValue & 0xFE) == 0xFC):
92
- // characters U-04000000 - U-7FFFFFFF, mask 1111110X
93
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
94
  $ret += 6;
95
  break;
96
  default:
65
  $ordinalValue = ord($str[$ret]);
66
  switch (true) {
67
  case (($ordinalValue >= 0x20) && ($ordinalValue <= 0x7F)):
68
+ // characters U-00000000 - U-0000007F (same as ASCII).
69
  $ret ++;
70
  break;
71
  case (($ordinalValue & 0xE0) == 0xC0):
72
+ // characters U-00000080 - U-000007FF, mask 110XXXXX.
73
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8.
74
  $ret += 2;
75
  break;
76
  case (($ordinalValue & 0xF0) == 0xE0):
77
+ // characters U-00000800 - U-0000FFFF, mask 1110XXXX.
78
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8.
79
  $ret += 3;
80
  break;
81
  case (($ordinalValue & 0xF8) == 0xF0):
82
+ // characters U-00010000 - U-001FFFFF, mask 11110XXX.
83
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8.
84
  $ret += 4;
85
  break;
86
  case (($ordinalValue & 0xFC) == 0xF8):
87
+ // characters U-00200000 - U-03FFFFFF, mask 111110XX.
88
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8.
89
  $ret += 5;
90
  break;
91
  case (($ordinalValue & 0xFE) == 0xFC):
92
+ // characters U-04000000 - U-7FFFFFFF, mask 1111110X.
93
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8.
94
  $ret += 6;
95
  break;
96
  default:
addons/pro/googlesheet/lib/external/Google/Utils/URITemplate.php CHANGED
@@ -85,7 +85,7 @@ class Forminator_Google_Utils_URITemplate
85
  // We know a data block will have {} round it, so we can strip that.
86
  $data = substr($string, $start + 1, $end - $start - 1);
87
 
88
- // If the first character is one of the reserved operators, it effects
89
  // the processing of the stream.
90
  if (isset($this->operators[$data[0]])) {
91
  $op = $this->operators[$data[0]];
@@ -95,7 +95,7 @@ class Forminator_Google_Utils_URITemplate
95
 
96
  switch ($op) {
97
  case "reserved":
98
- // Reserved means certain characters should not be URL encoded
99
  $data = $this->replaceVars($data, $parameters, ",", null, true);
100
  break;
101
  case "fragment":
@@ -116,12 +116,12 @@ class Forminator_Google_Utils_URITemplate
116
  $data = $this->replaceVars($data, $parameters, ".");
117
  break;
118
  case "semicolon":
119
- // Semicolon prefixed and separated. Uses the key name
120
  $prefix = ";";
121
  $data = $this->replaceVars($data, $parameters, ";", "=", false, true, false);
122
  break;
123
  case "form":
124
- // Standard URL format. Uses the key name
125
  $prefix = "?";
126
  $data = $this->replaceVars($data, $parameters, "&", "=");
127
  break;
@@ -167,7 +167,7 @@ class Forminator_Google_Utils_URITemplate
167
  );
168
  } else {
169
  // If we have multiple values, we need to split and loop over them.
170
- // Each is treated individually, then glued together with the
171
  // separator character.
172
  $vars = explode(",", $section);
173
  return $this->combineList(
@@ -176,7 +176,7 @@ class Forminator_Google_Utils_URITemplate
176
  $parameters,
177
  $combine,
178
  $reserved,
179
- false, // Never emit empty strings in multi-param replacements
180
  $combine_on_empty
181
  );
182
  }
@@ -262,7 +262,7 @@ class Forminator_Google_Utils_URITemplate
262
  $value = str_replace($this->reservedEncoded, $this->reserved, $value);
263
  }
264
 
265
- // If we do not need to include the key name, we just return the raw
266
  // value.
267
  if (!$combine || $skip_final_combine) {
268
  return $value;
85
  // We know a data block will have {} round it, so we can strip that.
86
  $data = substr($string, $start + 1, $end - $start - 1);
87
 
88
+ // If the first character is one of the reserved operators, it effects.
89
  // the processing of the stream.
90
  if (isset($this->operators[$data[0]])) {
91
  $op = $this->operators[$data[0]];
95
 
96
  switch ($op) {
97
  case "reserved":
98
+ // Reserved means certain characters should not be URL encoded.
99
  $data = $this->replaceVars($data, $parameters, ",", null, true);
100
  break;
101
  case "fragment":
116
  $data = $this->replaceVars($data, $parameters, ".");
117
  break;
118
  case "semicolon":
119
+ // Semicolon prefixed and separated. Uses the key name.
120
  $prefix = ";";
121
  $data = $this->replaceVars($data, $parameters, ";", "=", false, true, false);
122
  break;
123
  case "form":
124
+ // Standard URL format. Uses the key name.
125
  $prefix = "?";
126
  $data = $this->replaceVars($data, $parameters, "&", "=");
127
  break;
167
  );
168
  } else {
169
  // If we have multiple values, we need to split and loop over them.
170
+ // Each is treated individually, then glued together with the.
171
  // separator character.
172
  $vars = explode(",", $section);
173
  return $this->combineList(
176
  $parameters,
177
  $combine,
178
  $reserved,
179
+ false, // Never emit empty strings in multi-param replacements.
180
  $combine_on_empty
181
  );
182
  }
262
  $value = str_replace($this->reservedEncoded, $this->reserved, $value);
263
  }
264
 
265
+ // If we do not need to include the key name, we just return the raw.
266
  // value.
267
  if (!$combine || $skip_final_combine) {
268
  return $value;
addons/pro/googlesheet/views/form-settings/pick-name.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
addons/pro/googlesheet/views/form-settings/setup-sheet.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // Defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'folder_id' => '',
1
  <?php
2
+ // Defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'folder_id' => '',
addons/pro/googlesheet/views/poll-settings/pick-name.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
addons/pro/googlesheet/views/poll-settings/setup-sheet.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // Defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'folder_id' => '',
1
  <?php
2
+ // Defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'folder_id' => '',
addons/pro/googlesheet/views/quiz-settings/pick-name.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
addons/pro/googlesheet/views/quiz-settings/setup-sheet.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // Defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'folder_id' => '',
1
  <?php
2
+ // Defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'folder_id' => '',
addons/pro/googlesheet/views/sections/authorize.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // Defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'is_close' => false,
1
  <?php
2
+ // Defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'is_close' => false,
addons/pro/googlesheet/views/settings/authorize.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // Defaults
3
  $vars = array(
4
  'auth_url' => '',
5
  'token' => '',
1
  <?php
2
+ // Defaults.
3
  $vars = array(
4
  'auth_url' => '',
5
  'token' => '',
addons/pro/googlesheet/views/settings/setup-client.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // Defaults
3
  $vars = array(
4
  'token' => '',
5
  'error_message' => '',
1
  <?php
2
+ // Defaults.
3
  $vars = array(
4
  'token' => '',
5
  'error_message' => '',
addons/pro/googlesheet/views/settings/wait-authorize.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'auth_url' => '',
5
  'token' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'auth_url' => '',
5
  'token' => '',
addons/pro/gutenberg/gutenberg.php CHANGED
@@ -11,7 +11,7 @@
11
 
12
  define( 'FORMINATOR_ADDON_GUTENBERG_VERSION', '1.0' );
13
 
14
- // Load Gutenberg module after Forminator loaded
15
  add_action( 'init', array( 'Forminator_Gutenberg', 'init' ), 5 );
16
 
17
  class Forminator_Gutenberg {
@@ -40,10 +40,10 @@ class Forminator_Gutenberg {
40
  * @since 1.0 Gutenberg Addon
41
  */
42
  public static function init() {
43
- // Load abstracts
44
  require_once dirname( __FILE__ ) . '/library/class-forminator-gfblock-abstract.php';
45
 
46
- // Load blocks
47
  self::load_blocks();
48
  }
49
 
@@ -53,7 +53,7 @@ class Forminator_Gutenberg {
53
  * @since 1.0 Gutenberg Addon
54
  */
55
  public static function load_blocks() {
56
- // Load blocks automatically
57
  foreach ( glob( plugin_dir_path( __FILE__ ) . 'library/blocks/class-forminator-gfblock-*.php' ) as $file ) {
58
  require_once $file;
59
  }
11
 
12
  define( 'FORMINATOR_ADDON_GUTENBERG_VERSION', '1.0' );
13
 
14
+ // Load Gutenberg module after Forminator loaded.
15
  add_action( 'init', array( 'Forminator_Gutenberg', 'init' ), 5 );
16
 
17
  class Forminator_Gutenberg {
40
  * @since 1.0 Gutenberg Addon
41
  */
42
  public static function init() {
43
+ // Load abstracts.
44
  require_once dirname( __FILE__ ) . '/library/class-forminator-gfblock-abstract.php';
45
 
46
+ // Load blocks.
47
  self::load_blocks();
48
  }
49
 
53
  * @since 1.0 Gutenberg Addon
54
  */
55
  public static function load_blocks() {
56
+ // Load blocks automatically.
57
  foreach ( glob( plugin_dir_path( __FILE__ ) . 'library/blocks/class-forminator-gfblock-*.php' ) as $file ) {
58
  require_once $file;
59
  }
addons/pro/gutenberg/library/blocks/class-forminator-gfblock-forms.php CHANGED
@@ -41,7 +41,7 @@ class Forminator_GFBlock_Forms extends Forminator_GFBlock_Abstract {
41
  * @since 1.0 Gutenberg Addon
42
  */
43
  public function __construct() {
44
- // Initialize block
45
  $this->init();
46
  }
47
 
@@ -49,7 +49,7 @@ class Forminator_GFBlock_Forms extends Forminator_GFBlock_Abstract {
49
  * Render block markup on front-end
50
  *
51
  * @since 1.0 Gutenberg Addon
52
- * @param array $properties Block properties
53
  *
54
  * @return string
55
  */
@@ -61,7 +61,7 @@ class Forminator_GFBlock_Forms extends Forminator_GFBlock_Abstract {
61
  * Preview form markup in block
62
  *
63
  * @since 1.0 Gutenberg Addon
64
- * @param array $properties Block properties
65
  *
66
  * @return string
67
  */
@@ -82,7 +82,7 @@ class Forminator_GFBlock_Forms extends Forminator_GFBlock_Abstract {
82
  * @since 1.0 Gutenberg Addon
83
  */
84
  public function load_assets() {
85
- // Scripts
86
  wp_enqueue_script(
87
  'forminator-block-forms',
88
  forminator_gutenberg()->get_plugin_url() . '/js/forms-block.min.js',
@@ -91,7 +91,7 @@ class Forminator_GFBlock_Forms extends Forminator_GFBlock_Abstract {
91
  false
92
  );
93
 
94
- // Localize scripts
95
  wp_localize_script(
96
  'forminator-block-forms',
97
  'frmnt_form_data',
@@ -135,8 +135,8 @@ class Forminator_GFBlock_Forms extends Forminator_GFBlock_Abstract {
135
 
136
  $script_src = forminator_plugin_url() . 'assets/js/library/intlTelInput.min.js';
137
  $script_version = FORMINATOR_VERSION;
138
- wp_enqueue_style( 'intlTelInput-forminator-css', $style_src, array(), $style_version ); // intlTelInput
139
- wp_enqueue_script( 'forminator-intlTelInput', $script_src, array( 'jquery' ), $script_version, false ); // intlTelInput
140
 
141
  wp_localize_script( 'forminator-front-scripts', 'ForminatorFront', forminator_localize_data() );
142
  }
41
  * @since 1.0 Gutenberg Addon
42
  */
43
  public function __construct() {
44
+ // Initialize block.
45
  $this->init();
46
  }
47
 
49
  * Render block markup on front-end
50
  *
51
  * @since 1.0 Gutenberg Addon
52
+ * @param array $properties Block properties.
53
  *
54
  * @return string
55
  */
61
  * Preview form markup in block
62
  *
63
  * @since 1.0 Gutenberg Addon
64
+ * @param array $properties Block properties.
65
  *
66
  * @return string
67
  */
82
  * @since 1.0 Gutenberg Addon
83
  */
84
  public function load_assets() {
85
+ // Scripts.
86
  wp_enqueue_script(
87
  'forminator-block-forms',
88
  forminator_gutenberg()->get_plugin_url() . '/js/forms-block.min.js',
91
  false
92
  );
93
 
94
+ // Localize scripts.
95
  wp_localize_script(
96
  'forminator-block-forms',
97
  'frmnt_form_data',
135
 
136
  $script_src = forminator_plugin_url() . 'assets/js/library/intlTelInput.min.js';
137
  $script_version = FORMINATOR_VERSION;
138
+ wp_enqueue_style( 'intlTelInput-forminator-css', $style_src, array(), $style_version ); // intlTelInput.
139
+ wp_enqueue_script( 'forminator-intlTelInput', $script_src, array( 'jquery' ), $script_version, false ); // intlTelInput.
140
 
141
  wp_localize_script( 'forminator-front-scripts', 'ForminatorFront', forminator_localize_data() );
142
  }
addons/pro/gutenberg/library/blocks/class-forminator-gfblock-polls.php CHANGED
@@ -41,7 +41,7 @@ class Forminator_GFBlock_Polls extends Forminator_GFBlock_Abstract {
41
  * @since 1.0 Gutenberg Addon
42
  */
43
  public function __construct() {
44
- // Initialize block
45
  $this->init();
46
  }
47
 
@@ -49,7 +49,7 @@ class Forminator_GFBlock_Polls extends Forminator_GFBlock_Abstract {
49
  * Render block markup on front-end
50
  *
51
  * @since 1.0 Gutenberg Addon
52
- * @param array $properties Block properties
53
  *
54
  * @return string
55
  */
@@ -61,7 +61,7 @@ class Forminator_GFBlock_Polls extends Forminator_GFBlock_Abstract {
61
  * Preview form markup in block
62
  *
63
  * @since 1.0 Gutenberg Addon
64
- * @param array $properties Block properties
65
  *
66
  * @return string
67
  */
@@ -80,7 +80,7 @@ class Forminator_GFBlock_Polls extends Forminator_GFBlock_Abstract {
80
  * @since 1.0 Gutenberg Addon
81
  */
82
  public function load_assets() {
83
- // Scripts
84
  wp_enqueue_script(
85
  'forminator-block-polls',
86
  forminator_gutenberg()->get_plugin_url() . '/js/polls-block.min.js',
@@ -89,7 +89,7 @@ class Forminator_GFBlock_Polls extends Forminator_GFBlock_Abstract {
89
  false
90
  );
91
 
92
- // Localize scripts
93
  wp_localize_script(
94
  'forminator-block-polls',
95
  'frmnt_poll_data',
41
  * @since 1.0 Gutenberg Addon
42
  */
43
  public function __construct() {
44
+ // Initialize block.
45
  $this->init();
46
  }
47
 
49
  * Render block markup on front-end
50
  *
51
  * @since 1.0 Gutenberg Addon
52
+ * @param array $properties Block properties.
53
  *
54
  * @return string
55
  */
61
  * Preview form markup in block
62
  *
63
  * @since 1.0 Gutenberg Addon
64
+ * @param array $properties Block properties.
65
  *
66
  * @return string
67
  */
80
  * @since 1.0 Gutenberg Addon
81
  */
82
  public function load_assets() {
83
+ // Scripts.
84
  wp_enqueue_script(
85
  'forminator-block-polls',
86
  forminator_gutenberg()->get_plugin_url() . '/js/polls-block.min.js',
89
  false
90
  );
91
 
92
+ // Localize scripts.
93
  wp_localize_script(
94
  'forminator-block-polls',
95
  'frmnt_poll_data',
addons/pro/gutenberg/library/blocks/class-forminator-gfblock-quizzes.php CHANGED
@@ -41,7 +41,7 @@ class Forminator_GFBlock_Quizzes extends Forminator_GFBlock_Abstract {
41
  * @since 1.0 Gutenberg Addon
42
  */
43
  public function __construct() {
44
- // Initialize block
45
  $this->init();
46
  }
47
 
@@ -49,7 +49,7 @@ class Forminator_GFBlock_Quizzes extends Forminator_GFBlock_Abstract {
49
  * Render block markup on front-end
50
  *
51
  * @since 1.0 Gutenberg Addon
52
- * @param array $properties Block properties
53
  *
54
  * @return string
55
  */
@@ -61,7 +61,7 @@ class Forminator_GFBlock_Quizzes extends Forminator_GFBlock_Abstract {
61
  * Preview form markup in block
62
  *
63
  * @since 1.0 Gutenberg Addon
64
- * @param array $properties Block properties
65
  *
66
  * @return string
67
  */
@@ -80,7 +80,7 @@ class Forminator_GFBlock_Quizzes extends Forminator_GFBlock_Abstract {
80
  * @since 1.0 Gutenberg Addon
81
  */
82
  public function load_assets() {
83
- // Scripts
84
  wp_enqueue_script(
85
  'forminator-block-quizzes',
86
  forminator_gutenberg()->get_plugin_url() . '/js/quizzes-block.min.js',
@@ -89,7 +89,7 @@ class Forminator_GFBlock_Quizzes extends Forminator_GFBlock_Abstract {
89
  false
90
  );
91
 
92
- // Localize scripts
93
  wp_localize_script(
94
  'forminator-block-quizzes',
95
  'frmnt_quiz_data',
@@ -111,16 +111,16 @@ class Forminator_GFBlock_Quizzes extends Forminator_GFBlock_Abstract {
111
  * @param WP_REST_Request $data
112
  */
113
  public function preview_block_markup( $data ) {
114
- // Get properties
115
  $properties = $data->get_params();
116
 
117
- // Get module ID
118
  $id = isset( $properties['module_id'] ) ? $properties['module_id'] : false;
119
 
120
- // Get block preview markup
121
  $markup = $this->preview_block( $properties );
122
 
123
- // Get quiz
124
  $quiz = Forminator_API::get_module( $id );
125
 
126
  if ( $markup ) {
41
  * @since 1.0 Gutenberg Addon
42
  */
43
  public function __construct() {
44
+ // Initialize block.
45
  $this->init();
46
  }
47
 
49
  * Render block markup on front-end
50
  *
51
  * @since 1.0 Gutenberg Addon
52
+ * @param array $properties Block properties.
53
  *
54
  * @return string
55
  */
61
  * Preview form markup in block
62
  *
63
  * @since 1.0 Gutenberg Addon
64
+ * @param array $properties Block properties.
65
  *
66
  * @return string
67
  */
80
  * @since 1.0 Gutenberg Addon
81
  */
82
  public function load_assets() {
83
+ // Scripts.
84
  wp_enqueue_script(
85
  'forminator-block-quizzes',
86
  forminator_gutenberg()->get_plugin_url() . '/js/quizzes-block.min.js',
89
  false
90
  );
91
 
92
+ // Localize scripts.
93
  wp_localize_script(
94
  'forminator-block-quizzes',
95
  'frmnt_quiz_data',
111
  * @param WP_REST_Request $data
112
  */
113
  public function preview_block_markup( $data ) {
114
+ // Get properties.
115
  $properties = $data->get_params();
116
 
117
+ // Get module ID.
118
  $id = isset( $properties['module_id'] ) ? $properties['module_id'] : false;
119
 
120
+ // Get block preview markup.
121
  $markup = $this->preview_block( $properties );
122
 
123
+ // Get quiz.
124
  $quiz = Forminator_API::get_module( $id );
125
 
126
  if ( $markup ) {
addons/pro/gutenberg/library/class-forminator-gfblock-abstract.php CHANGED
@@ -33,13 +33,13 @@ abstract class Forminator_GFBlock_Abstract {
33
  * @since 1.0 Gutenberg Addon
34
  */
35
  public function init() {
36
- // Register block
37
  add_action( 'init', array( $this, 'register_block' ), 5 );
38
 
39
- // Register preview REST API
40
  add_action( 'rest_api_init', array( $this, 'block_preview_api' ) );
41
 
42
- // Load block scripts
43
  add_action( 'enqueue_block_editor_assets', array( $this, 'load_assets' ) );
44
  }
45
 
@@ -91,13 +91,13 @@ abstract class Forminator_GFBlock_Abstract {
91
  * @param $data
92
  */
93
  public function preview_block_markup( $data ) {
94
- // Get properties
95
  $properties = $data->get_params();
96
 
97
- // Get module ID
98
  $id = isset( $properties['module_id'] ) ? $properties['module_id'] : false;
99
 
100
- // Get block preview markup
101
  $markup = $this->preview_block( $properties );
102
 
103
  if ( $markup ) {
@@ -112,7 +112,7 @@ abstract class Forminator_GFBlock_Abstract {
112
  * Should be overriden in block class
113
  *
114
  * @since 1.0 Gutenberg Addon
115
- * @param array $properties Block properties
116
  *
117
  * @return string
118
  */
@@ -125,7 +125,7 @@ abstract class Forminator_GFBlock_Abstract {
125
  * Should be overriden in block class
126
  *
127
  * @since 1.0 Gutenberg Addon
128
- * @param array $properties Block properties
129
  *
130
  * @return string
131
  */
33
  * @since 1.0 Gutenberg Addon
34
  */
35
  public function init() {
36
+ // Register block.
37
  add_action( 'init', array( $this, 'register_block' ), 5 );
38
 
39
+ // Register preview REST API.
40
  add_action( 'rest_api_init', array( $this, 'block_preview_api' ) );
41
 
42
+ // Load block scripts.
43
  add_action( 'enqueue_block_editor_assets', array( $this, 'load_assets' ) );
44
  }
45
 
91
  * @param $data
92
  */
93
  public function preview_block_markup( $data ) {
94
+ // Get properties.
95
  $properties = $data->get_params();
96
 
97
+ // Get module ID.
98
  $id = isset( $properties['module_id'] ) ? $properties['module_id'] : false;
99
 
100
+ // Get block preview markup.
101
  $markup = $this->preview_block( $properties );
102
 
103
  if ( $markup ) {
112
  * Should be overriden in block class
113
  *
114
  * @since 1.0 Gutenberg Addon
115
+ * @param array $properties Block properties.
116
  *
117
  * @return string
118
  */
125
  * Should be overriden in block class
126
  *
127
  * @since 1.0 Gutenberg Addon
128
+ * @param array $properties Block properties.
129
  *
130
  * @return string
131
  */
addons/pro/hubspot/class-forminator-addon-hubspot-form-hooks.php CHANGED
@@ -63,8 +63,8 @@ class Forminator_Addon_Hubspot_Form_Hooks extends Forminator_Addon_Form_Hooks_Ab
63
  * @since 1.4
64
  *
65
  * @param array $submitted_data
66
- * @param int $form_id current Form ID
67
- * @param Forminator_Addon_Hubspot_Form_Settings $form_settings_instance HubSpot Addon Form Settings instance
68
  */
69
  $submitted_data = apply_filters(
70
  'forminator_addon_hubspot_form_submitted_data',
@@ -82,16 +82,16 @@ class Forminator_Addon_Hubspot_Form_Hooks extends Forminator_Addon_Form_Hooks_Ab
82
  *
83
  * @since 1.4
84
  *
85
- * @param int $form_id current Form ID
86
  * @param array $submitted_data
87
- * @param Forminator_Addon_Hubspot_Form_Settings $form_settings_instance HubSpot Addon Form Settings instance
88
  */
89
  do_action( 'forminator_addon_hubspot_before_send_message', $form_id, $submitted_data, $form_settings_instance );
90
 
91
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
92
- // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to hubspot
93
  if ( $form_settings_instance->is_multi_form_settings_complete( $key ) ) {
94
- // exec only on completed connection
95
  $data[] = array(
96
  'name' => 'status-' . $key,
97
  'value' => $this->get_status_on_contact_sync( $key, $submitted_data, $addon_setting_value, $form_entry_fields ),
@@ -106,9 +106,9 @@ class Forminator_Addon_Hubspot_Form_Hooks extends Forminator_Addon_Form_Hooks_Ab
106
  * @since 1.4
107
  *
108
  * @param array $entry_fields
109
- * @param int $form_id current Form ID
110
  * @param array $submitted_data
111
- * @param Forminator_Addon_Hubspot_Form_Settings $form_settings_instance HubSpot Addon Form Settings instance
112
  */
113
  $data = apply_filters(
114
  'forminator_addon_hubspot_entry_fields',
@@ -135,7 +135,7 @@ class Forminator_Addon_Hubspot_Form_Hooks extends Forminator_Addon_Form_Hooks_Ab
135
  * @return array `is_sent` true means its success send data to HubSpot, false otherwise
136
  */
137
  private function get_status_on_contact_sync( $connection_id, $submitted_data, $connection_settings, $form_entry_fields ) {
138
- // initialize as null
139
  $api = null;
140
 
141
  $form_id = $this->form_id;
@@ -166,7 +166,7 @@ class Forminator_Addon_Hubspot_Form_Hooks extends Forminator_Addon_Form_Hooks_Ab
166
  $email = strtolower( trim( $email ) );
167
  $args['email'] = $email;
168
 
169
- // processed
170
  unset( $fields_map['email'] );
171
  $common_fields = array(
172
  'firstname',
@@ -183,7 +183,7 @@ class Forminator_Addon_Hubspot_Form_Hooks extends Forminator_Addon_Form_Hooks_Ab
183
  }
184
  $common_fields = array_merge( $common_fields, $extra_field );
185
  foreach ( $common_fields as $common_field ) {
186
- // not setup
187
  if ( ! isset( $fields_map[ $common_field ] ) ) {
188
  continue;
189
  }
@@ -205,10 +205,10 @@ class Forminator_Addon_Hubspot_Form_Hooks extends Forminator_Addon_Form_Hooks_Ab
205
  }
206
  if ( isset( $element_value ) ) {
207
  $args[ $common_field ] = $element_value;
208
- unset( $element_value ); // unset for next loop
209
  }
210
  }
211
- // processed
212
  unset( $fields_map[ $common_field ] );
213
  }
214
  /**
@@ -217,12 +217,12 @@ class Forminator_Addon_Hubspot_Form_Hooks extends Forminator_Addon_Form_Hooks_Ab
217
  * @since 1.2
218
  *
219
  * @param array $args
220
- * @param int $form_id Current Form id
221
- * @param string $connection_id ID of current connection
222
  * @param array $submitted_data
223
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
224
- * @param array $form_settings Displayed Form settings
225
- * @param Forminator_Addon_Hubspot_Form_Settings $form_settings_instance HubSpot Addon Form Settings instance
226
  */
227
  $args = apply_filters(
228
  'forminator_addon_hubspot_create_contact_args',
@@ -235,7 +235,7 @@ class Forminator_Addon_Hubspot_Form_Hooks extends Forminator_Addon_Form_Hooks_Ab
235
  $form_settings_instance
236
  );
237
  $contact_id = $api->add_update_contact( $args );
238
- // Add contact to contact list
239
  $toObjectId = null;
240
  if ( ! empty( $list_id ) && ! empty( $contact_id ) && ! is_object( $contact_id ) && (int) $contact_id > 0 ) {
241
  $toObjectId = $contact_id;
@@ -335,8 +335,8 @@ class Forminator_Addon_Hubspot_Form_Hooks extends Forminator_Addon_Form_Hooks_Ab
335
  * @since 1.4
336
  *
337
  * @param array $addon_meta_data
338
- * @param int $form_id current Form ID
339
- * @param Forminator_Addon_Hubspot_Form_Settings $form_settings_instance HubSpot Addon Form Settings instance
340
  */
341
  $addon_meta_data = apply_filters(
342
  'forminator_addon_hubspot_metadata',
@@ -424,7 +424,7 @@ class Forminator_Addon_Hubspot_Form_Hooks extends Forminator_Addon_Form_Hooks_Ab
424
  }
425
 
426
  if ( Forminator_Addon_Hubspot::is_show_full_log() ) {
427
- // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_HUBSPOT_SHOW_FULL_LOG', true)`
428
  if ( isset( $status['url_request'] ) ) {
429
  $sub_entries[] = array(
430
  'label' => __( 'API URL', 'forminator' ),
@@ -449,7 +449,7 @@ class Forminator_Addon_Hubspot_Form_Hooks extends Forminator_Addon_Form_Hooks_Ab
449
 
450
  $additional_entry_item['sub_entries'] = $sub_entries;
451
 
452
- // return single array
453
  return $additional_entry_item;
454
  }
455
 
@@ -474,9 +474,9 @@ class Forminator_Addon_Hubspot_Form_Hooks extends Forminator_Addon_Form_Hooks_Ab
474
  *
475
  * @since 1.2
476
  *
477
- * @param array $export_headers headers to be displayed on export file
478
- * @param int $form_id current Form ID
479
- * @param Forminator_Addon_Hubspot_Form_Settings $form_settings_instance HubSpot Addon Form Settings instance
480
  */
481
  $export_headers = apply_filters(
482
  'forminator_addon_hubspot_export_headers',
@@ -511,8 +511,8 @@ class Forminator_Addon_Hubspot_Form_Hooks extends Forminator_Addon_Form_Hooks_Ab
511
  * @since 1.4
512
  *
513
  * @param array $addon_meta_data
514
- * @param int $form_id current Form ID
515
- * @param Forminator_Addon_Hubspot_Form_Settings $form_settings_instance HubSpot Addon Form Settings instance
516
  */
517
  $addon_meta_data = apply_filters(
518
  'forminator_addon_hubspot_metadata',
@@ -530,11 +530,11 @@ class Forminator_Addon_Hubspot_Form_Hooks extends Forminator_Addon_Form_Hooks_Ab
530
  *
531
  * @since 1.4
532
  *
533
- * @param array $export_columns column to be exported
534
- * @param int $form_id current Form ID
535
- * @param Forminator_Form_Entry_Model $entry_model Form Entry Model
536
- * @param array $addon_meta_data meta data saved by addon on entry fields
537
- * @param Forminator_Addon_Hubspot_Form_Settings $form_settings_instance HubSpot Addon Form Settings instance
538
  */
539
  $export_columns = apply_filters(
540
  'forminator_addon_hubspot_export_columns',
@@ -567,15 +567,15 @@ class Forminator_Addon_Hubspot_Form_Hooks extends Forminator_Addon_Form_Hooks_Ab
567
 
568
  $addon_meta_data = $addon_meta_data[0];
569
 
570
- // make sure its `status`, because we only add this
571
  if ( 'status' !== $addon_meta_data['name'] ) {
572
  if ( stripos( $addon_meta_data['name'], 'status-' ) === 0 ) {
573
  $meta_data = array();
574
  foreach ( $addon_meta_datas as $addon_meta_data ) {
575
- // make it like single value so it will be processed like single meta data
576
  $addon_meta_data['name'] = 'status';
577
 
578
- // add it on an array for next recursive process
579
  $meta_data[] = $this->get_from_addon_meta_data( array( $addon_meta_data ), $key, $default );
580
  }
581
 
@@ -615,7 +615,7 @@ class Forminator_Addon_Hubspot_Form_Hooks extends Forminator_Addon_Form_Hooks_Ab
615
  * @return bool
616
  */
617
  public function on_before_delete_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {
618
- // attach hook first
619
  $form_id = $this->form_id;
620
  $form_settings_instance = $this->form_settings_instance;
621
 
@@ -626,9 +626,9 @@ class Forminator_Addon_Hubspot_Form_Hooks extends Forminator_Addon_Form_Hooks_Ab
626
  * @since 1.4
627
  *
628
  * @param array $addon_meta_data
629
- * @param int $form_id current Form ID
630
- * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model
631
- * @param Forminator_Addon_Hubspot_Form_Settings $form_settings_instance HubSpot Addon Form Settings instance
632
  */
633
  $addon_meta_data = apply_filters(
634
  'forminator_addon_hubspot_metadata',
@@ -643,10 +643,10 @@ class Forminator_Addon_Hubspot_Form_Hooks extends Forminator_Addon_Form_Hooks_Ab
643
  *
644
  * @since 1.1
645
  *
646
- * @param int $form_id current Form ID
647
- * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model
648
- * @param array $addon_meta_data addon meta data
649
- * @param Forminator_Addon_Hubspot_Form_Settings $form_settings_instance HubSpot Addon Form Settings instance
650
  */
651
  do_action(
652
  'forminator_addon_hubspot_on_before_delete_submission',
@@ -717,10 +717,10 @@ class Forminator_Addon_Hubspot_Form_Hooks extends Forminator_Addon_Form_Hooks_Ab
717
  return true;
718
 
719
  } catch ( Forminator_Addon_Hubspot_Exception $e ) {
720
- // use wp_error, for future usage it can be returned to page entries
721
  $wp_error
722
  = new WP_Error( 'forminator_addon_hubspot_delete_contact', $e->getMessage() );
723
- // handle this in addon by self, since page entries cant handle error messages on delete yet
724
  wp_die(
725
  esc_html( $wp_error->get_error_message() ),
726
  esc_html( $this->addon->get_title() ),
63
  * @since 1.4
64
  *
65
  * @param array $submitted_data
66
+ * @param int $form_id current Form ID.
67
+ * @param Forminator_Addon_Hubspot_Form_Settings $form_settings_instance HubSpot Addon Form Settings instance.
68
  */
69
  $submitted_data = apply_filters(
70
  'forminator_addon_hubspot_form_submitted_data',
82
  *
83
  * @since 1.4
84
  *
85
+ * @param int $form_id current Form ID.
86
  * @param array $submitted_data
87
+ * @param Forminator_Addon_Hubspot_Form_Settings $form_settings_instance HubSpot Addon Form Settings instance.
88
  */
89
  do_action( 'forminator_addon_hubspot_before_send_message', $form_id, $submitted_data, $form_settings_instance );
90
 
91
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
92
+ // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to hubspot.
93
  if ( $form_settings_instance->is_multi_form_settings_complete( $key ) ) {
94
+ // exec only on completed connection.
95
  $data[] = array(
96
  'name' => 'status-' . $key,
97
  'value' => $this->get_status_on_contact_sync( $key, $submitted_data, $addon_setting_value, $form_entry_fields ),
106
  * @since 1.4
107
  *
108
  * @param array $entry_fields
109
+ * @param int $form_id current Form ID.
110
  * @param array $submitted_data
111
+ * @param Forminator_Addon_Hubspot_Form_Settings $form_settings_instance HubSpot Addon Form Settings instance.
112
  */
113
  $data = apply_filters(
114
  'forminator_addon_hubspot_entry_fields',
135
  * @return array `is_sent` true means its success send data to HubSpot, false otherwise
136
  */
137
  private function get_status_on_contact_sync( $connection_id, $submitted_data, $connection_settings, $form_entry_fields ) {
138
+ // initialize as null.
139
  $api = null;
140
 
141
  $form_id = $this->form_id;
166
  $email = strtolower( trim( $email ) );
167
  $args['email'] = $email;
168
 
169
+ // processed.
170
  unset( $fields_map['email'] );
171
  $common_fields = array(
172
  'firstname',
183
  }
184
  $common_fields = array_merge( $common_fields, $extra_field );
185
  foreach ( $common_fields as $common_field ) {
186
+ // not setup.
187
  if ( ! isset( $fields_map[ $common_field ] ) ) {
188
  continue;
189
  }
205
  }
206
  if ( isset( $element_value ) ) {
207
  $args[ $common_field ] = $element_value;
208
+ unset( $element_value ); // unset for next loop.
209
  }
210
  }
211
+ // processed.
212
  unset( $fields_map[ $common_field ] );
213
  }
214
  /**
217
  * @since 1.2
218
  *
219
  * @param array $args
220
+ * @param int $form_id Current Form id.
221
+ * @param string $connection_id ID of current connection.
222
  * @param array $submitted_data
223
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
224
+ * @param array $form_settings Displayed Form settings.
225
+ * @param Forminator_Addon_Hubspot_Form_Settings $form_settings_instance HubSpot Addon Form Settings instance.
226
  */
227
  $args = apply_filters(
228
  'forminator_addon_hubspot_create_contact_args',
235
  $form_settings_instance
236
  );
237
  $contact_id = $api->add_update_contact( $args );
238
+ // Add contact to contact list.
239
  $toObjectId = null;
240
  if ( ! empty( $list_id ) && ! empty( $contact_id ) && ! is_object( $contact_id ) && (int) $contact_id > 0 ) {
241
  $toObjectId = $contact_id;
335
  * @since 1.4
336
  *
337
  * @param array $addon_meta_data
338
+ * @param int $form_id current Form ID.
339
+ * @param Forminator_Addon_Hubspot_Form_Settings $form_settings_instance HubSpot Addon Form Settings instance.
340
  */
341
  $addon_meta_data = apply_filters(
342
  'forminator_addon_hubspot_metadata',
424
  }
425
 
426
  if ( Forminator_Addon_Hubspot::is_show_full_log() ) {
427
+ // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_HUBSPOT_SHOW_FULL_LOG', true)`.
428
  if ( isset( $status['url_request'] ) ) {
429
  $sub_entries[] = array(
430
  'label' => __( 'API URL', 'forminator' ),
449
 
450
  $additional_entry_item['sub_entries'] = $sub_entries;
451
 
452
+ // return single array.
453
  return $additional_entry_item;
454
  }
455
 
474
  *
475
  * @since 1.2
476
  *
477
+ * @param array $export_headers headers to be displayed on export file.
478
+ * @param int $form_id current Form ID.
479
+ * @param Forminator_Addon_Hubspot_Form_Settings $form_settings_instance HubSpot Addon Form Settings instance.
480
  */
481
  $export_headers = apply_filters(
482
  'forminator_addon_hubspot_export_headers',
511
  * @since 1.4
512
  *
513
  * @param array $addon_meta_data
514
+ * @param int $form_id current Form ID.
515
+ * @param Forminator_Addon_Hubspot_Form_Settings $form_settings_instance HubSpot Addon Form Settings instance.
516
  */
517
  $addon_meta_data = apply_filters(
518
  'forminator_addon_hubspot_metadata',
530
  *
531
  * @since 1.4
532
  *
533
+ * @param array $export_columns column to be exported.
534
+ * @param int $form_id current Form ID.
535
+ * @param Forminator_Form_Entry_Model $entry_model Form Entry Model.
536
+ * @param array $addon_meta_data meta data saved by addon on entry fields.
537
+ * @param Forminator_Addon_Hubspot_Form_Settings $form_settings_instance HubSpot Addon Form Settings instance.
538
  */
539
  $export_columns = apply_filters(
540
  'forminator_addon_hubspot_export_columns',
567
 
568
  $addon_meta_data = $addon_meta_data[0];
569
 
570
+ // make sure its `status`, because we only add this.
571
  if ( 'status' !== $addon_meta_data['name'] ) {
572
  if ( stripos( $addon_meta_data['name'], 'status-' ) === 0 ) {
573
  $meta_data = array();
574
  foreach ( $addon_meta_datas as $addon_meta_data ) {
575
+ // make it like single value so it will be processed like single meta data.
576
  $addon_meta_data['name'] = 'status';
577
 
578
+ // add it on an array for next recursive process.
579
  $meta_data[] = $this->get_from_addon_meta_data( array( $addon_meta_data ), $key, $default );
580
  }
581
 
615
  * @return bool
616
  */
617
  public function on_before_delete_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {
618
+ // attach hook first.
619
  $form_id = $this->form_id;
620
  $form_settings_instance = $this->form_settings_instance;
621
 
626
  * @since 1.4
627
  *
628
  * @param array $addon_meta_data
629
+ * @param int $form_id current Form ID.
630
+ * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model.
631
+ * @param Forminator_Addon_Hubspot_Form_Settings $form_settings_instance HubSpot Addon Form Settings instance.
632
  */
633
  $addon_meta_data = apply_filters(
634
  'forminator_addon_hubspot_metadata',
643
  *
644
  * @since 1.1
645
  *
646
+ * @param int $form_id current Form ID.
647
+ * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model.
648
+ * @param array $addon_meta_data addon meta data.
649
+ * @param Forminator_Addon_Hubspot_Form_Settings $form_settings_instance HubSpot Addon Form Settings instance.
650
  */
651
  do_action(
652
  'forminator_addon_hubspot_on_before_delete_submission',
717
  return true;
718
 
719
  } catch ( Forminator_Addon_Hubspot_Exception $e ) {
720
+ // use wp_error, for future usage it can be returned to page entries.
721
  $wp_error
722
  = new WP_Error( 'forminator_addon_hubspot_delete_contact', $e->getMessage() );
723
+ // handle this in addon by self, since page entries cant handle error messages on delete yet.
724
  wp_die(
725
  esc_html( $wp_error->get_error_message() ),
726
  esc_html( $this->addon->get_title() ),
addons/pro/hubspot/class-forminator-addon-hubspot-form-settings.php CHANGED
@@ -44,7 +44,7 @@ class Forminator_Addon_Hubspot_Form_Settings extends Forminator_Addon_Form_Setti
44
  * @return array
45
  */
46
  public function form_settings_wizards() {
47
- // numerical array steps
48
  return array(
49
  array(
50
  'callback' => array( $this, 'map_fields' ),
@@ -81,7 +81,7 @@ class Forminator_Addon_Hubspot_Form_Settings extends Forminator_Addon_Form_Setti
81
  $email_fields = array();
82
  $forminator_field_element_ids = array();
83
  foreach ( $this->form_fields as $form_field ) {
84
- // collect element ids
85
  $forminator_field_element_ids[] = $form_field['element_id'];
86
  if ( 'email' === $form_field['type'] ) {
87
  $email_fields[] = $form_field;
@@ -268,7 +268,7 @@ class Forminator_Addon_Hubspot_Form_Settings extends Forminator_Addon_Form_Setti
268
  $file_fields = array();
269
  $forminator_field_element_ids = array();
270
  foreach ( $this->form_fields as $form_field ) {
271
- // collect element ids
272
  $forminator_field_element_ids[] = $form_field['element_id'];
273
  if ( 'upload' === $form_field['type'] ) {
274
  $file_fields[] = $form_field;
@@ -531,7 +531,7 @@ class Forminator_Addon_Hubspot_Form_Settings extends Forminator_Addon_Form_Setti
531
  foreach ( $this->get_form_settings_values() as $key => $value ) {
532
  $multi_ids[] = array(
533
  'id' => $key,
534
- // use name that was added by user on creating connection
535
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
536
  );
537
  }
@@ -547,7 +547,7 @@ class Forminator_Addon_Hubspot_Form_Settings extends Forminator_Addon_Form_Setti
547
  * @param array $submitted_data
548
  */
549
  public function disconnect_form( $submitted_data ) {
550
- // only execute if multi_id provided on submitted data
551
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
552
  $addon_form_settings = $this->get_form_settings_values();
553
  unset( $addon_form_settings[ $submitted_data['multi_id'] ] );
44
  * @return array
45
  */
46
  public function form_settings_wizards() {
47
+ // numerical array steps.
48
  return array(
49
  array(
50
  'callback' => array( $this, 'map_fields' ),
81
  $email_fields = array();
82
  $forminator_field_element_ids = array();
83
  foreach ( $this->form_fields as $form_field ) {
84
+ // collect element ids.
85
  $forminator_field_element_ids[] = $form_field['element_id'];
86
  if ( 'email' === $form_field['type'] ) {
87
  $email_fields[] = $form_field;
268
  $file_fields = array();
269
  $forminator_field_element_ids = array();
270
  foreach ( $this->form_fields as $form_field ) {
271
+ // collect element ids.
272
  $forminator_field_element_ids[] = $form_field['element_id'];
273
  if ( 'upload' === $form_field['type'] ) {
274
  $file_fields[] = $form_field;
531
  foreach ( $this->get_form_settings_values() as $key => $value ) {
532
  $multi_ids[] = array(
533
  'id' => $key,
534
+ // use name that was added by user on creating connection.
535
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
536
  );
537
  }
547
  * @param array $submitted_data
548
  */
549
  public function disconnect_form( $submitted_data ) {
550
+ // only execute if multi_id provided on submitted data.
551
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
552
  $addon_form_settings = $this->get_form_settings_values();
553
  unset( $addon_form_settings[ $submitted_data['multi_id'] ] );
addons/pro/hubspot/class-forminator-addon-hubspot-quiz-hooks.php CHANGED
@@ -63,8 +63,8 @@ class Forminator_Addon_Hubspot_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Ab
63
  * @since 1.4
64
  *
65
  * @param array $submitted_data
66
- * @param int $quiz_id current quiz ID
67
- * @param Forminator_Addon_Hubspot_Quiz_Settings $quiz_settings_instance HubSpot Addon quiz Settings instance
68
  */
69
  $submitted_data = apply_filters(
70
  'forminator_addon_hubspot_quiz_submitted_data',
@@ -90,16 +90,16 @@ class Forminator_Addon_Hubspot_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Ab
90
  *
91
  * @since 1.4
92
  *
93
- * @param int $quiz_id current Form ID
94
  * @param array $submitted_data
95
- * @param Forminator_Addon_Hubspot_Quiz_Settings $quiz_settings_instance HubSpot Addon Quiz Settings instance
96
  */
97
  do_action( 'forminator_addon_hubspot_before_send_message', $quiz_id, $submitted_data, $quiz_settings_instance );
98
 
99
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
100
- // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to hubspot
101
  if ( $quiz_settings_instance->is_multi_quiz_settings_complete( $key ) ) {
102
- // exec only on completed connection
103
  $data[] = array(
104
  'name' => 'status-' . $key,
105
  'value' => $this->get_status_on_contact_sync( $key, $submitted_data, $addon_setting_value, $form_entry_fields ),
@@ -114,9 +114,9 @@ class Forminator_Addon_Hubspot_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Ab
114
  * @since 1.4
115
  *
116
  * @param array $entry_fields
117
- * @param int $quiz_id current Form ID
118
  * @param array $submitted_data
119
- * @param Forminator_Addon_Hubspot_Quiz_Settings $quiz_settings_instance HubSpot Addon Quiz Settings instance
120
  */
121
  $data = apply_filters(
122
  'forminator_addon_hubspot_entry_fields',
@@ -143,7 +143,7 @@ class Forminator_Addon_Hubspot_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Ab
143
  * @return array `is_sent` true means its success send data to HubSpot, false otherwise
144
  */
145
  private function get_status_on_contact_sync( $connection_id, $submitted_data, $connection_settings, $form_entry_fields ) {
146
- // initialize as null
147
  $api = null;
148
 
149
  $quiz_id = $this->quiz_id;
@@ -178,7 +178,7 @@ class Forminator_Addon_Hubspot_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Ab
178
  $email = strtolower( trim( $email ) );
179
  $args['email'] = $email;
180
 
181
- // processed
182
  unset( $fields_map['email'] );
183
  $common_fields = array(
184
  'firstname',
@@ -195,7 +195,7 @@ class Forminator_Addon_Hubspot_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Ab
195
  }
196
  $common_fields = array_merge( $common_fields, $extra_field );
197
  foreach ( $common_fields as $common_field ) {
198
- // not setup
199
  if ( ! isset( $fields_map[ $common_field ] ) ) {
200
  continue;
201
  }
@@ -211,10 +211,10 @@ class Forminator_Addon_Hubspot_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Ab
211
  }
212
  if ( isset( $element_value ) ) {
213
  $args[ $common_field ] = $element_value;
214
- unset( $element_value ); // unset for next loop
215
  }
216
  }
217
- // processed
218
  unset( $fields_map[ $common_field ] );
219
  }
220
  /**
@@ -223,12 +223,12 @@ class Forminator_Addon_Hubspot_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Ab
223
  * @since 1.2
224
  *
225
  * @param array $args
226
- * @param int $quiz_id Current Quiz id
227
- * @param string $connection_id ID of current connection
228
  * @param array $submitted_data
229
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
230
- * @param array $quiz_settings Displayed Quiz settings
231
- * @param Forminator_Addon_Hubspot_Quiz_Settings $quiz_settings_instance HubSpot Addon Quiz Settings instance
232
  */
233
  $args = apply_filters(
234
  'forminator_addon_hubspot_create_contact_args',
@@ -242,7 +242,7 @@ class Forminator_Addon_Hubspot_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Ab
242
  );
243
 
244
  $contact_id = $api->add_update_contact( $args );
245
- // Add contact to contact list
246
  $toObjectId = null;
247
  if ( ! empty( $list_id ) && ! empty( $contact_id ) && ! is_object( $contact_id ) && (int) $contact_id > 0 ) {
248
  $toObjectId = $contact_id;
@@ -342,8 +342,8 @@ class Forminator_Addon_Hubspot_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Ab
342
  * @since 1.4
343
  *
344
  * @param array $addon_meta_data
345
- * @param int $quiz_id current quiz ID
346
- * @param Forminator_Addon_Hubspot_Quiz_Settings $quiz_settings_instance HubSpot Addon Quiz Settings instance
347
  */
348
  $addon_meta_data = apply_filters(
349
  'forminator_addon_hubspot_metadata',
@@ -431,7 +431,7 @@ class Forminator_Addon_Hubspot_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Ab
431
  }
432
 
433
  if ( Forminator_Addon_Hubspot::is_show_full_log() ) {
434
- // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_HUBSPOT_SHOW_FULL_LOG', true)`
435
  if ( isset( $status['url_request'] ) ) {
436
  $sub_entries[] = array(
437
  'label' => __( 'API URL', 'forminator' ),
@@ -456,7 +456,7 @@ class Forminator_Addon_Hubspot_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Ab
456
 
457
  $additional_entry_item['sub_entries'] = $sub_entries;
458
 
459
- // return single array
460
  return $additional_entry_item;
461
  }
462
 
@@ -481,9 +481,9 @@ class Forminator_Addon_Hubspot_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Ab
481
  *
482
  * @since 1.2
483
  *
484
- * @param array $export_headers headers to be displayed on export file
485
- * @param int $quiz_id current Quiz ID
486
- * @param Forminator_Addon_Hubspot_Quiz_Settings $quiz_settings_instance HubSpot Addon Quiz Settings instance
487
  */
488
  $export_headers = apply_filters(
489
  'forminator_addon_hubspot_export_headers',
@@ -518,8 +518,8 @@ class Forminator_Addon_Hubspot_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Ab
518
  * @since 1.4
519
  *
520
  * @param array $addon_meta_data
521
- * @param int $quiz_id current Quiz ID
522
- * @param Forminator_Addon_Hubspot_Quiz_Settings $quiz_settings_instance HubSpot Addon Quiz Settings instance
523
  */
524
  $addon_meta_data = apply_filters(
525
  'forminator_addon_hubspot_metadata',
@@ -537,11 +537,11 @@ class Forminator_Addon_Hubspot_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Ab
537
  *
538
  * @since 1.4
539
  *
540
- * @param array $export_columns column to be exported
541
- * @param int $quiz_id current Quiz ID
542
- * @param Forminator_Quiz_Entry_Model $entry_model Form Entry Model
543
- * @param array $addon_meta_data meta data saved by addon on entry fields
544
- * @param Forminator_Addon_Hubspot_Quiz_Settings $quiz_settings_instance HubSpot Addon Quiz Settings instance
545
  */
546
  $export_columns = apply_filters(
547
  'forminator_addon_hubspot_export_columns',
@@ -574,15 +574,15 @@ class Forminator_Addon_Hubspot_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Ab
574
 
575
  $addon_meta_data = $addon_meta_data[0];
576
 
577
- // make sure its `status`, because we only add this
578
  if ( 'status' !== $addon_meta_data['name'] ) {
579
  if ( stripos( $addon_meta_data['name'], 'status-' ) === 0 ) {
580
  $meta_data = array();
581
  foreach ( $addon_meta_datas as $addon_meta_data ) {
582
- // make it like single value so it will be processed like single meta data
583
  $addon_meta_data['name'] = 'status';
584
 
585
- // add it on an array for next recursive process
586
  $meta_data[] = $this->get_from_addon_meta_data( array( $addon_meta_data ), $key, $default );
587
  }
588
 
@@ -622,7 +622,7 @@ class Forminator_Addon_Hubspot_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Ab
622
  * @return bool
623
  */
624
  public function on_before_delete_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {
625
- // attach hook first
626
  $quiz_id = $this->quiz_id;
627
  $quiz_settings_instance = $this->quiz_settings_instance;
628
 
@@ -633,9 +633,9 @@ class Forminator_Addon_Hubspot_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Ab
633
  * @since 1.4
634
  *
635
  * @param array $addon_meta_data
636
- * @param int $quiz_id current Quiz ID
637
- * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model
638
- * @param Forminator_Addon_Hubspot_Quiz_Settings $quiz_settings_instance HubSpot Addon Quiz Settings instance
639
  */
640
  $addon_meta_data = apply_filters(
641
  'forminator_addon_hubspot_metadata',
@@ -650,10 +650,10 @@ class Forminator_Addon_Hubspot_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Ab
650
  *
651
  * @since 1.1
652
  *
653
- * @param int $quiz_id current Quiz ID
654
- * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model
655
- * @param array $addon_meta_data addon meta data
656
- * @param Forminator_Addon_Hubspot_Quiz_Settings $quiz_settings_instance HubSpot Addon Quiz Settings instance
657
  */
658
  do_action(
659
  'forminator_addon_hubspot_on_before_delete_submission',
@@ -724,10 +724,10 @@ class Forminator_Addon_Hubspot_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Ab
724
  return true;
725
 
726
  } catch ( Forminator_Addon_Hubspot_Exception $e ) {
727
- // use wp_error, for future usage it can be returned to page entries
728
  $wp_error
729
  = new WP_Error( 'forminator_addon_hubspot_delete_contact', $e->getMessage() );
730
- // handle this in addon by self, since page entries cant handle error messages on delete yet
731
  wp_die(
732
  esc_html( $wp_error->get_error_message() ),
733
  esc_html( $this->addon->get_title() ),
63
  * @since 1.4
64
  *
65
  * @param array $submitted_data
66
+ * @param int $quiz_id current quiz ID.
67
+ * @param Forminator_Addon_Hubspot_Quiz_Settings $quiz_settings_instance HubSpot Addon quiz Settings instance.
68
  */
69
  $submitted_data = apply_filters(
70
  'forminator_addon_hubspot_quiz_submitted_data',
90
  *
91
  * @since 1.4
92
  *
93
+ * @param int $quiz_id current Form ID.
94
  * @param array $submitted_data
95
+ * @param Forminator_Addon_Hubspot_Quiz_Settings $quiz_settings_instance HubSpot Addon Quiz Settings instance.
96
  */
97
  do_action( 'forminator_addon_hubspot_before_send_message', $quiz_id, $submitted_data, $quiz_settings_instance );
98
 
99
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
100
+ // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to hubspot.
101
  if ( $quiz_settings_instance->is_multi_quiz_settings_complete( $key ) ) {
102
+ // exec only on completed connection.
103
  $data[] = array(
104
  'name' => 'status-' . $key,
105
  'value' => $this->get_status_on_contact_sync( $key, $submitted_data, $addon_setting_value, $form_entry_fields ),
114
  * @since 1.4
115
  *
116
  * @param array $entry_fields
117
+ * @param int $quiz_id current Form ID.
118
  * @param array $submitted_data
119
+ * @param Forminator_Addon_Hubspot_Quiz_Settings $quiz_settings_instance HubSpot Addon Quiz Settings instance.
120
  */
121
  $data = apply_filters(
122
  'forminator_addon_hubspot_entry_fields',
143
  * @return array `is_sent` true means its success send data to HubSpot, false otherwise
144
  */
145
  private function get_status_on_contact_sync( $connection_id, $submitted_data, $connection_settings, $form_entry_fields ) {
146
+ // initialize as null.
147
  $api = null;
148
 
149
  $quiz_id = $this->quiz_id;
178
  $email = strtolower( trim( $email ) );
179
  $args['email'] = $email;
180
 
181
+ // processed.
182
  unset( $fields_map['email'] );
183
  $common_fields = array(
184
  'firstname',
195
  }
196
  $common_fields = array_merge( $common_fields, $extra_field );
197
  foreach ( $common_fields as $common_field ) {
198
+ // not setup.
199
  if ( ! isset( $fields_map[ $common_field ] ) ) {
200
  continue;
201
  }
211
  }
212
  if ( isset( $element_value ) ) {
213
  $args[ $common_field ] = $element_value;
214
+ unset( $element_value ); // unset for next loop.
215
  }
216
  }
217
+ // processed.
218
  unset( $fields_map[ $common_field ] );
219
  }
220
  /**
223
  * @since 1.2
224
  *
225
  * @param array $args
226
+ * @param int $quiz_id Current Quiz id.
227
+ * @param string $connection_id ID of current connection.
228
  * @param array $submitted_data
229
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
230
+ * @param array $quiz_settings Displayed Quiz settings.
231
+ * @param Forminator_Addon_Hubspot_Quiz_Settings $quiz_settings_instance HubSpot Addon Quiz Settings instance.
232
  */
233
  $args = apply_filters(
234
  'forminator_addon_hubspot_create_contact_args',
242
  );
243
 
244
  $contact_id = $api->add_update_contact( $args );
245
+ // Add contact to contact list.
246
  $toObjectId = null;
247
  if ( ! empty( $list_id ) && ! empty( $contact_id ) && ! is_object( $contact_id ) && (int) $contact_id > 0 ) {
248
  $toObjectId = $contact_id;
342
  * @since 1.4
343
  *
344
  * @param array $addon_meta_data
345
+ * @param int $quiz_id current quiz ID.
346
+ * @param Forminator_Addon_Hubspot_Quiz_Settings $quiz_settings_instance HubSpot Addon Quiz Settings instance.
347
  */
348
  $addon_meta_data = apply_filters(
349
  'forminator_addon_hubspot_metadata',
431
  }
432
 
433
  if ( Forminator_Addon_Hubspot::is_show_full_log() ) {
434
+ // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_HUBSPOT_SHOW_FULL_LOG', true)`.
435
  if ( isset( $status['url_request'] ) ) {
436
  $sub_entries[] = array(
437
  'label' => __( 'API URL', 'forminator' ),
456
 
457
  $additional_entry_item['sub_entries'] = $sub_entries;
458
 
459
+ // return single array.
460
  return $additional_entry_item;
461
  }
462
 
481
  *
482
  * @since 1.2
483
  *
484
+ * @param array $export_headers headers to be displayed on export file.
485
+ * @param int $quiz_id current Quiz ID.
486
+ * @param Forminator_Addon_Hubspot_Quiz_Settings $quiz_settings_instance HubSpot Addon Quiz Settings instance.
487
  */
488
  $export_headers = apply_filters(
489
  'forminator_addon_hubspot_export_headers',
518
  * @since 1.4
519
  *
520
  * @param array $addon_meta_data
521
+ * @param int $quiz_id current Quiz ID.
522
+ * @param Forminator_Addon_Hubspot_Quiz_Settings $quiz_settings_instance HubSpot Addon Quiz Settings instance.
523
  */
524
  $addon_meta_data = apply_filters(
525
  'forminator_addon_hubspot_metadata',
537
  *
538
  * @since 1.4
539
  *
540
+ * @param array $export_columns column to be exported.
541
+ * @param int $quiz_id current Quiz ID.
542
+ * @param Forminator_Quiz_Entry_Model $entry_model Form Entry Model.
543
+ * @param array $addon_meta_data meta data saved by addon on entry fields.
544
+ * @param Forminator_Addon_Hubspot_Quiz_Settings $quiz_settings_instance HubSpot Addon Quiz Settings instance.
545
  */
546
  $export_columns = apply_filters(
547
  'forminator_addon_hubspot_export_columns',
574
 
575
  $addon_meta_data = $addon_meta_data[0];
576
 
577
+ // make sure its `status`, because we only add this.
578
  if ( 'status' !== $addon_meta_data['name'] ) {
579
  if ( stripos( $addon_meta_data['name'], 'status-' ) === 0 ) {
580
  $meta_data = array();
581
  foreach ( $addon_meta_datas as $addon_meta_data ) {
582
+ // make it like single value so it will be processed like single meta data.
583
  $addon_meta_data['name'] = 'status';
584
 
585
+ // add it on an array for next recursive process.
586
  $meta_data[] = $this->get_from_addon_meta_data( array( $addon_meta_data ), $key, $default );
587
  }
588
 
622
  * @return bool
623
  */
624
  public function on_before_delete_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {
625
+ // attach hook first.
626
  $quiz_id = $this->quiz_id;
627
  $quiz_settings_instance = $this->quiz_settings_instance;
628
 
633
  * @since 1.4
634
  *
635
  * @param array $addon_meta_data
636
+ * @param int $quiz_id current Quiz ID.
637
+ * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model.
638
+ * @param Forminator_Addon_Hubspot_Quiz_Settings $quiz_settings_instance HubSpot Addon Quiz Settings instance.
639
  */
640
  $addon_meta_data = apply_filters(
641
  'forminator_addon_hubspot_metadata',
650
  *
651
  * @since 1.1
652
  *
653
+ * @param int $quiz_id current Quiz ID.
654
+ * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model.
655
+ * @param array $addon_meta_data addon meta data.
656
+ * @param Forminator_Addon_Hubspot_Quiz_Settings $quiz_settings_instance HubSpot Addon Quiz Settings instance.
657
  */
658
  do_action(
659
  'forminator_addon_hubspot_on_before_delete_submission',
724
  return true;
725
 
726
  } catch ( Forminator_Addon_Hubspot_Exception $e ) {
727
+ // use wp_error, for future usage it can be returned to page entries.
728
  $wp_error
729
  = new WP_Error( 'forminator_addon_hubspot_delete_contact', $e->getMessage() );
730
+ // handle this in addon by self, since page entries cant handle error messages on delete yet.
731
  wp_die(
732
  esc_html( $wp_error->get_error_message() ),
733
  esc_html( $this->addon->get_title() ),
addons/pro/hubspot/class-forminator-addon-hubspot-quiz-settings.php CHANGED
@@ -44,7 +44,7 @@ class Forminator_Addon_Hubspot_Quiz_Settings extends Forminator_Addon_Quiz_Setti
44
  * @return array
45
  */
46
  public function quiz_settings_wizards() {
47
- // numerical array steps
48
  return array(
49
  array(
50
  'callback' => array( $this, 'map_fields' ),
@@ -82,7 +82,7 @@ class Forminator_Addon_Hubspot_Quiz_Settings extends Forminator_Addon_Quiz_Setti
82
  $forminator_field_element_ids = array();
83
  $forminator_quiz_element_ids = array();
84
  foreach ( $this->form_fields as $form_field ) {
85
- // collect element ids
86
  $forminator_field_element_ids[] = $form_field['element_id'];
87
  if ( 'email' === $form_field['type'] ) {
88
  $email_fields[] = $form_field;
@@ -94,7 +94,7 @@ class Forminator_Addon_Hubspot_Quiz_Settings extends Forminator_Addon_Quiz_Setti
94
  'quiz-name' => __( 'Quiz Name', 'forminator' ),
95
  );
96
  foreach ( $quiz_questions as $quiz_question ) {
97
- // collect element ids
98
  $forminator_quiz_element_ids[] = $quiz_question['slug'];
99
  $quiz_fields[ $quiz_question['slug'] ] = $quiz_question['title'];
100
  }
@@ -292,7 +292,7 @@ class Forminator_Addon_Hubspot_Quiz_Settings extends Forminator_Addon_Quiz_Setti
292
  $file_fields = array();
293
  $forminator_field_element_ids = array();
294
  foreach ( $this->form_fields as $form_field ) {
295
- // collect element ids
296
  $forminator_field_element_ids[] = $form_field['element_id'];
297
  if ( 'upload' === $form_field['type'] ) {
298
  $file_fields[] = $form_field;
@@ -556,7 +556,7 @@ class Forminator_Addon_Hubspot_Quiz_Settings extends Forminator_Addon_Quiz_Setti
556
  foreach ( $this->get_quiz_settings_values() as $key => $value ) {
557
  $multi_ids[] = array(
558
  'id' => $key,
559
- // use name that was added by user on creating connection
560
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
561
  );
562
  }
@@ -572,7 +572,7 @@ class Forminator_Addon_Hubspot_Quiz_Settings extends Forminator_Addon_Quiz_Setti
572
  * @param array $submitted_data
573
  */
574
  public function disconnect_form( $submitted_data ) {
575
- // only execute if multi_id provided on submitted data
576
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
577
  $addon_quiz_settings = $this->get_quiz_settings_values();
578
  unset( $addon_quiz_settings[ $submitted_data['multi_id'] ] );
44
  * @return array
45
  */
46
  public function quiz_settings_wizards() {
47
+ // numerical array steps.
48
  return array(
49
  array(
50
  'callback' => array( $this, 'map_fields' ),
82
  $forminator_field_element_ids = array();
83
  $forminator_quiz_element_ids = array();
84
  foreach ( $this->form_fields as $form_field ) {
85
+ // collect element ids.
86
  $forminator_field_element_ids[] = $form_field['element_id'];
87
  if ( 'email' === $form_field['type'] ) {
88
  $email_fields[] = $form_field;
94
  'quiz-name' => __( 'Quiz Name', 'forminator' ),
95
  );
96
  foreach ( $quiz_questions as $quiz_question ) {
97
+ // collect element ids.
98
  $forminator_quiz_element_ids[] = $quiz_question['slug'];
99
  $quiz_fields[ $quiz_question['slug'] ] = $quiz_question['title'];
100
  }
292
  $file_fields = array();
293
  $forminator_field_element_ids = array();
294
  foreach ( $this->form_fields as $form_field ) {
295
+ // collect element ids.
296
  $forminator_field_element_ids[] = $form_field['element_id'];
297
  if ( 'upload' === $form_field['type'] ) {
298
  $file_fields[] = $form_field;
556
  foreach ( $this->get_quiz_settings_values() as $key => $value ) {
557
  $multi_ids[] = array(
558
  'id' => $key,
559
+ // use name that was added by user on creating connection.
560
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
561
  );
562
  }
572
  * @param array $submitted_data
573
  */
574
  public function disconnect_form( $submitted_data ) {
575
+ // only execute if multi_id provided on submitted data.
576
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
577
  $addon_quiz_settings = $this->get_quiz_settings_values();
578
  unset( $addon_quiz_settings[ $submitted_data['multi_id'] ] );
addons/pro/hubspot/class-forminator-addon-hubspot.php CHANGED
@@ -46,7 +46,7 @@ final class Forminator_Addon_Hubspot extends Forminator_Addon_Abstract {
46
  * @since 1.0 HubSpot Addon
47
  */
48
  public function __construct() {
49
- // late init to allow translation
50
  $this->_description = __( 'Get awesome by your form.', 'forminator' );
51
  $this->_activation_error_message = __( 'Sorry but we failed to activate HubSpot Integration, don\'t hesitate to contact us', 'forminator' );
52
  $this->_deactivation_error_message = __( 'Sorry but we failed to deactivate HubSpot Integration, please try again', 'forminator' );
@@ -115,16 +115,16 @@ final class Forminator_Addon_Hubspot extends Forminator_Addon_Abstract {
115
  */
116
  public function is_connected() {
117
  try {
118
- // check if its active
119
  if ( ! $this->is_active() ) {
120
  throw new Forminator_Addon_Hubspot_Exception( __( 'HubSpot is not active', 'forminator' ) );
121
  }
122
 
123
- // if user completed api setup
124
  $is_connected = false;
125
 
126
  $setting_values = $this->get_settings_values();
127
- // if user completed api setup
128
  if ( isset( $setting_values['token'] ) && ! empty( $setting_values['token'] ) ) {
129
  $is_connected = true;
130
  }
@@ -165,7 +165,7 @@ final class Forminator_Addon_Hubspot extends Forminator_Addon_Abstract {
165
  throw new Forminator_Addon_Hubspot_Exception( __( 'Invalid Form Settings of HubSpot', 'forminator' ) );
166
  }
167
 
168
- // Mark as active when there is at least one active connection
169
  if ( false === $form_settings_instance->find_one_active_connection() ) {
170
  throw new Forminator_Addon_Hubspot_Exception( __( 'No active HubSpot connection found in this form', 'forminator' ) );
171
  }
@@ -182,8 +182,8 @@ final class Forminator_Addon_Hubspot extends Forminator_Addon_Abstract {
182
  * @since 1.0
183
  *
184
  * @param bool $is_form_connected
185
- * @param int $form_id Current Form ID
186
- * @param Forminator_Addon_Hubspot_Form_Settings|null $form_settings_instance Instance of form settings, or null when unavailable
187
  *
188
  */
189
  $is_form_connected = apply_filters( 'forminator_addon_hubspot_is_form_connected', $is_form_connected, $form_id, $form_settings_instance );
@@ -278,7 +278,7 @@ final class Forminator_Addon_Hubspot extends Forminator_Addon_Abstract {
278
  'user' => isset( $setting_values['user'] ) ? $setting_values['user'] : '',
279
  );
280
  } else {
281
- // Force save empty settings
282
  $template_params = array(
283
  'auth_url' => $this->get_auth_url(),
284
  'token' => '',
@@ -335,7 +335,7 @@ final class Forminator_Addon_Hubspot extends Forminator_Addon_Abstract {
335
  $is_poll = false;
336
  $has_errors = true;
337
 
338
- // reset err msg
339
  if ( $this->_auth_error_message ) {
340
  unset( $setting_values['auth_error_message'] );
341
  $this->save_settings_values( $setting_values );
@@ -366,7 +366,7 @@ final class Forminator_Addon_Hubspot extends Forminator_Addon_Abstract {
366
  public function is_authorized( $submitted_data ) {
367
  $setting_values = $this->get_settings_values();
368
 
369
- // check api_key and and api_url set up
370
  return isset( $setting_values['token'] ) && ! empty( $setting_values['token'] );
371
  }
372
 
@@ -494,7 +494,7 @@ final class Forminator_Addon_Hubspot extends Forminator_Addon_Abstract {
494
 
495
  $this->multi_global_id = ! empty( $query_args['global_id'] ) ? $query_args['global_id'] : uniqid( '', true );
496
 
497
- // prefer new instance
498
  $api = Forminator_Addon_Hubspot_Wp_Api::get_instance( uniqid(), $this->multi_global_id );
499
  $redirect_uri = forminator_addon_integration_section_admin_url( $this, 'authorize', false, $identifier );
500
  $args = array(
@@ -527,12 +527,12 @@ final class Forminator_Addon_Hubspot extends Forminator_Addon_Abstract {
527
  $this->save_settings_values( $settings );
528
  $template_params['is_close'] = true;
529
  } catch ( Exception $e ) {
530
- // catch all exception
531
  $template_params['error_message'] = $e->getMessage();
532
  }
533
  } else {
534
  $template_params['error_message'] = __( 'Failed to get authorization code.', 'forminator' );
535
- // todo : translate $query_args[error]
536
  $settings['auth_error_message'] = $template_params['error_message'];
537
  $this->save_settings_values( $settings );
538
  $template_params['is_close'] = true;
@@ -612,7 +612,7 @@ final class Forminator_Addon_Hubspot extends Forminator_Addon_Abstract {
612
  */
613
  public function hubspot_support_request() {
614
  $status = array();
615
- $pipeline = sanitize_text_field( $_POST['value'] );// phpcs:ignore -- data without nonce verification
616
  try {
617
  $api = $this->get_api();
618
  $pipeline_request = $api->get_pipeline();
@@ -657,7 +657,7 @@ final class Forminator_Addon_Hubspot extends Forminator_Addon_Abstract {
657
  throw new Forminator_Addon_Hubspot_Exception( __( 'Invalid Quiz Settings of HubSpot', 'forminator' ) );
658
  }
659
 
660
- // Mark as active when there is at least one active connection
661
  if ( false === $quiz_settings_instance->find_one_active_connection() ) {
662
  throw new Forminator_Addon_Hubspot_Exception( __( 'No active HubSpot connection found in this quiz', 'forminator' ) );
663
  }
@@ -674,8 +674,8 @@ final class Forminator_Addon_Hubspot extends Forminator_Addon_Abstract {
674
  * @since 1.0
675
  *
676
  * @param bool $is_quiz_connected
677
- * @param int $quiz_id Current Quiz ID
678
- * @param Forminator_Addon_Hubspot_Quiz_Settings|null $quiz_settings_instance Instance of quiz settings, or null when unavailable
679
  *
680
  */
681
  $is_quiz_connected = apply_filters( 'forminator_addon_hubspot_is_form_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
@@ -696,7 +696,7 @@ final class Forminator_Addon_Hubspot extends Forminator_Addon_Abstract {
696
  public function is_quiz_lead_connected( $quiz_id ) {
697
 
698
  try {
699
- // initialize with null
700
  $quiz_settings_instance = null;
701
  if ( ! $this->is_connected() ) {
702
  throw new Forminator_Addon_Hubspot_Exception( __( 'HubSpot is not connected', 'forminator' ) );
@@ -726,8 +726,8 @@ final class Forminator_Addon_Hubspot extends Forminator_Addon_Abstract {
726
  * @since 1.1
727
  *
728
  * @param bool $is_quiz_connected
729
- * @param int $quiz_id Current Form ID
730
- * @param Forminator_Addon_Hubspot_Quiz_Settings|null $quiz_settings_instance Instance of quiz settings, or null when unavailable
731
  *
732
  */
733
  $is_quiz_connected = apply_filters( 'forminator_addon_hubspot_is_quiz_lead_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
46
  * @since 1.0 HubSpot Addon
47
  */
48
  public function __construct() {
49
+ // late init to allow translation.
50
  $this->_description = __( 'Get awesome by your form.', 'forminator' );
51
  $this->_activation_error_message = __( 'Sorry but we failed to activate HubSpot Integration, don\'t hesitate to contact us', 'forminator' );
52
  $this->_deactivation_error_message = __( 'Sorry but we failed to deactivate HubSpot Integration, please try again', 'forminator' );
115
  */
116
  public function is_connected() {
117
  try {
118
+ // check if its active.
119
  if ( ! $this->is_active() ) {
120
  throw new Forminator_Addon_Hubspot_Exception( __( 'HubSpot is not active', 'forminator' ) );
121
  }
122
 
123
+ // if user completed api setup.
124
  $is_connected = false;
125
 
126
  $setting_values = $this->get_settings_values();
127
+ // if user completed api setup.
128
  if ( isset( $setting_values['token'] ) && ! empty( $setting_values['token'] ) ) {
129
  $is_connected = true;
130
  }
165
  throw new Forminator_Addon_Hubspot_Exception( __( 'Invalid Form Settings of HubSpot', 'forminator' ) );
166
  }
167
 
168
+ // Mark as active when there is at least one active connection.
169
  if ( false === $form_settings_instance->find_one_active_connection() ) {
170
  throw new Forminator_Addon_Hubspot_Exception( __( 'No active HubSpot connection found in this form', 'forminator' ) );
171
  }
182
  * @since 1.0
183
  *
184
  * @param bool $is_form_connected
185
+ * @param int $form_id Current Form ID.
186
+ * @param Forminator_Addon_Hubspot_Form_Settings|null $form_settings_instance Instance of form settings, or null when unavailable.
187
  *
188
  */
189
  $is_form_connected = apply_filters( 'forminator_addon_hubspot_is_form_connected', $is_form_connected, $form_id, $form_settings_instance );
278
  'user' => isset( $setting_values['user'] ) ? $setting_values['user'] : '',
279
  );
280
  } else {
281
+ // Force save empty settings.
282
  $template_params = array(
283
  'auth_url' => $this->get_auth_url(),
284
  'token' => '',
335
  $is_poll = false;
336
  $has_errors = true;
337
 
338
+ // reset err msg.
339
  if ( $this->_auth_error_message ) {
340
  unset( $setting_values['auth_error_message'] );
341
  $this->save_settings_values( $setting_values );
366
  public function is_authorized( $submitted_data ) {
367
  $setting_values = $this->get_settings_values();
368
 
369
+ // check api_key and and api_url set up.
370
  return isset( $setting_values['token'] ) && ! empty( $setting_values['token'] );
371
  }
372
 
494
 
495
  $this->multi_global_id = ! empty( $query_args['global_id'] ) ? $query_args['global_id'] : uniqid( '', true );
496
 
497
+ // prefer new instance.
498
  $api = Forminator_Addon_Hubspot_Wp_Api::get_instance( uniqid(), $this->multi_global_id );
499
  $redirect_uri = forminator_addon_integration_section_admin_url( $this, 'authorize', false, $identifier );
500
  $args = array(
527
  $this->save_settings_values( $settings );
528
  $template_params['is_close'] = true;
529
  } catch ( Exception $e ) {
530
+ // catch all exception.
531
  $template_params['error_message'] = $e->getMessage();
532
  }
533
  } else {
534
  $template_params['error_message'] = __( 'Failed to get authorization code.', 'forminator' );
535
+ // todo : translate $query_args[error].
536
  $settings['auth_error_message'] = $template_params['error_message'];
537
  $this->save_settings_values( $settings );
538
  $template_params['is_close'] = true;
612
  */
613
  public function hubspot_support_request() {
614
  $status = array();
615
+ $pipeline = Forminator_Core::sanitize_text_field( 'value' );
616
  try {
617
  $api = $this->get_api();
618
  $pipeline_request = $api->get_pipeline();
657
  throw new Forminator_Addon_Hubspot_Exception( __( 'Invalid Quiz Settings of HubSpot', 'forminator' ) );
658
  }
659
 
660
+ // Mark as active when there is at least one active connection.
661
  if ( false === $quiz_settings_instance->find_one_active_connection() ) {
662
  throw new Forminator_Addon_Hubspot_Exception( __( 'No active HubSpot connection found in this quiz', 'forminator' ) );
663
  }
674
  * @since 1.0
675
  *
676
  * @param bool $is_quiz_connected
677
+ * @param int $quiz_id Current Quiz ID.
678
+ * @param Forminator_Addon_Hubspot_Quiz_Settings|null $quiz_settings_instance Instance of quiz settings, or null when unavailable.
679
  *
680
  */
681
  $is_quiz_connected = apply_filters( 'forminator_addon_hubspot_is_form_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
696
  public function is_quiz_lead_connected( $quiz_id ) {
697
 
698
  try {
699
+ // initialize with null.
700
  $quiz_settings_instance = null;
701
  if ( ! $this->is_connected() ) {
702
  throw new Forminator_Addon_Hubspot_Exception( __( 'HubSpot is not connected', 'forminator' ) );
726
  * @since 1.1
727
  *
728
  * @param bool $is_quiz_connected
729
+ * @param int $quiz_id Current Form ID.
730
+ * @param Forminator_Addon_Hubspot_Quiz_Settings|null $quiz_settings_instance Instance of quiz settings, or null when unavailable.
731
  *
732
  */
733
  $is_quiz_connected = apply_filters( 'forminator_addon_hubspot_is_quiz_lead_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
addons/pro/hubspot/lib/class-forminator-addon-hubspot-wp-api.php CHANGED
@@ -124,7 +124,7 @@ class Forminator_Addon_Hubspot_Wp_Api {
124
  *
125
  * @since 1.1
126
  *
127
- * @param string $user_agent current user agent
128
  */
129
  $user_agent = apply_filters( 'forminator_addon_hubspot_api_user_agent', $user_agent );
130
 
@@ -151,7 +151,7 @@ class Forminator_Addon_Hubspot_Wp_Api {
151
  $args = array();
152
  }
153
 
154
- // Adding extra user agent for wp remote request
155
  add_filter( 'http_headers_useragent', array( $this, 'filter_user_agent' ) );
156
 
157
  $url = trailingslashit( $this->_endpoint ) . $path;
@@ -162,10 +162,10 @@ class Forminator_Addon_Hubspot_Wp_Api {
162
  *
163
  * @since 1.1
164
  *
165
- * @param string $url full url with scheme
166
- * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`
167
- * @param string $path requested path resource
168
- * @param array $args argument sent to this function
169
  */
170
  $url = apply_filters( 'forminator_addon_hubspot_api_url', $url, $verb, $path, $args );
171
 
@@ -187,9 +187,9 @@ class Forminator_Addon_Hubspot_Wp_Api {
187
  * @since 1.1
188
  *
189
  * @param array $headers
190
- * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`
191
- * @param string $path requested path resource
192
- * @param array $args argument sent to this function
193
  */
194
  $headers = apply_filters( 'forminator_addon_hubspot_api_request_headers', $headers, $verb, $path, $args );
195
 
@@ -204,9 +204,9 @@ class Forminator_Addon_Hubspot_Wp_Api {
204
  *
205
  * @since 1.1
206
  *
207
- * @param array $request_data it will be `http_build_query`-ed when `GET` or `wp_json_encode`-ed otherwise
208
- * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`
209
- * @param string $path requested path resource
210
  */
211
  $args = apply_filters( 'forminator_addon_hubspot_api_request_data', $request_data, $verb, $path );
212
  if ( $json ) {
@@ -251,7 +251,7 @@ class Forminator_Addon_Hubspot_Wp_Api {
251
 
252
  $body = wp_remote_retrieve_body( $res );
253
 
254
- // probably silent mode
255
  if ( ! empty( $body ) ) {
256
  $res = json_decode( $body );
257
 
@@ -277,9 +277,9 @@ class Forminator_Addon_Hubspot_Wp_Api {
277
  *
278
  * @since 1.1
279
  *
280
- * @param mixed $response original wp remote request response or decoded body if available
281
- * @param string $body original content of http response's body
282
- * @param array|WP_Error $wp_response original wp remote request response
283
  */
284
  $res = apply_filters( 'forminator_addon_hubspot_api_response', $response, $body, $wp_response );
285
 
@@ -451,7 +451,7 @@ class Forminator_Addon_Hubspot_Wp_Api {
451
 
452
  $token_data['expires_in'] += time();
453
 
454
- // Update auth token
455
  $this->update_auth_token( $token_data );
456
  }
457
 
124
  *
125
  * @since 1.1
126
  *
127
+ * @param string $user_agent current user agent.
128
  */
129
  $user_agent = apply_filters( 'forminator_addon_hubspot_api_user_agent', $user_agent );
130
 
151
  $args = array();
152
  }
153
 
154
+ // Adding extra user agent for wp remote request.
155
  add_filter( 'http_headers_useragent', array( $this, 'filter_user_agent' ) );
156
 
157
  $url = trailingslashit( $this->_endpoint ) . $path;
162
  *
163
  * @since 1.1
164
  *
165
+ * @param string $url full url with scheme.
166
+ * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`.
167
+ * @param string $path requested path resource.
168
+ * @param array $args argument sent to this function.
169
  */
170
  $url = apply_filters( 'forminator_addon_hubspot_api_url', $url, $verb, $path, $args );
171
 
187
  * @since 1.1
188
  *
189
  * @param array $headers
190
+ * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`.
191
+ * @param string $path requested path resource.
192
+ * @param array $args argument sent to this function.
193
  */
194
  $headers = apply_filters( 'forminator_addon_hubspot_api_request_headers', $headers, $verb, $path, $args );
195
 
204
  *
205
  * @since 1.1
206
  *
207
+ * @param array $request_data it will be `http_build_query`-ed when `GET` or `wp_json_encode`-ed otherwise.
208
+ * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`.
209
+ * @param string $path requested path resource.
210
  */
211
  $args = apply_filters( 'forminator_addon_hubspot_api_request_data', $request_data, $verb, $path );
212
  if ( $json ) {
251
 
252
  $body = wp_remote_retrieve_body( $res );
253
 
254
+ // probably silent mode.
255
  if ( ! empty( $body ) ) {
256
  $res = json_decode( $body );
257
 
277
  *
278
  * @since 1.1
279
  *
280
+ * @param mixed $response original wp remote request response or decoded body if available.
281
+ * @param string $body original content of http response's body.
282
+ * @param array|WP_Error $wp_response original wp remote request response.
283
  */
284
  $res = apply_filters( 'forminator_addon_hubspot_api_response', $response, $body, $wp_response );
285
 
451
 
452
  $token_data['expires_in'] += time();
453
 
454
+ // Update auth token.
455
  $this->update_auth_token( $token_data );
456
  }
457
 
addons/pro/hubspot/views/form-settings/create-contact.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
addons/pro/hubspot/views/form-settings/create-ticket.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
@@ -313,7 +313,7 @@ foreach ( $template_vars as $key => $val ) {
313
  $('#hubspot-support-request').on('change', function () {
314
  let value = $(this).val();
315
  $.ajax({
316
- url: '<?php echo forminator_ajax_url();// phpcs:ignore ?>',
317
  type: "POST",
318
  data: {
319
  action: "forminator_hubspot_support_request",
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
313
  $('#hubspot-support-request').on('change', function () {
314
  let value = $(this).val();
315
  $.ajax({
316
+ url: '<?php echo esc_url( forminator_ajax_url() ); ?>',
317
  type: "POST",
318
  data: {
319
  action: "forminator_hubspot_support_request",
addons/pro/hubspot/views/quiz-settings/create-contact.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
addons/pro/hubspot/views/quiz-settings/create-ticket.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
@@ -313,7 +313,7 @@ foreach ( $template_vars as $key => $val ) {
313
  $('#hubspot-support-request').on('change', function () {
314
  let value = $(this).val();
315
  $.ajax({
316
- url: '<?php echo forminator_ajax_url();// phpcs:ignore ?>',
317
  type: "POST",
318
  data: {
319
  action: "forminator_hubspot_support_request",
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
313
  $('#hubspot-support-request').on('change', function () {
314
  let value = $(this).val();
315
  $.ajax({
316
+ url: '<?php echo esc_url( forminator_ajax_url() ); ?>',
317
  type: "POST",
318
  data: {
319
  action: "forminator_hubspot_support_request",
addons/pro/hubspot/views/sections/authorize.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'is_close' => false,
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'is_close' => false,
addons/pro/hubspot/views/settings/authorize.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'auth_url' => '',
5
  'token' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'auth_url' => '',
5
  'token' => '',
addons/pro/hubspot/views/settings/error-authorize.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'auth_url' => '',
5
  'error_message' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'auth_url' => '',
5
  'error_message' => '',
addons/pro/hubspot/views/settings/wait-authorize.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'auth_url' => '',
5
  'token' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'auth_url' => '',
5
  'token' => '',
addons/pro/mailchimp/class-forminator-addon-mailchimp-form-hooks.php CHANGED
@@ -55,7 +55,7 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
55
  * @since 1.0 Mailchimp Addon
56
  */
57
  public function on_after_render_form_fields() {
58
- // Render GDPR field if enabled
59
  if ( Forminator_Addon_Mailchimp::is_enable_gdpr() ) {
60
  $addon_setting_values = $this->form_settings_instance->get_form_settings_values();
61
  if ( isset( $addon_setting_values['enable_gdpr'] ) && $addon_setting_values['enable_gdpr'] ) {
@@ -73,8 +73,8 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
73
  *
74
  * @since 1.1
75
  *
76
- * @param int $form_id current Form ID
77
- * @param Forminator_Addon_Mailchimp_Form_Settings $form_settings_instance Mailchimp Form settings Instance
78
  */
79
  do_action(
80
  'forminator_addon_mailchimp_on_after_render_form_fields',
@@ -98,7 +98,7 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
98
  $html = '<div class="forminator-row"><div id="field-' . $input_id . '" class="forminator-col forminator-col-12"><div class="forminator-field">';
99
  $html .= '<div class="forminator-field--label"><label class="forminator-label" id="forminator-label-' . $input_id . '">' . esc_html_e( 'Mailchimp GDPR', 'forminator' )
100
  . '</label></div>';
101
- // matching checkbox with design
102
  $form_settings = $this->form_settings_instance->get_form_settings();
103
  $design_class = self::get_form_setting_value_as( $form_settings, 'form-style', 'default', 'string' );
104
  if ( 'none' === $design_class ) {
@@ -219,8 +219,8 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
219
  * @since 1.1
220
  *
221
  * @param array $submitted_data
222
- * @param int $form_id current Form ID
223
- * @param Forminator_Addon_Mailchimp_Form_Settings $form_settings_instance Mailchimp API Form Settings instance
224
  */
225
  $submitted_data = apply_filters(
226
  'forminator_addon_mailchimp_form_submitted_data',
@@ -237,9 +237,9 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
237
  * @since 1.1
238
  *
239
  * @param bool $is_success
240
- * @param int $form_id current Form ID
241
  * @param array $submitted_data
242
- * @param Forminator_Addon_Mailchimp_Form_Settings $form_settings_instance Mailchimp API Form Settings instance
243
  */
244
  $is_success = apply_filters(
245
  'forminator_addon_mailchimp_on_form_submit_result',
@@ -249,9 +249,9 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
249
  $form_settings_instance
250
  );
251
 
252
- // process filter
253
  if ( true !== $is_success ) {
254
- // only update `_submit_form_error_message` when not empty
255
  if ( ! empty( $is_success ) ) {
256
  $this->_submit_form_error_message = (string) $is_success;
257
  }
@@ -259,13 +259,13 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
259
  return $is_success;
260
  }
261
 
262
- // only exec this below when filter return true
263
- // check is enabled
264
  if ( ! Forminator_Addon_Mailchimp::is_enable_gdpr() ) {
265
  return true;
266
  }
267
 
268
- // Only flag check for gdpr
269
  if ( ! isset( $submitted_data['forminator-addon-mailchimp-gdpr'] ) || '1' !== $submitted_data['forminator-addon-mailchimp-gdpr'] ) {
270
  $this->gdpr_is_checked = false;
271
  }
@@ -297,8 +297,8 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
297
  * @since 1.1
298
  *
299
  * @param array $submitted_data
300
- * @param int $form_id current Form ID
301
- * @param Forminator_Addon_Mailchimp_Form_Settings $form_settings_instance Mailchimp API Form Settings instance
302
  */
303
  $submitted_data = apply_filters(
304
  'forminator_addon_mailchimp_form_submitted_data',
@@ -325,7 +325,7 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
325
  forminator_addon_maybe_log( __METHOD__, $submitted_data );
326
 
327
  $addon_setting_values = $form_settings_instance->get_form_settings_values();
328
- // initialize as null
329
  $mailchimp_api = null;
330
 
331
  $settings_values = $this->addon->get_settings_values();
@@ -341,7 +341,7 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
341
  $mailchimp_api = $this->addon->get_api();
342
 
343
  if ( Forminator_Addon_Mailchimp::is_enable_gdpr() ) {
344
- // GDPR
345
  if ( isset( $addon_setting_values['enable_gdpr'] ) && $addon_setting_values['enable_gdpr'] ) {
346
  if ( isset( $addon_setting_values['gdpr_text'] ) && ! empty( $addon_setting_values['gdpr_text'] ) ) {
347
  if ( ! $this->gdpr_is_checked ) {
@@ -358,7 +358,7 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
358
  }
359
  }
360
 
361
- // EMAIL : super required**
362
  if ( ! isset( $addon_setting_values['fields_map']['EMAIL'] ) ) {
363
  throw new Forminator_Addon_Mailchimp_Exception(/* translators: ... */
364
  sprintf( __( 'Required Field %1$s not mapped yet to Forminator Form Field, Please check your Mailchimp Configuration on Form Settings', 'forminator' ), 'EMAIL' )
@@ -426,7 +426,7 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
426
  }
427
  }
428
 
429
- // check if user already on the list
430
  $subscriber_hash = md5( strtolower( trim( $submitted_data[ $addon_setting_values['fields_map']['EMAIL'] ] ) ) );
431
 
432
  $is_double_opt_in_enabled = isset( $addon_setting_values['enable_double_opt_in'] ) && filter_var( $addon_setting_values['enable_double_opt_in'], FILTER_VALIDATE_BOOLEAN ) ? true : false;
@@ -436,11 +436,11 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
436
  }
437
 
438
  try {
439
- // keep subscribed if already subscribed
440
  $member_status_request = $mailchimp_api->get_member( $addon_setting_values['mail_list_id'], $subscriber_hash, array() );
441
  if ( isset( $member_status_request->status ) && ! empty( $member_status_request->status ) ) {
442
  if ( 'subscribed' === $member_status_request->status ) {
443
- // already subscribed, keep it subscribed, just update merge_fields
444
  $status = 'subscribed';
445
  }
446
  }
@@ -484,7 +484,7 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
484
 
485
  if ( isset( $element_value ) ) {
486
  $merge_fields[ $item->tag ] = $element_value;
487
- unset( $element_value ); // unset for next loop
488
  }
489
  }
490
  }
@@ -511,9 +511,9 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
511
  * @since 1.1
512
  *
513
  * @param string $mail_list_id
514
- * @param int $form_id current Form ID
515
- * @param array $submitted_data Submitted data
516
- * @param Forminator_Addon_Mailchimp_Form_Settings $form_settings_instance Mailchimp Form Settings
517
  */
518
  $mail_list_id = apply_filters(
519
  'forminator_addon_mailchimp_add_update_member_request_mail_list_id',
@@ -537,9 +537,9 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
537
  * @since 1.1
538
  *
539
  * @param array $args
540
- * @param int $form_id current Form ID
541
- * @param array $submitted_data Submitted data
542
- * @param Forminator_Addon_Mailchimp_Form_Settings $form_settings_instance Mailchimp Form Settings
543
  */
544
  $args = apply_filters(
545
  'forminator_addon_mailchimp_add_update_member_request_args',
@@ -557,9 +557,9 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
557
  *
558
  * @since 1.1
559
  *
560
- * @param int $form_id current Form ID
561
- * @param array $submitted_data Submitted data
562
- * @param Forminator_Addon_Mailchimp_Form_Settings $form_settings_instance Mailchimp Form Settings
563
  */
564
  do_action( 'forminator_addon_mailchimp_before_add_update_member', $form_id, $submitted_data, $form_settings_instance );
565
 
@@ -612,9 +612,9 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
612
  * @since 1.1
613
  *
614
  * @param array $entry_fields
615
- * @param int $form_id current Form ID
616
  * @param array $submitted_data
617
- * @param Forminator_Addon_Mailchimp_Form_Settings $form_settings_instance Mailchimp API Form Settings instance
618
  */
619
  $entry_fields = apply_filters(
620
  'forminator_addon_mailchimp_entry_fields',
@@ -700,9 +700,9 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
700
  * @since 1.1
701
  *
702
  * @param array $addon_meta_data
703
- * @param int $form_id current Form ID
704
- * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model
705
- * @param Forminator_Addon_Mailchimp_Form_Settings $form_settings_instance Mailchimp API Form Settings instance
706
  */
707
  $addon_meta_datas = apply_filters(
708
  'forminator_addon_mailchimp_metadata',
@@ -722,11 +722,11 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
722
  *
723
  * @since 1.1
724
  *
725
- * @param array $entry_items row(s) to be displayed on entries page
726
- * @param int $form_id current Form ID
727
- * @param Forminator_Form_Entry_Model $entry_model Form Entry Model
728
- * @param array $addon_meta_data meta data saved by addon on entry fields
729
- * @param Forminator_Addon_Mailchimp_Form_Settings $form_settings_instance Mailchimp API Form Settings instance
730
  */
731
  $entry_items = apply_filters(
732
  'forminator_addon_mailchimp_entry_items',
@@ -751,7 +751,7 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
751
  * @return array
752
  */
753
  private function format_metadata_for_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {
754
- // make sure its `status`, because we only add this
755
  if ( 0 !== strpos( $addon_meta_data['name'], 'status' ) ) {
756
  return array();
757
  }
@@ -799,7 +799,7 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
799
  }
800
 
801
  if ( Forminator_Addon_Mailchimp::is_show_full_log() ) {
802
- // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_MAILCHIMP_SHOW_FULL_LOG', true)`
803
  if ( isset( $status['url_request'] ) ) {
804
  $sub_entries[] = array(
805
  'label' => __( 'API URL', 'forminator' ),
@@ -846,9 +846,9 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
846
  *
847
  * @since 1.1
848
  *
849
- * @param array $export_headers headers to be displayed on export file
850
- * @param int $form_id current Form ID
851
- * @param Forminator_Addon_Mailchimp_Form_Settings $form_settings_instance Mailchimp API Form Settings instance
852
  */
853
  $export_headers = apply_filters(
854
  'forminator_addon_mailchimp_export_headers',
@@ -882,8 +882,8 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
882
  * @since 1.1
883
  *
884
  * @param array $addon_meta_data
885
- * @param int $form_id current Form ID
886
- * @param Forminator_Addon_Mailchimp_Form_Settings $form_settings_instance Mailchimp API Form Settings instance
887
  */
888
  $addon_meta_data = apply_filters(
889
  'forminator_addon_mailchimp_metadata',
@@ -901,11 +901,11 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
901
  *
902
  * @since 1.1
903
  *
904
- * @param array $export_columns column to be exported
905
- * @param int $form_id current Form ID
906
- * @param Forminator_Form_Entry_Model $entry_model Form Entry Model
907
- * @param array $addon_meta_data meta data saved by addon on entry fields
908
- * @param Forminator_Addon_Mailchimp_Form_Settings $form_settings_instance Mailchimp API Form Settings instance
909
  */
910
  $export_columns = apply_filters(
911
  'forminator_addon_mailchimp_export_columns',
@@ -931,15 +931,15 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
931
  * @return string
932
  */
933
  private function get_from_addon_meta_data( $addon_meta_data, $key, $default = '' ) {
934
- // only process first addon meta datas since we only save one
935
- // no entry fields was added before
936
  if ( ! isset( $addon_meta_data[0] ) || ! is_array( $addon_meta_data[0] ) ) {
937
  return $default;
938
  }
939
 
940
  $addon_meta_data = $addon_meta_data[0];
941
 
942
- // make sure its `status`, because we only add this
943
  if ( 'status' !== $addon_meta_data['name'] ) {
944
  return $default;
945
  }
@@ -966,7 +966,7 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
966
  * @return bool
967
  */
968
  public function on_before_delete_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {
969
- // attach hook first
970
  $form_id = $this->form_id;
971
  $form_settings_instance = $this->form_settings_instance;
972
 
@@ -982,9 +982,9 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
982
  * @since 1.1
983
  *
984
  * @param array $addon_meta_data
985
- * @param int $form_id current Form ID
986
- * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model
987
- * @param Forminator_Addon_Form_Settings_Abstract|null $form_settings_instance of Addon Form Settings
988
  */
989
  $addon_meta_data = apply_filters(
990
  'forminator_addon_mailchimp_metadata',
@@ -1004,10 +1004,10 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
1004
  *
1005
  * @since 1.1
1006
  *
1007
- * @param int $form_id current Form ID
1008
- * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model
1009
- * @param array $addon_meta_data addon meta data
1010
- * @param Forminator_Addon_Form_Settings_Abstract|null $form_settings_instance of Addon Form Settings
1011
  */
1012
  do_action(
1013
  'forminator_addon_mailchimp_on_before_delete_submission',
@@ -1049,14 +1049,14 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
1049
  return true;
1050
 
1051
  } catch ( Forminator_Addon_Mailchimp_Wp_Api_Not_Found_Exception $e ) {
1052
- // its not found, probably already deleted on mailchimp
1053
  return true;
1054
  } catch ( Forminator_Addon_Mailchimp_Exception $e ) {
1055
- // handle all internal addon exceptions with `Forminator_Addon_Mailchimp_Exception`
1056
 
1057
- // use wp_error, for future usage it can be returned to page entries
1058
  $wp_error = new WP_Error( 'forminator_addon_mailchimp_delete_member', $e->getMessage() );
1059
- // handle this in addon by self, since page entries cant handle error messages on delete yet
1060
  wp_die(
1061
  esc_html( $wp_error->get_error_message() ),
1062
  esc_html( $this->addon->get_title() ),
@@ -1081,14 +1081,14 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
1081
  * @return array
1082
  */
1083
  public static function get_valid_addon_meta_data_value( $addon_meta_data ) {
1084
- // preliminary check of addon_meta_data
1085
  if ( ! isset( $addon_meta_data[0] ) || ! is_array( $addon_meta_data[0] ) ) {
1086
  return array();
1087
  }
1088
 
1089
  $addon_meta_data = $addon_meta_data[0];
1090
 
1091
- // make sure its `status`, because we only add this
1092
  if ( 'status' !== $addon_meta_data['name'] ) {
1093
  return array();
1094
  }
@@ -1110,40 +1110,40 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
1110
  */
1111
  public static function get_delete_member_url_from_addon_meta_data( $addon_meta_data ) {
1112
 
1113
- // delete links available on data_received of mailchimp
1114
  /** == Addon meta data reference ==*/
1115
  //[
1116
- // {
1117
  // "name": "status",
1118
- // "value": {
1119
  // "is_sent": true,
1120
- // "description": "Successfully added or updated member on Mailchimp list",
1121
- // "data_sent": {
1122
  // ...
1123
  // },
1124
- // "data_received": {
1125
  // "id": "XXXXXXX",
1126
  // ...
1127
- // "list_id": "XXXXXXX",
1128
- // "_links": [
1129
- // {
1130
  // "rel": "upsert",
1131
- // "href": "https:\/\/us9.api.mailchimp.com\/3.0\/lists\/XXXXXXX\/members\/XXXXXXX",
1132
- // "method": "PUT",
1133
- // "targetSchema": "https:\/\/us9.api.mailchimp.com\/schema\/3.0\/Definitions\/Lists\/Members\/Response.json",
1134
- // "schema": "https:\/\/us9.api.mailchimp.com\/schema\/3.0\/Definitions\/Lists\/Members\/PUT.json"
1135
- // },
1136
- // {
1137
  // "rel": "delete",
1138
- // "href": "https:\/\/us9.api.mailchimp.com\/3.0\/lists\/XXXXXXX\/members\/XXXXXXX",
1139
- // "method": "DELETE"
1140
- // },
1141
  // ...
1142
- // ]
1143
- // },
1144
- // "url_request": "https:\/\/us9.api.mailchimp.com\/3.0\/lists\/XXXX\/members\/XXXXXXX"
1145
- // }
1146
- // }
1147
  //]
1148
  /** == Addon meta data reference ==*/
1149
 
@@ -1151,24 +1151,24 @@ class Forminator_Addon_Mailchimp_Form_Hooks extends Forminator_Addon_Form_Hooks_
1151
 
1152
  $meta_data_value = self::get_valid_addon_meta_data_value( $addon_meta_data );
1153
  if ( empty( $meta_data_value ) ) {
1154
- // probably this entry added before connected to mailchimp, mark it as okay to delete entry
1155
  return '';
1156
  }
1157
 
1158
  if ( isset( $meta_data_value['is_sent'] ) && ! $meta_data_value['is_sent'] ) {
1159
- // its not sent to mailchimp so it won't have delete member uri
1160
  return '';
1161
  }
1162
 
1163
  if ( ! isset( $meta_data_value['data_received'] ) || ! is_object( $meta_data_value['data_received'] ) ) {
1164
- // something is happened on addon meta data
1165
  return '';
1166
  }
1167
 
1168
  $data_received = $meta_data_value['data_received'];
1169
 
1170
  if ( ! isset( $data_received->_links ) || ! is_array( $data_received->_links ) ) {
1171
- // something is happened on addon meta data
1172
  return '';
1173
  }
1174
 
55
  * @since 1.0 Mailchimp Addon
56
  */
57
  public function on_after_render_form_fields() {
58
+ // Render GDPR field if enabled.
59
  if ( Forminator_Addon_Mailchimp::is_enable_gdpr() ) {
60
  $addon_setting_values = $this->form_settings_instance->get_form_settings_values();
61
  if ( isset( $addon_setting_values['enable_gdpr'] ) && $addon_setting_values['enable_gdpr'] ) {
73
  *
74
  * @since 1.1
75
  *
76
+ * @param int $form_id current Form ID.
77
+ * @param Forminator_Addon_Mailchimp_Form_Settings $form_settings_instance Mailchimp Form settings Instance.
78
  */
79
  do_action(
80
  'forminator_addon_mailchimp_on_after_render_form_fields',
98
  $html = '<div class="forminator-row"><div id="field-' . $input_id . '" class="forminator-col forminator-col-12"><div class="forminator-field">';
99
  $html .= '<div class="forminator-field--label"><label class="forminator-label" id="forminator-label-' . $input_id . '">' . esc_html_e( 'Mailchimp GDPR', 'forminator' )
100
  . '</label></div>';
101
+ // matching checkbox with design.
102
  $form_settings = $this->form_settings_instance->get_form_settings();
103
  $design_class = self::get_form_setting_value_as( $form_settings, 'form-style', 'default', 'string' );
104
  if ( 'none' === $design_class ) {
219
  * @since 1.1
220
  *
221
  * @param array $submitted_data
222
+ * @param int $form_id current Form ID.
223
+ * @param Forminator_Addon_Mailchimp_Form_Settings $form_settings_instance Mailchimp API Form Settings instance.
224
  */
225
  $submitted_data = apply_filters(
226
  'forminator_addon_mailchimp_form_submitted_data',
237
  * @since 1.1
238
  *
239
  * @param bool $is_success
240
+ * @param int $form_id current Form ID.
241
  * @param array $submitted_data
242
+ * @param Forminator_Addon_Mailchimp_Form_Settings $form_settings_instance Mailchimp API Form Settings instance.
243
  */
244
  $is_success = apply_filters(
245
  'forminator_addon_mailchimp_on_form_submit_result',
249
  $form_settings_instance
250
  );
251
 
252
+ // process filter.
253
  if ( true !== $is_success ) {
254
+ // only update `_submit_form_error_message` when not empty.
255
  if ( ! empty( $is_success ) ) {
256
  $this->_submit_form_error_message = (string) $is_success;
257
  }
259
  return $is_success;
260
  }
261
 
262
+ // only exec this below when filter return true.
263
+ // check is enabled.
264
  if ( ! Forminator_Addon_Mailchimp::is_enable_gdpr() ) {
265
  return true;
266
  }
267
 
268
+ // Only flag check for gdpr.
269
  if ( ! isset( $submitted_data['forminator-addon-mailchimp-gdpr'] ) || '1' !== $submitted_data['forminator-addon-mailchimp-gdpr'] ) {
270
  $this->gdpr_is_checked = false;
271
  }
297
  * @since 1.1
298
  *
299
  * @param array $submitted_data
300
+ * @param int $form_id current Form ID.
301
+ * @param Forminator_Addon_Mailchimp_Form_Settings $form_settings_instance Mailchimp API Form Settings instance.
302
  */
303
  $submitted_data = apply_filters(
304
  'forminator_addon_mailchimp_form_submitted_data',
325
  forminator_addon_maybe_log( __METHOD__, $submitted_data );
326
 
327
  $addon_setting_values = $form_settings_instance->get_form_settings_values();
328
+ // initialize as null.
329
  $mailchimp_api = null;
330
 
331
  $settings_values = $this->addon->get_settings_values();
341
  $mailchimp_api = $this->addon->get_api();
342
 
343
  if ( Forminator_Addon_Mailchimp::is_enable_gdpr() ) {
344
+ // GDPR.
345
  if ( isset( $addon_setting_values['enable_gdpr'] ) && $addon_setting_values['enable_gdpr'] ) {
346
  if ( isset( $addon_setting_values['gdpr_text'] ) && ! empty( $addon_setting_values['gdpr_text'] ) ) {
347
  if ( ! $this->gdpr_is_checked ) {
358
  }
359
  }
360
 
361
+ // EMAIL : super required**.
362
  if ( ! isset( $addon_setting_values['fields_map']['EMAIL'] ) ) {
363
  throw new Forminator_Addon_Mailchimp_Exception(/* translators: ... */
364
  sprintf( __( 'Required Field %1$s not mapped yet to Forminator Form Field, Please check your Mailchimp Configuration on Form Settings', 'forminator' ), 'EMAIL' )
426
  }
427
  }
428
 
429
+ // check if user already on the list.
430
  $subscriber_hash = md5( strtolower( trim( $submitted_data[ $addon_setting_values['fields_map']['EMAIL'] ] ) ) );
431
 
432
  $is_double_opt_in_enabled = isset( $addon_setting_values['enable_double_opt_in'] ) && filter_var( $addon_setting_values['enable_double_opt_in'], FILTER_VALIDATE_BOOLEAN ) ? true : false;
436
  }
437
 
438
  try {
439
+ // keep subscribed if already subscribed.
440
  $member_status_request = $mailchimp_api->get_member( $addon_setting_values['mail_list_id'], $subscriber_hash, array() );
441
  if ( isset( $member_status_request->status ) && ! empty( $member_status_request->status ) ) {
442
  if ( 'subscribed' === $member_status_request->status ) {
443
+ // already subscribed, keep it subscribed, just update merge_fields.
444
  $status = 'subscribed';
445
  }
446
  }
484
 
485
  if ( isset( $element_value ) ) {
486
  $merge_fields[ $item->tag ] = $element_value;
487
+ unset( $element_value ); // unset for next loop.
488
  }
489
  }
490
  }
511
  * @since 1.1
512
  *
513
  * @param string $mail_list_id
514
+ * @param int $form_id current Form ID.
515
+ * @param array $submitted_data Submitted data.
516
+ * @param Forminator_Addon_Mailchimp_Form_Settings $form_settings_instance Mailchimp Form Settings.
517
  */
518
  $mail_list_id = apply_filters(
519
  'forminator_addon_mailchimp_add_update_member_request_mail_list_id',
537
  * @since 1.1
538
  *
539
  * @param array $args
540
+ * @param int $form_id current Form ID.
541
+ * @param array $submitted_data Submitted data.
542
+ * @param Forminator_Addon_Mailchimp_Form_Settings $form_settings_instance Mailchimp Form Settings.
543
  */
544
  $args = apply_filters(
545
  'forminator_addon_mailchimp_add_update_member_request_args',
557
  *
558
  * @since 1.1
559
  *
560
+ * @param int $form_id current Form ID.
561
+ * @param array $submitted_data Submitted data.
562
+ * @param Forminator_Addon_Mailchimp_Form_Settings $form_settings_instance Mailchimp Form Settings.
563
  */
564
  do_action( 'forminator_addon_mailchimp_before_add_update_member', $form_id, $submitted_data, $form_settings_instance );
565
 
612
  * @since 1.1
613
  *
614
  * @param array $entry_fields
615
+ * @param int $form_id current Form ID.
616
  * @param array $submitted_data
617
+ * @param Forminator_Addon_Mailchimp_Form_Settings $form_settings_instance Mailchimp API Form Settings instance.
618
  */
619
  $entry_fields = apply_filters(
620
  'forminator_addon_mailchimp_entry_fields',
700
  * @since 1.1
701
  *
702
  * @param array $addon_meta_data
703
+ * @param int $form_id current Form ID.
704
+ * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model.
705
+ * @param Forminator_Addon_Mailchimp_Form_Settings $form_settings_instance Mailchimp API Form Settings instance.
706
  */
707
  $addon_meta_datas = apply_filters(
708
  'forminator_addon_mailchimp_metadata',
722
  *
723
  * @since 1.1
724
  *
725
+ * @param array $entry_items row(s) to be displayed on entries page.
726
+ * @param int $form_id current Form ID.
727
+ * @param Forminator_Form_Entry_Model $entry_model Form Entry Model.
728
+ * @param array $addon_meta_data meta data saved by addon on entry fields.
729
+ * @param Forminator_Addon_Mailchimp_Form_Settings $form_settings_instance Mailchimp API Form Settings instance.
730
  */
731
  $entry_items = apply_filters(
732
  'forminator_addon_mailchimp_entry_items',
751
  * @return array
752
  */
753
  private function format_metadata_for_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {
754
+ // make sure its `status`, because we only add this.
755
  if ( 0 !== strpos( $addon_meta_data['name'], 'status' ) ) {
756
  return array();
757
  }
799
  }
800
 
801
  if ( Forminator_Addon_Mailchimp::is_show_full_log() ) {
802
+ // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_MAILCHIMP_SHOW_FULL_LOG', true)`.
803
  if ( isset( $status['url_request'] ) ) {
804
  $sub_entries[] = array(
805
  'label' => __( 'API URL', 'forminator' ),
846
  *
847
  * @since 1.1
848
  *
849
+ * @param array $export_headers headers to be displayed on export file.
850
+ * @param int $form_id current Form ID.
851
+ * @param Forminator_Addon_Mailchimp_Form_Settings $form_settings_instance Mailchimp API Form Settings instance.
852
  */
853
  $export_headers = apply_filters(
854
  'forminator_addon_mailchimp_export_headers',
882
  * @since 1.1
883
  *
884
  * @param array $addon_meta_data
885
+ * @param int $form_id current Form ID.
886
+ * @param Forminator_Addon_Mailchimp_Form_Settings $form_settings_instance Mailchimp API Form Settings instance.
887
  */
888
  $addon_meta_data = apply_filters(
889
  'forminator_addon_mailchimp_metadata',
901
  *
902
  * @since 1.1
903
  *
904
+ * @param array $export_columns column to be exported.
905
+ * @param int $form_id current Form ID.
906
+ * @param Forminator_Form_Entry_Model $entry_model Form Entry Model.
907
+ * @param array $addon_meta_data meta data saved by addon on entry fields.
908
+ * @param Forminator_Addon_Mailchimp_Form_Settings $form_settings_instance Mailchimp API Form Settings instance.
909
  */
910
  $export_columns = apply_filters(
911
  'forminator_addon_mailchimp_export_columns',
931
  * @return string
932
  */
933
  private function get_from_addon_meta_data( $addon_meta_data, $key, $default = '' ) {
934
+ // only process first addon meta datas since we only save one.
935
+ // no entry fields was added before.
936
  if ( ! isset( $addon_meta_data[0] ) || ! is_array( $addon_meta_data[0] ) ) {
937
  return $default;
938
  }
939
 
940
  $addon_meta_data = $addon_meta_data[0];
941
 
942
+ // make sure its `status`, because we only add this.
943
  if ( 'status' !== $addon_meta_data['name'] ) {
944
  return $default;
945
  }
966
  * @return bool
967
  */
968
  public function on_before_delete_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {
969
+ // attach hook first.
970
  $form_id = $this->form_id;
971
  $form_settings_instance = $this->form_settings_instance;
972
 
982
  * @since 1.1
983
  *
984
  * @param array $addon_meta_data
985
+ * @param int $form_id current Form ID.
986
+ * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model.
987
+ * @param Forminator_Addon_Form_Settings_Abstract|null $form_settings_instance of Addon Form Settings.
988
  */
989
  $addon_meta_data = apply_filters(
990
  'forminator_addon_mailchimp_metadata',
1004
  *
1005
  * @since 1.1
1006
  *
1007
+ * @param int $form_id current Form ID.
1008
+ * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model.
1009
+ * @param array $addon_meta_data addon meta data.
1010
+ * @param Forminator_Addon_Form_Settings_Abstract|null $form_settings_instance of Addon Form Settings.
1011
  */
1012
  do_action(
1013
  'forminator_addon_mailchimp_on_before_delete_submission',
1049
  return true;
1050
 
1051
  } catch ( Forminator_Addon_Mailchimp_Wp_Api_Not_Found_Exception $e ) {
1052
+ // its not found, probably already deleted on mailchimp.
1053
  return true;
1054
  } catch ( Forminator_Addon_Mailchimp_Exception $e ) {
1055
+ // handle all internal addon exceptions with `Forminator_Addon_Mailchimp_Exception`.
1056
 
1057
+ // use wp_error, for future usage it can be returned to page entries.
1058
  $wp_error = new WP_Error( 'forminator_addon_mailchimp_delete_member', $e->getMessage() );
1059
+ // handle this in addon by self, since page entries cant handle error messages on delete yet.
1060
  wp_die(
1061
  esc_html( $wp_error->get_error_message() ),
1062
  esc_html( $this->addon->get_title() ),
1081
  * @return array
1082
  */
1083
  public static function get_valid_addon_meta_data_value( $addon_meta_data ) {
1084
+ // preliminary check of addon_meta_data.
1085
  if ( ! isset( $addon_meta_data[0] ) || ! is_array( $addon_meta_data[0] ) ) {
1086
  return array();
1087
  }
1088
 
1089
  $addon_meta_data = $addon_meta_data[0];
1090
 
1091
+ // make sure its `status`, because we only add this.
1092
  if ( 'status' !== $addon_meta_data['name'] ) {
1093
  return array();
1094
  }
1110
  */
1111
  public static function get_delete_member_url_from_addon_meta_data( $addon_meta_data ) {
1112
 
1113
+ // delete links available on data_received of mailchimp.
1114
  /** == Addon meta data reference ==*/
1115
  //[
1116
+ // {.
1117
  // "name": "status",
1118
+ // "value": {.
1119
  // "is_sent": true,
1120
+ // "description": "Successfully added or updated member on Mailchimp list",.
1121
+ // "data_sent": {.
1122
  // ...
1123
  // },
1124
+ // "data_received": {.
1125
  // "id": "XXXXXXX",
1126
  // ...
1127
+ // "list_id": "XXXXXXX",.
1128
+ // "_links": [.
1129
+ // {.
1130
  // "rel": "upsert",
1131
+ // "href": "https:\/\/us9.api.mailchimp.com\/3.0\/lists\/XXXXXXX\/members\/XXXXXXX",.
1132
+ // "method": "PUT",.
1133
+ // "targetSchema": "https:\/\/us9.api.mailchimp.com\/schema\/3.0\/Definitions\/Lists\/Members\/Response.json",.
1134
+ // "schema": "https:\/\/us9.api.mailchimp.com\/schema\/3.0\/Definitions\/Lists\/Members\/PUT.json".
1135
+ // },.
1136
+ // {.
1137
  // "rel": "delete",
1138
+ // "href": "https:\/\/us9.api.mailchimp.com\/3.0\/lists\/XXXXXXX\/members\/XXXXXXX",.
1139
+ // "method": "DELETE".
1140
+ // },.
1141
  // ...
1142
+ // ].
1143
+ // },.
1144
+ // "url_request": "https:\/\/us9.api.mailchimp.com\/3.0\/lists\/XXXX\/members\/XXXXXXX".
1145
+ // }.
1146
+ // }.
1147
  //]
1148
  /** == Addon meta data reference ==*/
1149
 
1151
 
1152
  $meta_data_value = self::get_valid_addon_meta_data_value( $addon_meta_data );
1153
  if ( empty( $meta_data_value ) ) {
1154
+ // probably this entry added before connected to mailchimp, mark it as okay to delete entry.
1155
  return '';
1156
  }
1157
 
1158
  if ( isset( $meta_data_value['is_sent'] ) && ! $meta_data_value['is_sent'] ) {
1159
+ // its not sent to mailchimp so it won't have delete member uri.
1160
  return '';
1161
  }
1162
 
1163
  if ( ! isset( $meta_data_value['data_received'] ) || ! is_object( $meta_data_value['data_received'] ) ) {
1164
+ // something is happened on addon meta data.
1165
  return '';
1166
  }
1167
 
1168
  $data_received = $meta_data_value['data_received'];
1169
 
1170
  if ( ! isset( $data_received->_links ) || ! is_array( $data_received->_links ) ) {
1171
+ // something is happened on addon meta data.
1172
  return '';
1173
  }
1174
 
addons/pro/mailchimp/class-forminator-addon-mailchimp-form-settings.php CHANGED
@@ -149,7 +149,7 @@ class Forminator_Addon_Mailchimp_Form_Settings extends Forminator_Addon_Form_Set
149
  $mail_lists = $api->get_all_lists();
150
  $lists = wp_list_pluck( $mail_lists, 'name', 'id' );
151
 
152
- // Get mailchimp list to be selected, bail on empty
153
  if ( empty( $mail_lists ) ) {
154
  throw new Forminator_Addon_Mailchimp_Exception( 'Your Mailchimp Audiences is empty, please create one.' );
155
  }
@@ -161,7 +161,7 @@ class Forminator_Addon_Mailchimp_Form_Settings extends Forminator_Addon_Form_Set
161
  $html_select_mail_list .= self::refresh_button();
162
  $html_select_mail_list .= '</div>';
163
 
164
- // logic when user submit mail list
165
  if ( $is_submit ) {
166
  forminator_addon_maybe_log( __METHOD__, '$submitted_data', $submitted_data );
167
  $mail_list_name = $this->get_choosen_mail_list_name( $mail_lists, $submitted_data );
@@ -190,7 +190,7 @@ class Forminator_Addon_Mailchimp_Form_Settings extends Forminator_Addon_Form_Set
190
  $this->addon_form_settings['enable_double_opt_in'] = 0;
191
  }
192
 
193
- // GDPR fields
194
  if ( Forminator_Addon_Mailchimp::is_enable_gdpr() ) {
195
  if ( isset( $submitted_data['enable_gdpr'] ) ) {
196
  $this->addon_form_settings['enable_gdpr'] = $submitted_data['enable_gdpr'];
@@ -212,7 +212,7 @@ class Forminator_Addon_Mailchimp_Form_Settings extends Forminator_Addon_Form_Set
212
  </div>';
213
 
214
  } catch ( Forminator_Addon_Mailchimp_Form_Settings_Exception $e ) {
215
- // send errors with related input
216
  $input_error_messages = $e->get_input_exceptions();
217
  if ( isset( $input_error_messages['mail_list_id'] ) ) {
218
  $html_field_mail_list
@@ -223,12 +223,12 @@ class Forminator_Addon_Mailchimp_Form_Settings extends Forminator_Addon_Form_Set
223
  </div>';
224
  }
225
  } catch ( Forminator_Addon_Mailchimp_Exception $e ) {
226
- // send error back to client
227
  $error_message = '<div class="sui-notice sui-notice-error"><p>' . $e->getMessage() . '</p></div>';
228
  }
229
 
230
  $buttons = array();
231
- // add disconnect button if already is_form_connected
232
  if ( $this->addon->is_form_connected( $this->form_id ) ) {
233
  $buttons['disconnect']['markup'] = Forminator_Addon_Mailchimp::get_button_markup(
234
  esc_html__( 'Deactivate', 'forminator' ),
@@ -715,7 +715,7 @@ class Forminator_Addon_Mailchimp_Form_Settings extends Forminator_Addon_Form_Set
715
  $input_error_messages = array();
716
 
717
  try {
718
- // get merge fields
719
  $mailchimp_fields_list_request = $this->addon->get_api()->get_list_merge_fields( $this->addon_form_settings['mail_list_id'], array() );
720
  $mailchimp_required_fields = array();
721
  $mailchimp_required_fields_ids = array();
@@ -740,7 +740,7 @@ class Forminator_Addon_Mailchimp_Form_Settings extends Forminator_Addon_Form_Set
740
  }
741
  }
742
 
743
- // find type of email
744
  $email_fields = array();
745
  foreach ( $this->form_fields as $form_field ) {
746
  if ( 'email' === $form_field['type'] ) {
@@ -748,7 +748,7 @@ class Forminator_Addon_Mailchimp_Form_Settings extends Forminator_Addon_Form_Set
748
  }
749
  }
750
 
751
- // EMAIL
752
  $current_data['fields_map']['EMAIL'] = '';
753
  if ( isset( $submitted_data['fields_map']['EMAIL'] ) ) {
754
  $current_data['fields_map']['EMAIL'] = $submitted_data['fields_map']['EMAIL'];
@@ -899,7 +899,7 @@ class Forminator_Addon_Mailchimp_Form_Settings extends Forminator_Addon_Form_Set
899
  $address_require_sign = 'addr2' === $addr ? '' : $require_sign;
900
  ?>
901
  <tr>
902
- <td><?php echo esc_html( $item->name . ' - ' . $address ); ?> <?php echo esc_html( $address_require_sign ); ?></td>
903
  <td>
904
  <div class="sui-form-field {{$error_css_class_<?php echo esc_attr( $item->tag ); ?>_<?php echo esc_attr( $addr ); ?>}}">
905
  <select class="sui-select" name="fields_map[<?php echo esc_attr( $item->tag ); ?>][<?php echo esc_attr( $addr ); ?>]">
@@ -920,7 +920,7 @@ class Forminator_Addon_Mailchimp_Form_Settings extends Forminator_Addon_Form_Set
920
  } else {
921
  ?>
922
  <tr>
923
- <td><?php echo esc_html( $item->name ); ?> <?php echo $require_sign; ?></td>
924
  <td>
925
  <div class="sui-form-field {{$error_css_class_<?php echo esc_attr( $item->tag ); ?>}}">
926
  <select class="sui-select" name="fields_map[<?php echo esc_attr( $item->tag ); ?>]">
@@ -1101,13 +1101,13 @@ class Forminator_Addon_Mailchimp_Form_Settings extends Forminator_Addon_Form_Set
1101
  $this->addon_form_settings['fields_map'] = array();
1102
  }
1103
 
1104
- // set fields_map from post_data for reuse
1105
  foreach ( $post_data as $mailchimp_field_tag => $forminator_field_id ) {
1106
  $this->addon_form_settings['fields_map'][ $mailchimp_field_tag ] = $post_data[ $mailchimp_field_tag ];
1107
  }
1108
 
1109
  $input_exceptions = new Forminator_Addon_Mailchimp_Form_Settings_Exception();
1110
- // EMAIL : super required**
1111
  if ( ! isset( $post_data['EMAIL'] ) || empty( $post_data['EMAIL'] ) ) {
1112
  $this->_update_form_settings_error_message = __( 'Please choose valid Forminator field for email address.', 'forminator' );
1113
  $input_exceptions->add_input_exception( $this->_update_form_settings_error_message, 'EMAIL' );
@@ -1136,7 +1136,7 @@ class Forminator_Addon_Mailchimp_Form_Settings extends Forminator_Addon_Form_Set
1136
  }
1137
  }
1138
 
1139
- // Check availibility on forminator field
1140
  foreach ( $this->addon_form_settings['fields_map'] as $mailchimp_field_tag => $forminator_field_id ) {
1141
  if ( empty( $forminator_field_id ) ) {
1142
  continue;
@@ -1231,7 +1231,7 @@ class Forminator_Addon_Mailchimp_Form_Settings extends Forminator_Addon_Form_Set
1231
  public function step_choose_mail_list_is_completed() {
1232
  $this->addon_form_settings = $this->get_form_settings_values();
1233
  if ( ! isset( $this->addon_form_settings['mail_list_id'] ) ) {
1234
- // preliminary value
1235
  $this->addon_form_settings['mail_list_id'] = 0;
1236
 
1237
  return false;
149
  $mail_lists = $api->get_all_lists();
150
  $lists = wp_list_pluck( $mail_lists, 'name', 'id' );
151
 
152
+ // Get mailchimp list to be selected, bail on empty.
153
  if ( empty( $mail_lists ) ) {
154
  throw new Forminator_Addon_Mailchimp_Exception( 'Your Mailchimp Audiences is empty, please create one.' );
155
  }
161
  $html_select_mail_list .= self::refresh_button();
162
  $html_select_mail_list .= '</div>';
163
 
164
+ // logic when user submit mail list.
165
  if ( $is_submit ) {
166
  forminator_addon_maybe_log( __METHOD__, '$submitted_data', $submitted_data );
167
  $mail_list_name = $this->get_choosen_mail_list_name( $mail_lists, $submitted_data );
190
  $this->addon_form_settings['enable_double_opt_in'] = 0;
191
  }
192
 
193
+ // GDPR fields.
194
  if ( Forminator_Addon_Mailchimp::is_enable_gdpr() ) {
195
  if ( isset( $submitted_data['enable_gdpr'] ) ) {
196
  $this->addon_form_settings['enable_gdpr'] = $submitted_data['enable_gdpr'];
212
  </div>';
213
 
214
  } catch ( Forminator_Addon_Mailchimp_Form_Settings_Exception $e ) {
215
+ // send errors with related input.
216
  $input_error_messages = $e->get_input_exceptions();
217
  if ( isset( $input_error_messages['mail_list_id'] ) ) {
218
  $html_field_mail_list
223
  </div>';
224
  }
225
  } catch ( Forminator_Addon_Mailchimp_Exception $e ) {
226
+ // send error back to client.
227
  $error_message = '<div class="sui-notice sui-notice-error"><p>' . $e->getMessage() . '</p></div>';
228
  }
229
 
230
  $buttons = array();
231
+ // add disconnect button if already is_form_connected.
232
  if ( $this->addon->is_form_connected( $this->form_id ) ) {
233
  $buttons['disconnect']['markup'] = Forminator_Addon_Mailchimp::get_button_markup(
234
  esc_html__( 'Deactivate', 'forminator' ),
715
  $input_error_messages = array();
716
 
717
  try {
718
+ // get merge fields.
719
  $mailchimp_fields_list_request = $this->addon->get_api()->get_list_merge_fields( $this->addon_form_settings['mail_list_id'], array() );
720
  $mailchimp_required_fields = array();
721
  $mailchimp_required_fields_ids = array();
740
  }
741
  }
742
 
743
+ // find type of email.
744
  $email_fields = array();
745
  foreach ( $this->form_fields as $form_field ) {
746
  if ( 'email' === $form_field['type'] ) {
748
  }
749
  }
750
 
751
+ // EMAIL.
752
  $current_data['fields_map']['EMAIL'] = '';
753
  if ( isset( $submitted_data['fields_map']['EMAIL'] ) ) {
754
  $current_data['fields_map']['EMAIL'] = $submitted_data['fields_map']['EMAIL'];
899
  $address_require_sign = 'addr2' === $addr ? '' : $require_sign;
900
  ?>
901
  <tr>
902
+ <td><?php echo esc_html( $item->name . ' - ' . $address ); ?> <?php echo wp_kses_post( $address_require_sign ); ?></td>
903
  <td>
904
  <div class="sui-form-field {{$error_css_class_<?php echo esc_attr( $item->tag ); ?>_<?php echo esc_attr( $addr ); ?>}}">
905
  <select class="sui-select" name="fields_map[<?php echo esc_attr( $item->tag ); ?>][<?php echo esc_attr( $addr ); ?>]">
920
  } else {
921
  ?>
922
  <tr>
923
+ <td><?php echo esc_html( $item->name ); ?> <?php echo wp_kses_post( $require_sign ); ?></td>
924
  <td>
925
  <div class="sui-form-field {{$error_css_class_<?php echo esc_attr( $item->tag ); ?>}}">
926
  <select class="sui-select" name="fields_map[<?php echo esc_attr( $item->tag ); ?>]">
1101
  $this->addon_form_settings['fields_map'] = array();
1102
  }
1103
 
1104
+ // set fields_map from post_data for reuse.
1105
  foreach ( $post_data as $mailchimp_field_tag => $forminator_field_id ) {
1106
  $this->addon_form_settings['fields_map'][ $mailchimp_field_tag ] = $post_data[ $mailchimp_field_tag ];
1107
  }
1108
 
1109
  $input_exceptions = new Forminator_Addon_Mailchimp_Form_Settings_Exception();
1110
+ // EMAIL : super required**.
1111
  if ( ! isset( $post_data['EMAIL'] ) || empty( $post_data['EMAIL'] ) ) {
1112
  $this->_update_form_settings_error_message = __( 'Please choose valid Forminator field for email address.', 'forminator' );
1113
  $input_exceptions->add_input_exception( $this->_update_form_settings_error_message, 'EMAIL' );
1136
  }
1137
  }
1138
 
1139
+ // Check availibility on forminator field.
1140
  foreach ( $this->addon_form_settings['fields_map'] as $mailchimp_field_tag => $forminator_field_id ) {
1141
  if ( empty( $forminator_field_id ) ) {
1142
  continue;
1231
  public function step_choose_mail_list_is_completed() {
1232
  $this->addon_form_settings = $this->get_form_settings_values();
1233
  if ( ! isset( $this->addon_form_settings['mail_list_id'] ) ) {
1234
+ // preliminary value.
1235
  $this->addon_form_settings['mail_list_id'] = 0;
1236
 
1237
  return false;
addons/pro/mailchimp/class-forminator-addon-mailchimp-quiz-hooks.php CHANGED
@@ -55,7 +55,7 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
55
  * @since 1.0 Mailchimp Addon
56
  */
57
  public function on_after_render_form_fields() {
58
- // Render GDPR field if enabled
59
  if ( Forminator_Addon_Mailchimp::is_enable_gdpr() ) {
60
  $addon_setting_values = $this->quiz_settings_instance->get_quiz_settings_values();
61
  if ( isset( $addon_setting_values['enable_gdpr'] ) && $addon_setting_values['enable_gdpr'] ) {
@@ -73,8 +73,8 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
73
  *
74
  * @since 1.1
75
  *
76
- * @param int $quiz_id current Quiz ID
77
- * @param Forminator_Addon_Mailchimp_Quiz_Settings $quiz_settings_instance Mailchimp quiz settings Instance
78
  */
79
  do_action(
80
  'forminator_addon_mailchimp_on_after_render_quiz_fields',
@@ -98,7 +98,7 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
98
  $html = '<div class="forminator-row"><div id="field-' . $input_id . '" class="forminator-col forminator-col-12"><div class="forminator-field">';
99
  $html .= '<div class="forminator-field--label"><label class="forminator-label" id="forminator-label-' . $input_id . '">' . esc_html_e( 'Mailchimp GDPR', 'forminator' )
100
  . '</label></div>';
101
- // matching checkbox with design
102
  $form_settings = $this->quiz_settings_instance->get_quiz_settings();
103
  $design_class = self::get_form_setting_value_as( $form_settings, 'form-style', 'default', 'string' );
104
  if ( 'none' === $design_class ) {
@@ -219,8 +219,8 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
219
  * @since 1.1
220
  *
221
  * @param array $submitted_data
222
- * @param int $quiz_id current Quiz ID
223
- * @param Forminator_Addon_Mailchimp_Quiz_Settings $quiz_settings_instance Mailchimp API Form Settings instance
224
  */
225
  $submitted_data = apply_filters(
226
  'forminator_addon_mailchimp_form_submitted_data',
@@ -237,9 +237,9 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
237
  * @since 1.1
238
  *
239
  * @param bool $is_success
240
- * @param int $quiz_id current Form ID
241
  * @param array $submitted_data
242
- * @param Forminator_Addon_Mailchimp_Quiz_Settings $quiz_settings_instance Mailchimp API Form Settings instance
243
  */
244
  $is_success = apply_filters(
245
  'forminator_addon_mailchimp_on_form_submit_result',
@@ -249,9 +249,9 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
249
  $quiz_settings_instance
250
  );
251
 
252
- // process filter
253
  if ( true !== $is_success ) {
254
- // only update `_submit_form_error_message` when not empty
255
  if ( ! empty( $is_success ) ) {
256
  $this->_submit_quiz_error_message = (string) $is_success;
257
  }
@@ -259,13 +259,13 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
259
  return $is_success;
260
  }
261
 
262
- // only exec this below when filter return true
263
- // check is enabled
264
  if ( ! Forminator_Addon_Mailchimp::is_enable_gdpr() ) {
265
  return true;
266
  }
267
 
268
- // Only flag check for gdpr
269
  if ( ! isset( $submitted_data['forminator-addon-mailchimp-gdpr'] ) || '1' !== $submitted_data['forminator-addon-mailchimp-gdpr'] ) {
270
  $this->gdpr_is_checked = false;
271
  }
@@ -296,8 +296,8 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
296
  * @since 1.1
297
  *
298
  * @param array $submitted_data
299
- * @param int $quiz_id current Quiz ID
300
- * @param Forminator_Addon_Mailchimp_Quiz_Settings $quiz_settings_instance Mailchimp API Quiz Settings instance
301
  */
302
  $submitted_data = apply_filters(
303
  'forminator_addon_mailchimp_quiz_submitted_data',
@@ -318,7 +318,7 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
318
  $submitted_data = get_addons_lead_form_entry_data( $quiz_settings, $submitted_data, $addons_fields );
319
  $submitted_data = array_merge( $submitted_data, $quiz_submitted_data );
320
 
321
- // initialize as null
322
  $mailchimp_api = null;
323
 
324
  $settings_values = $this->addon->get_settings_values();
@@ -334,7 +334,7 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
334
  $mailchimp_api = $this->addon->get_api();
335
 
336
  if ( Forminator_Addon_Mailchimp::is_enable_gdpr() ) {
337
- // GDPR
338
  if ( isset( $addon_setting_values['enable_gdpr'] ) && $addon_setting_values['enable_gdpr'] ) {
339
  if ( isset( $addon_setting_values['gdpr_text'] ) && ! empty( $addon_setting_values['gdpr_text'] ) ) {
340
  if ( ! $this->gdpr_is_checked ) {
@@ -351,7 +351,7 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
351
  }
352
  }
353
 
354
- // EMAIL : super required**
355
  if ( ! isset( $addon_setting_values['fields_map']['EMAIL'] ) ) {
356
  throw new Forminator_Addon_Mailchimp_Exception(/* translators: ... */
357
  sprintf( __( 'Required Field %1$s not mapped yet to Forminator Form Field, Please check your Mailchimp Configuration on Form Settings', 'forminator' ), 'EMAIL' )
@@ -419,7 +419,7 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
419
  }
420
  }
421
 
422
- // check if user already on the list
423
  $subscriber_hash = md5( strtolower( trim( $submitted_data[ $addon_setting_values['fields_map']['EMAIL'] ] ) ) );
424
 
425
  $is_double_opt_in_enabled = isset( $addon_setting_values['enable_double_opt_in'] ) && filter_var( $addon_setting_values['enable_double_opt_in'], FILTER_VALIDATE_BOOLEAN ) ? true : false;
@@ -429,11 +429,11 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
429
  }
430
 
431
  try {
432
- // keep subscribed if already subscribed
433
  $member_status_request = $mailchimp_api->get_member( $addon_setting_values['mail_list_id'], $subscriber_hash, array() );
434
  if ( isset( $member_status_request->status ) && ! empty( $member_status_request->status ) ) {
435
  if ( 'subscribed' === $member_status_request->status ) {
436
- // already subscribed, keep it subscribed, just update merge_fields
437
  $status = 'subscribed';
438
  }
439
  }
@@ -471,7 +471,7 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
471
 
472
  if ( isset( $element_value ) ) {
473
  $merge_fields[ $item->tag ] = $element_value;
474
- unset( $element_value ); // unset for next loop
475
  }
476
  }
477
  }
@@ -496,9 +496,9 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
496
  * @since 1.1
497
  *
498
  * @param string $mail_list_id
499
- * @param int $quiz_id current Form ID
500
- * @param array $submitted_data Submitted data
501
- * @param Forminator_Addon_Mailchimp_Quiz_Settings $quiz_settings_instance Mailchimp Form Settings
502
  */
503
  $mail_list_id = apply_filters(
504
  'forminator_addon_mailchimp_add_update_member_request_mail_list_id',
@@ -522,9 +522,9 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
522
  * @since 1.1
523
  *
524
  * @param array $args
525
- * @param int $quiz_id current Quiz ID
526
- * @param array $submitted_data Submitted data
527
- * @param Forminator_Addon_Mailchimp_Quiz_Settings $quiz_settings_instance Mailchimp Quiz Settings
528
  */
529
  $args = apply_filters(
530
  'forminator_addon_mailchimp_add_update_member_request_args',
@@ -542,9 +542,9 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
542
  *
543
  * @since 1.1
544
  *
545
- * @param int $quiz_id current Quiz ID
546
- * @param array $submitted_data Submitted data
547
- * @param Forminator_Addon_Mailchimp_Quiz_Settings $quiz_settings_instance Mailchimp Quiz Settings
548
  */
549
  do_action( 'forminator_addon_mailchimp_before_add_update_member', $quiz_id, $submitted_data, $quiz_settings_instance );
550
 
@@ -598,9 +598,9 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
598
  * @since 1.1
599
  *
600
  * @param array $entry_fields
601
- * @param int $quiz_id current Quiz ID
602
  * @param array $submitted_data
603
- * @param Forminator_Addon_Mailchimp_Quiz_Settings $quiz_settings_instance Mailchimp API Quiz Settings instance
604
  */
605
  $entry_fields = apply_filters(
606
  'forminator_addon_mailchimp_entry_fields',
@@ -643,9 +643,9 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
643
  * @since 1.1
644
  *
645
  * @param array $addon_meta_data
646
- * @param int $quiz_id current Quiz ID
647
- * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model
648
- * @param Forminator_Addon_Mailchimp_Quiz_Settings $quiz_settings_instance Mailchimp API quiz Settings instance
649
  */
650
  $addon_meta_datas = apply_filters(
651
  'forminator_addon_mailchimp_metadata',
@@ -665,11 +665,11 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
665
  *
666
  * @since 1.1
667
  *
668
- * @param array $entry_items row(s) to be displayed on entries page
669
- * @param int $quiz_id current Quiz ID
670
- * @param Forminator_Form_Entry_Model $entry_model Form Entry Model
671
- * @param array $addon_meta_data meta data saved by addon on entry fields
672
- * @param Forminator_Addon_Mailchimp_Quiz_Settings $quiz_settings_instance Mailchimp API quiz Settings instance
673
  */
674
  $entry_items = apply_filters(
675
  'forminator_addon_mailchimp_entry_items',
@@ -694,7 +694,7 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
694
  * @return array
695
  */
696
  private function format_metadata_for_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {
697
- // make sure its `status`, because we only add this
698
  if ( 0 !== strpos( $addon_meta_data['name'], 'status' ) ) {
699
  return array();
700
  }
@@ -742,7 +742,7 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
742
  }
743
 
744
  if ( Forminator_Addon_Mailchimp::is_show_full_log() ) {
745
- // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_MAILCHIMP_SHOW_FULL_LOG', true)`
746
  if ( isset( $status['url_request'] ) ) {
747
  $sub_entries[] = array(
748
  'label' => __( 'API URL', 'forminator' ),
@@ -789,9 +789,9 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
789
  *
790
  * @since 1.1
791
  *
792
- * @param array $export_headers headers to be displayed on export file
793
- * @param int $quiz_id current Quiz ID
794
- * @param Forminator_Addon_Mailchimp_Quiz_Settings $quiz_settings_instance Mailchimp API Quiz Settings instance
795
  */
796
  $export_headers = apply_filters(
797
  'forminator_addon_mailchimp_export_headers',
@@ -825,8 +825,8 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
825
  * @since 1.1
826
  *
827
  * @param array $addon_meta_data
828
- * @param int $quiz_id current quiz ID
829
- * @param Forminator_Addon_Mailchimp_Quiz_Settings $quiz_settings_instance Mailchimp API Form Settings instance
830
  */
831
  $addon_meta_data = apply_filters(
832
  'forminator_addon_mailchimp_metadata',
@@ -844,11 +844,11 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
844
  *
845
  * @since 1.1
846
  *
847
- * @param array $export_columns column to be exported
848
- * @param int $quiz_id current quiz ID
849
- * @param Forminator_Form_Entry_Model $entry_model Form Entry Model
850
- * @param array $addon_meta_data meta data saved by addon on entry fields
851
- * @param Forminator_Addon_Mailchimp_Quiz_Settings $quiz_settings_instance Mailchimp API quiz Settings instance
852
  */
853
  $export_columns = apply_filters(
854
  'forminator_addon_mailchimp_export_columns',
@@ -874,15 +874,15 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
874
  * @return string
875
  */
876
  private function get_quiz_addon_meta_data( $addon_meta_data, $key, $default = '' ) {
877
- // only process first addon meta datas since we only save one
878
- // no entry fields was added before
879
  if ( ! isset( $addon_meta_data[0] ) || ! is_array( $addon_meta_data[0] ) ) {
880
  return $default;
881
  }
882
 
883
  $addon_meta_data = $addon_meta_data[0];
884
 
885
- // make sure its `status`, because we only add this
886
  if ( 'status' !== $addon_meta_data['name'] ) {
887
  return $default;
888
  }
@@ -909,7 +909,7 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
909
  * @return bool
910
  */
911
  public function on_before_delete_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {
912
- // attach hook first
913
  $quiz_id = $this->quiz_id;
914
  $quiz_settings_instance = $this->quiz_settings_instance;
915
 
@@ -925,9 +925,9 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
925
  * @since 1.1
926
  *
927
  * @param array $addon_meta_data
928
- * @param int $quiz_id current quiz ID
929
- * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model
930
- * @param Forminator_Addon_Quiz_Settings_Abstract|null $quiz_settings_instance of Addon quiz Settings
931
  */
932
  $addon_meta_data = apply_filters(
933
  'forminator_addon_mailchimp_metadata',
@@ -947,10 +947,10 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
947
  *
948
  * @since 1.1
949
  *
950
- * @param int $quiz_id current quiz ID
951
- * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model
952
- * @param array $addon_meta_data addon meta data
953
- * @param Forminator_Addon_Quiz_Settings_Abstract|null $quiz_settings_instance of Addon quiz Settings
954
  */
955
  do_action(
956
  'forminator_addon_mailchimp_on_before_delete_submission',
@@ -992,14 +992,14 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
992
  return true;
993
 
994
  } catch ( Forminator_Addon_Mailchimp_Wp_Api_Not_Found_Exception $e ) {
995
- // its not found, probably already deleted on mailchimp
996
  return true;
997
  } catch ( Forminator_Addon_Mailchimp_Exception $e ) {
998
- // handle all internal addon exceptions with `Forminator_Addon_Mailchimp_Exception`
999
 
1000
- // use wp_error, for future usage it can be returned to page entries
1001
  $wp_error = new WP_Error( 'forminator_addon_mailchimp_delete_member', $e->getMessage() );
1002
- // handle this in addon by self, since page entries cant handle error messages on delete yet
1003
  wp_die(
1004
  esc_html( $wp_error->get_error_message() ),
1005
  esc_html( $this->addon->get_title() ),
@@ -1024,14 +1024,14 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
1024
  * @return array
1025
  */
1026
  public static function get_valid_addon_meta_data_value( $addon_meta_data ) {
1027
- // preliminary check of addon_meta_data
1028
  if ( ! isset( $addon_meta_data[0] ) || ! is_array( $addon_meta_data[0] ) ) {
1029
  return array();
1030
  }
1031
 
1032
  $addon_meta_data = $addon_meta_data[0];
1033
 
1034
- // make sure its `status`, because we only add this
1035
  if ( 'status' !== $addon_meta_data['name'] ) {
1036
  return array();
1037
  }
@@ -1053,40 +1053,40 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
1053
  */
1054
  public static function get_delete_member_url_from_addon_meta_data( $addon_meta_data ) {
1055
 
1056
- // delete links available on data_received of mailchimp
1057
  /** == Addon meta data reference ==*/
1058
  //[
1059
- // {
1060
  // "name": "status",
1061
- // "value": {
1062
  // "is_sent": true,
1063
- // "description": "Successfully added or updated member on Mailchimp list",
1064
- // "data_sent": {
1065
  // ...
1066
  // },
1067
- // "data_received": {
1068
  // "id": "XXXXXXX",
1069
  // ...
1070
- // "list_id": "XXXXXXX",
1071
- // "_links": [
1072
- // {
1073
  // "rel": "upsert",
1074
- // "href": "https:\/\/us9.api.mailchimp.com\/3.0\/lists\/XXXXXXX\/members\/XXXXXXX",
1075
- // "method": "PUT",
1076
- // "targetSchema": "https:\/\/us9.api.mailchimp.com\/schema\/3.0\/Definitions\/Lists\/Members\/Response.json",
1077
- // "schema": "https:\/\/us9.api.mailchimp.com\/schema\/3.0\/Definitions\/Lists\/Members\/PUT.json"
1078
- // },
1079
- // {
1080
  // "rel": "delete",
1081
- // "href": "https:\/\/us9.api.mailchimp.com\/3.0\/lists\/XXXXXXX\/members\/XXXXXXX",
1082
- // "method": "DELETE"
1083
- // },
1084
  // ...
1085
- // ]
1086
- // },
1087
- // "url_request": "https:\/\/us9.api.mailchimp.com\/3.0\/lists\/XXXX\/members\/XXXXXXX"
1088
- // }
1089
- // }
1090
  //]
1091
  /** == Addon meta data reference ==*/
1092
 
@@ -1094,24 +1094,24 @@ class Forminator_Addon_Mailchimp_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_
1094
 
1095
  $meta_data_value = self::get_valid_addon_meta_data_value( $addon_meta_data );
1096
  if ( empty( $meta_data_value ) ) {
1097
- // probably this entry added before connected to mailchimp, mark it as okay to delete entry
1098
  return '';
1099
  }
1100
 
1101
  if ( isset( $meta_data_value['is_sent'] ) && ! $meta_data_value['is_sent'] ) {
1102
- // its not sent to mailchimp so it won't have delete member uri
1103
  return '';
1104
  }
1105
 
1106
  if ( ! isset( $meta_data_value['data_received'] ) || ! is_object( $meta_data_value['data_received'] ) ) {
1107
- // something is happened on addon meta data
1108
  return '';
1109
  }
1110
 
1111
  $data_received = $meta_data_value['data_received'];
1112
 
1113
  if ( ! isset( $data_received->_links ) || ! is_array( $data_received->_links ) ) {
1114
- // something is happened on addon meta data
1115
  return '';
1116
  }
1117
 
55
  * @since 1.0 Mailchimp Addon
56
  */
57
  public function on_after_render_form_fields() {
58
+ // Render GDPR field if enabled.
59
  if ( Forminator_Addon_Mailchimp::is_enable_gdpr() ) {
60
  $addon_setting_values = $this->quiz_settings_instance->get_quiz_settings_values();
61
  if ( isset( $addon_setting_values['enable_gdpr'] ) && $addon_setting_values['enable_gdpr'] ) {
73
  *
74
  * @since 1.1
75
  *
76
+ * @param int $quiz_id current Quiz ID.
77
+ * @param Forminator_Addon_Mailchimp_Quiz_Settings $quiz_settings_instance Mailchimp quiz settings Instance.
78
  */
79
  do_action(
80
  'forminator_addon_mailchimp_on_after_render_quiz_fields',
98
  $html = '<div class="forminator-row"><div id="field-' . $input_id . '" class="forminator-col forminator-col-12"><div class="forminator-field">';
99
  $html .= '<div class="forminator-field--label"><label class="forminator-label" id="forminator-label-' . $input_id . '">' . esc_html_e( 'Mailchimp GDPR', 'forminator' )
100
  . '</label></div>';
101
+ // matching checkbox with design.
102
  $form_settings = $this->quiz_settings_instance->get_quiz_settings();
103
  $design_class = self::get_form_setting_value_as( $form_settings, 'form-style', 'default', 'string' );
104
  if ( 'none' === $design_class ) {
219
  * @since 1.1
220
  *
221
  * @param array $submitted_data
222
+ * @param int $quiz_id current Quiz ID.
223
+ * @param Forminator_Addon_Mailchimp_Quiz_Settings $quiz_settings_instance Mailchimp API Form Settings instance.
224
  */
225
  $submitted_data = apply_filters(
226
  'forminator_addon_mailchimp_form_submitted_data',
237
  * @since 1.1
238
  *
239
  * @param bool $is_success
240
+ * @param int $quiz_id current Form ID.
241
  * @param array $submitted_data
242
+ * @param Forminator_Addon_Mailchimp_Quiz_Settings $quiz_settings_instance Mailchimp API Form Settings instance.
243
  */
244
  $is_success = apply_filters(
245
  'forminator_addon_mailchimp_on_form_submit_result',
249
  $quiz_settings_instance
250
  );
251
 
252
+ // process filter.
253
  if ( true !== $is_success ) {
254
+ // only update `_submit_form_error_message` when not empty.
255
  if ( ! empty( $is_success ) ) {
256
  $this->_submit_quiz_error_message = (string) $is_success;
257
  }
259
  return $is_success;
260
  }
261
 
262
+ // only exec this below when filter return true.
263
+ // check is enabled.
264
  if ( ! Forminator_Addon_Mailchimp::is_enable_gdpr() ) {
265
  return true;
266
  }
267
 
268
+ // Only flag check for gdpr.
269
  if ( ! isset( $submitted_data['forminator-addon-mailchimp-gdpr'] ) || '1' !== $submitted_data['forminator-addon-mailchimp-gdpr'] ) {
270
  $this->gdpr_is_checked = false;
271
  }
296
  * @since 1.1
297
  *
298
  * @param array $submitted_data
299
+ * @param int $quiz_id current Quiz ID.
300
+ * @param Forminator_Addon_Mailchimp_Quiz_Settings $quiz_settings_instance Mailchimp API Quiz Settings instance.
301
  */
302
  $submitted_data = apply_filters(
303
  'forminator_addon_mailchimp_quiz_submitted_data',
318
  $submitted_data = get_addons_lead_form_entry_data( $quiz_settings, $submitted_data, $addons_fields );
319
  $submitted_data = array_merge( $submitted_data, $quiz_submitted_data );
320
 
321
+ // initialize as null.
322
  $mailchimp_api = null;
323
 
324
  $settings_values = $this->addon->get_settings_values();
334
  $mailchimp_api = $this->addon->get_api();
335
 
336
  if ( Forminator_Addon_Mailchimp::is_enable_gdpr() ) {
337
+ // GDPR.
338
  if ( isset( $addon_setting_values['enable_gdpr'] ) && $addon_setting_values['enable_gdpr'] ) {
339
  if ( isset( $addon_setting_values['gdpr_text'] ) && ! empty( $addon_setting_values['gdpr_text'] ) ) {
340
  if ( ! $this->gdpr_is_checked ) {
351
  }
352
  }
353
 
354
+ // EMAIL : super required**.
355
  if ( ! isset( $addon_setting_values['fields_map']['EMAIL'] ) ) {
356
  throw new Forminator_Addon_Mailchimp_Exception(/* translators: ... */
357
  sprintf( __( 'Required Field %1$s not mapped yet to Forminator Form Field, Please check your Mailchimp Configuration on Form Settings', 'forminator' ), 'EMAIL' )
419
  }
420
  }
421
 
422
+ // check if user already on the list.
423
  $subscriber_hash = md5( strtolower( trim( $submitted_data[ $addon_setting_values['fields_map']['EMAIL'] ] ) ) );
424
 
425
  $is_double_opt_in_enabled = isset( $addon_setting_values['enable_double_opt_in'] ) && filter_var( $addon_setting_values['enable_double_opt_in'], FILTER_VALIDATE_BOOLEAN ) ? true : false;
429
  }
430
 
431
  try {
432
+ // keep subscribed if already subscribed.
433
  $member_status_request = $mailchimp_api->get_member( $addon_setting_values['mail_list_id'], $subscriber_hash, array() );
434
  if ( isset( $member_status_request->status ) && ! empty( $member_status_request->status ) ) {
435
  if ( 'subscribed' === $member_status_request->status ) {
436
+ // already subscribed, keep it subscribed, just update merge_fields.
437
  $status = 'subscribed';
438
  }
439
  }
471
 
472
  if ( isset( $element_value ) ) {
473
  $merge_fields[ $item->tag ] = $element_value;
474
+ unset( $element_value ); // unset for next loop.
475
  }
476
  }
477
  }
496
  * @since 1.1
497
  *
498
  * @param string $mail_list_id
499
+ * @param int $quiz_id current Form ID.
500
+ * @param array $submitted_data Submitted data.
501
+ * @param Forminator_Addon_Mailchimp_Quiz_Settings $quiz_settings_instance Mailchimp Form Settings.
502
  */
503
  $mail_list_id = apply_filters(
504
  'forminator_addon_mailchimp_add_update_member_request_mail_list_id',
522
  * @since 1.1
523
  *
524
  * @param array $args
525
+ * @param int $quiz_id current Quiz ID.
526
+ * @param array $submitted_data Submitted data.
527
+ * @param Forminator_Addon_Mailchimp_Quiz_Settings $quiz_settings_instance Mailchimp Quiz Settings.
528
  */
529
  $args = apply_filters(
530
  'forminator_addon_mailchimp_add_update_member_request_args',
542
  *
543
  * @since 1.1
544
  *
545
+ * @param int $quiz_id current Quiz ID.
546
+ * @param array $submitted_data Submitted data.
547
+ * @param Forminator_Addon_Mailchimp_Quiz_Settings $quiz_settings_instance Mailchimp Quiz Settings.
548
  */
549
  do_action( 'forminator_addon_mailchimp_before_add_update_member', $quiz_id, $submitted_data, $quiz_settings_instance );
550
 
598
  * @since 1.1
599
  *
600
  * @param array $entry_fields
601
+ * @param int $quiz_id current Quiz ID.
602
  * @param array $submitted_data
603
+ * @param Forminator_Addon_Mailchimp_Quiz_Settings $quiz_settings_instance Mailchimp API Quiz Settings instance.
604
  */
605
  $entry_fields = apply_filters(
606
  'forminator_addon_mailchimp_entry_fields',
643
  * @since 1.1
644
  *
645
  * @param array $addon_meta_data
646
+ * @param int $quiz_id current Quiz ID.
647
+ * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model.
648
+ * @param Forminator_Addon_Mailchimp_Quiz_Settings $quiz_settings_instance Mailchimp API quiz Settings instance.
649
  */
650
  $addon_meta_datas = apply_filters(
651
  'forminator_addon_mailchimp_metadata',
665
  *
666
  * @since 1.1
667
  *
668
+ * @param array $entry_items row(s) to be displayed on entries page.
669
+ * @param int $quiz_id current Quiz ID.
670
+ * @param Forminator_Form_Entry_Model $entry_model Form Entry Model.
671
+ * @param array $addon_meta_data meta data saved by addon on entry fields.
672
+ * @param Forminator_Addon_Mailchimp_Quiz_Settings $quiz_settings_instance Mailchimp API quiz Settings instance.
673
  */
674
  $entry_items = apply_filters(
675
  'forminator_addon_mailchimp_entry_items',
694
  * @return array
695
  */
696
  private function format_metadata_for_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {
697
+ // make sure its `status`, because we only add this.
698
  if ( 0 !== strpos( $addon_meta_data['name'], 'status' ) ) {
699
  return array();
700
  }
742
  }
743
 
744
  if ( Forminator_Addon_Mailchimp::is_show_full_log() ) {
745
+ // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_MAILCHIMP_SHOW_FULL_LOG', true)`.
746
  if ( isset( $status['url_request'] ) ) {
747
  $sub_entries[] = array(
748
  'label' => __( 'API URL', 'forminator' ),
789
  *
790
  * @since 1.1
791
  *
792
+ * @param array $export_headers headers to be displayed on export file.
793
+ * @param int $quiz_id current Quiz ID.
794
+ * @param Forminator_Addon_Mailchimp_Quiz_Settings $quiz_settings_instance Mailchimp API Quiz Settings instance.
795
  */
796
  $export_headers = apply_filters(
797
  'forminator_addon_mailchimp_export_headers',
825
  * @since 1.1
826
  *
827
  * @param array $addon_meta_data
828
+ * @param int $quiz_id current quiz ID.
829
+ * @param Forminator_Addon_Mailchimp_Quiz_Settings $quiz_settings_instance Mailchimp API Form Settings instance.
830
  */
831
  $addon_meta_data = apply_filters(
832
  'forminator_addon_mailchimp_metadata',
844
  *
845
  * @since 1.1
846
  *
847
+ * @param array $export_columns column to be exported.
848
+ * @param int $quiz_id current quiz ID.
849
+ * @param Forminator_Form_Entry_Model $entry_model Form Entry Model.
850
+ * @param array $addon_meta_data meta data saved by addon on entry fields.
851
+ * @param Forminator_Addon_Mailchimp_Quiz_Settings $quiz_settings_instance Mailchimp API quiz Settings instance.
852
  */
853
  $export_columns = apply_filters(
854
  'forminator_addon_mailchimp_export_columns',
874
  * @return string
875
  */
876
  private function get_quiz_addon_meta_data( $addon_meta_data, $key, $default = '' ) {
877
+ // only process first addon meta datas since we only save one.
878
+ // no entry fields was added before.
879
  if ( ! isset( $addon_meta_data[0] ) || ! is_array( $addon_meta_data[0] ) ) {
880
  return $default;
881
  }
882
 
883
  $addon_meta_data = $addon_meta_data[0];
884
 
885
+ // make sure its `status`, because we only add this.
886
  if ( 'status' !== $addon_meta_data['name'] ) {
887
  return $default;
888
  }
909
  * @return bool
910
  */
911
  public function on_before_delete_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {
912
+ // attach hook first.
913
  $quiz_id = $this->quiz_id;
914
  $quiz_settings_instance = $this->quiz_settings_instance;
915
 
925
  * @since 1.1
926
  *
927
  * @param array $addon_meta_data
928
+ * @param int $quiz_id current quiz ID.
929
+ * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model.
930
+ * @param Forminator_Addon_Quiz_Settings_Abstract|null $quiz_settings_instance of Addon quiz Settings.
931
  */
932
  $addon_meta_data = apply_filters(
933
  'forminator_addon_mailchimp_metadata',
947
  *
948
  * @since 1.1
949
  *
950
+ * @param int $quiz_id current quiz ID.
951
+ * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model.
952
+ * @param array $addon_meta_data addon meta data.
953
+ * @param Forminator_Addon_Quiz_Settings_Abstract|null $quiz_settings_instance of Addon quiz Settings.
954
  */
955
  do_action(
956
  'forminator_addon_mailchimp_on_before_delete_submission',
992
  return true;
993
 
994
  } catch ( Forminator_Addon_Mailchimp_Wp_Api_Not_Found_Exception $e ) {
995
+ // its not found, probably already deleted on mailchimp.
996
  return true;
997
  } catch ( Forminator_Addon_Mailchimp_Exception $e ) {
998
+ // handle all internal addon exceptions with `Forminator_Addon_Mailchimp_Exception`.
999
 
1000
+ // use wp_error, for future usage it can be returned to page entries.
1001
  $wp_error = new WP_Error( 'forminator_addon_mailchimp_delete_member', $e->getMessage() );
1002
+ // handle this in addon by self, since page entries cant handle error messages on delete yet.
1003
  wp_die(
1004
  esc_html( $wp_error->get_error_message() ),
1005
  esc_html( $this->addon->get_title() ),
1024
  * @return array
1025
  */
1026
  public static function get_valid_addon_meta_data_value( $addon_meta_data ) {
1027
+ // preliminary check of addon_meta_data.
1028
  if ( ! isset( $addon_meta_data[0] ) || ! is_array( $addon_meta_data[0] ) ) {
1029
  return array();
1030
  }
1031
 
1032
  $addon_meta_data = $addon_meta_data[0];
1033
 
1034
+ // make sure its `status`, because we only add this.
1035
  if ( 'status' !== $addon_meta_data['name'] ) {
1036
  return array();
1037
  }
1053
  */
1054
  public static function get_delete_member_url_from_addon_meta_data( $addon_meta_data ) {
1055
 
1056
+ // delete links available on data_received of mailchimp.
1057
  /** == Addon meta data reference ==*/
1058
  //[
1059
+ // {.
1060
  // "name": "status",
1061
+ // "value": {.
1062
  // "is_sent": true,
1063
+ // "description": "Successfully added or updated member on Mailchimp list",.
1064
+ // "data_sent": {.
1065
  // ...
1066
  // },
1067
+ // "data_received": {.
1068
  // "id": "XXXXXXX",
1069
  // ...
1070
+ // "list_id": "XXXXXXX",.
1071
+ // "_links": [.
1072
+ // {.
1073
  // "rel": "upsert",
1074
+ // "href": "https:\/\/us9.api.mailchimp.com\/3.0\/lists\/XXXXXXX\/members\/XXXXXXX",.
1075
+ // "method": "PUT",.
1076
+ // "targetSchema": "https:\/\/us9.api.mailchimp.com\/schema\/3.0\/Definitions\/Lists\/Members\/Response.json",.
1077
+ // "schema": "https:\/\/us9.api.mailchimp.com\/schema\/3.0\/Definitions\/Lists\/Members\/PUT.json".
1078
+ // },.
1079
+ // {.
1080
  // "rel": "delete",
1081
+ // "href": "https:\/\/us9.api.mailchimp.com\/3.0\/lists\/XXXXXXX\/members\/XXXXXXX",.
1082
+ // "method": "DELETE".
1083
+ // },.
1084
  // ...
1085
+ // ].
1086
+ // },.
1087
+ // "url_request": "https:\/\/us9.api.mailchimp.com\/3.0\/lists\/XXXX\/members\/XXXXXXX".
1088
+ // }.
1089
+ // }.
1090
  //]
1091
  /** == Addon meta data reference ==*/
1092
 
1094
 
1095
  $meta_data_value = self::get_valid_addon_meta_data_value( $addon_meta_data );
1096
  if ( empty( $meta_data_value ) ) {
1097
+ // probably this entry added before connected to mailchimp, mark it as okay to delete entry.
1098
  return '';
1099
  }
1100
 
1101
  if ( isset( $meta_data_value['is_sent'] ) && ! $meta_data_value['is_sent'] ) {
1102
+ // its not sent to mailchimp so it won't have delete member uri.
1103
  return '';
1104
  }
1105
 
1106
  if ( ! isset( $meta_data_value['data_received'] ) || ! is_object( $meta_data_value['data_received'] ) ) {
1107
+ // something is happened on addon meta data.
1108
  return '';
1109
  }
1110
 
1111
  $data_received = $meta_data_value['data_received'];
1112
 
1113
  if ( ! isset( $data_received->_links ) || ! is_array( $data_received->_links ) ) {
1114
+ // something is happened on addon meta data.
1115
  return '';
1116
  }
1117
 
addons/pro/mailchimp/class-forminator-addon-mailchimp-quiz-settings.php CHANGED
@@ -42,8 +42,8 @@ class Forminator_Addon_Mailchimp_Quiz_Settings extends Forminator_Addon_Quiz_Set
42
  * @return array
43
  */
44
  public function quiz_settings_wizards() {
45
- // already filtered on Abstract
46
- // numerical array steps
47
  return array(
48
  // 1
49
  array(
@@ -69,7 +69,7 @@ class Forminator_Addon_Mailchimp_Quiz_Settings extends Forminator_Addon_Quiz_Set
69
  */
70
  public function choose_mail_list( $submitted_data ) {
71
 
72
- // already filtered on Forminator_Addon_Abstract::get_wizard
73
  $this->addon_quiz_settings = $this->get_quiz_settings_values();
74
  $current_data = array(
75
  'mail_list_id' => '',
@@ -101,7 +101,7 @@ class Forminator_Addon_Mailchimp_Quiz_Settings extends Forminator_Addon_Quiz_Set
101
  $mail_lists = $api->get_all_lists();
102
  $lists = wp_list_pluck( $mail_lists, 'name', 'id' );
103
 
104
- // Get mailchimp list to be selected, bail on empty
105
  if ( empty( $mail_lists ) ) {
106
  throw new Forminator_Addon_Mailchimp_Exception( 'Your Mailchimp Audiences is empty, please create one.' );
107
  }
@@ -113,7 +113,7 @@ class Forminator_Addon_Mailchimp_Quiz_Settings extends Forminator_Addon_Quiz_Set
113
  $html_select_mail_list .= self::refresh_button();
114
  $html_select_mail_list .= '</div>';
115
 
116
- // logic when user submit mail list
117
  if ( $is_submit ) {
118
  forminator_addon_maybe_log( __METHOD__, '$submitted_data', $submitted_data );
119
  $mail_list_name = $this->get_choosen_mail_list_name( $mail_lists, $submitted_data );
@@ -130,7 +130,7 @@ class Forminator_Addon_Mailchimp_Quiz_Settings extends Forminator_Addon_Quiz_Set
130
  $this->addon_quiz_settings['enable_double_opt_in'] = 0;
131
  }
132
 
133
- // GDPR fields
134
  if ( Forminator_Addon_Mailchimp::is_enable_gdpr() ) {
135
  if ( isset( $submitted_data['enable_gdpr'] ) ) {
136
  $this->addon_quiz_settings['enable_gdpr'] = $submitted_data['enable_gdpr'];
@@ -152,7 +152,7 @@ class Forminator_Addon_Mailchimp_Quiz_Settings extends Forminator_Addon_Quiz_Set
152
  </div>';
153
 
154
  } catch ( Forminator_Addon_Mailchimp_Quiz_Settings_Exception $e ) {
155
- // send errors with related input
156
  $input_error_messages = $e->get_input_exceptions();
157
  if ( isset( $input_error_messages['mail_list_id'] ) ) {
158
  $html_field_mail_list
@@ -163,12 +163,12 @@ class Forminator_Addon_Mailchimp_Quiz_Settings extends Forminator_Addon_Quiz_Set
163
  </div>';
164
  }
165
  } catch ( Forminator_Addon_Mailchimp_Exception $e ) {
166
- // send error back to client
167
  $error_message = '<div class="sui-notice sui-notice-error"><p>' . $e->getMessage() . '</p></div>';
168
  }
169
 
170
  $buttons = array();
171
- // add disconnect button if already is_quiz_connected
172
  if ( $this->addon->is_quiz_connected( $this->quiz_id ) ) {
173
  $buttons['disconnect']['markup'] = Forminator_Addon_Mailchimp::get_button_markup(
174
  esc_html__( 'Deactivate', 'forminator' ),
@@ -240,7 +240,7 @@ class Forminator_Addon_Mailchimp_Quiz_Settings extends Forminator_Addon_Quiz_Set
240
  $input_error_messages = array();
241
 
242
  try {
243
- // get merge fields
244
  $mailchimp_fields_list_request = $this->addon->get_api()->get_list_merge_fields( $this->addon_quiz_settings['mail_list_id'], array() );
245
  $mailchimp_required_fields = array();
246
  $mailchimp_required_fields_ids = array();
@@ -265,7 +265,7 @@ class Forminator_Addon_Mailchimp_Quiz_Settings extends Forminator_Addon_Quiz_Set
265
  }
266
  }
267
 
268
- // find type of email
269
  $email_fields = array();
270
  foreach ( $this->form_fields as $form_field ) {
271
  if ( 'email' === $form_field['type'] ) {
@@ -273,7 +273,7 @@ class Forminator_Addon_Mailchimp_Quiz_Settings extends Forminator_Addon_Quiz_Set
273
  }
274
  }
275
 
276
- // EMAIL
277
  $current_data['fields_map']['EMAIL'] = '';
278
  if ( isset( $submitted_data['fields_map']['EMAIL'] ) ) {
279
  $current_data['fields_map']['EMAIL'] = $submitted_data['fields_map']['EMAIL'];
@@ -538,7 +538,7 @@ class Forminator_Addon_Mailchimp_Quiz_Settings extends Forminator_Addon_Quiz_Set
538
 
539
  $quiz_questions = $this->get_quiz_fields();
540
  foreach ( $quiz_questions as $quiz_question ) {
541
- // collect element ids
542
  $forminator_quiz_element_ids[] = $quiz_question['slug'];
543
  }
544
  if ( 'knowledge' === $this->quiz->quiz_type ) {
@@ -565,13 +565,13 @@ class Forminator_Addon_Mailchimp_Quiz_Settings extends Forminator_Addon_Quiz_Set
565
  $this->addon_quiz_settings['fields_map'] = array();
566
  }
567
 
568
- // set fields_map from post_data for reuse
569
  foreach ( $post_data as $mailchimp_field_tag => $forminator_field_id ) {
570
  $this->addon_quiz_settings['fields_map'][ $mailchimp_field_tag ] = $post_data[ $mailchimp_field_tag ];
571
  }
572
 
573
  $input_exceptions = new Forminator_Addon_Mailchimp_Quiz_Settings_Exception();
574
- // EMAIL : super required**
575
  if ( ! isset( $post_data['EMAIL'] ) || empty( $post_data['EMAIL'] ) ) {
576
  $this->_update_quiz_settings_error_message = __( 'Please choose valid Forminator field for email address.', 'forminator' );
577
  $input_exceptions->add_input_exception( $this->_update_quiz_settings_error_message, 'EMAIL' );
@@ -600,7 +600,7 @@ class Forminator_Addon_Mailchimp_Quiz_Settings extends Forminator_Addon_Quiz_Set
600
  }
601
  }
602
 
603
- // Check availibility on forminator field
604
  foreach ( $this->addon_quiz_settings['fields_map'] as $mailchimp_field_tag => $forminator_field_id ) {
605
  if ( empty( $forminator_field_id ) ) {
606
  continue;
@@ -695,7 +695,7 @@ class Forminator_Addon_Mailchimp_Quiz_Settings extends Forminator_Addon_Quiz_Set
695
  public function step_choose_mail_list_is_completed() {
696
  $this->addon_quiz_settings = $this->get_quiz_settings_values();
697
  if ( ! isset( $this->addon_quiz_settings['mail_list_id'] ) ) {
698
- // preliminary value
699
  $this->addon_quiz_settings['mail_list_id'] = 0;
700
 
701
  return false;
42
  * @return array
43
  */
44
  public function quiz_settings_wizards() {
45
+ // already filtered on Abstract.
46
+ // numerical array steps.
47
  return array(
48
  // 1
49
  array(
69
  */
70
  public function choose_mail_list( $submitted_data ) {
71
 
72
+ // already filtered on Forminator_Addon_Abstract::get_wizard.
73
  $this->addon_quiz_settings = $this->get_quiz_settings_values();
74
  $current_data = array(
75
  'mail_list_id' => '',
101
  $mail_lists = $api->get_all_lists();
102
  $lists = wp_list_pluck( $mail_lists, 'name', 'id' );
103
 
104
+ // Get mailchimp list to be selected, bail on empty.
105
  if ( empty( $mail_lists ) ) {
106
  throw new Forminator_Addon_Mailchimp_Exception( 'Your Mailchimp Audiences is empty, please create one.' );
107
  }
113
  $html_select_mail_list .= self::refresh_button();
114
  $html_select_mail_list .= '</div>';
115
 
116
+ // logic when user submit mail list.
117
  if ( $is_submit ) {
118
  forminator_addon_maybe_log( __METHOD__, '$submitted_data', $submitted_data );
119
  $mail_list_name = $this->get_choosen_mail_list_name( $mail_lists, $submitted_data );
130
  $this->addon_quiz_settings['enable_double_opt_in'] = 0;
131
  }
132
 
133
+ // GDPR fields.
134
  if ( Forminator_Addon_Mailchimp::is_enable_gdpr() ) {
135
  if ( isset( $submitted_data['enable_gdpr'] ) ) {
136
  $this->addon_quiz_settings['enable_gdpr'] = $submitted_data['enable_gdpr'];
152
  </div>';
153
 
154
  } catch ( Forminator_Addon_Mailchimp_Quiz_Settings_Exception $e ) {
155
+ // send errors with related input.
156
  $input_error_messages = $e->get_input_exceptions();
157
  if ( isset( $input_error_messages['mail_list_id'] ) ) {
158
  $html_field_mail_list
163
  </div>';
164
  }
165
  } catch ( Forminator_Addon_Mailchimp_Exception $e ) {
166
+ // send error back to client.
167
  $error_message = '<div class="sui-notice sui-notice-error"><p>' . $e->getMessage() . '</p></div>';
168
  }
169
 
170
  $buttons = array();
171
+ // add disconnect button if already is_quiz_connected.
172
  if ( $this->addon->is_quiz_connected( $this->quiz_id ) ) {
173
  $buttons['disconnect']['markup'] = Forminator_Addon_Mailchimp::get_button_markup(
174
  esc_html__( 'Deactivate', 'forminator' ),
240
  $input_error_messages = array();
241
 
242
  try {
243
+ // get merge fields.
244
  $mailchimp_fields_list_request = $this->addon->get_api()->get_list_merge_fields( $this->addon_quiz_settings['mail_list_id'], array() );
245
  $mailchimp_required_fields = array();
246
  $mailchimp_required_fields_ids = array();
265
  }
266
  }
267
 
268
+ // find type of email.
269
  $email_fields = array();
270
  foreach ( $this->form_fields as $form_field ) {
271
  if ( 'email' === $form_field['type'] ) {
273
  }
274
  }
275
 
276
+ // EMAIL.
277
  $current_data['fields_map']['EMAIL'] = '';
278
  if ( isset( $submitted_data['fields_map']['EMAIL'] ) ) {
279
  $current_data['fields_map']['EMAIL'] = $submitted_data['fields_map']['EMAIL'];
538
 
539
  $quiz_questions = $this->get_quiz_fields();
540
  foreach ( $quiz_questions as $quiz_question ) {
541
+ // collect element ids.
542
  $forminator_quiz_element_ids[] = $quiz_question['slug'];
543
  }
544
  if ( 'knowledge' === $this->quiz->quiz_type ) {
565
  $this->addon_quiz_settings['fields_map'] = array();
566
  }
567
 
568
+ // set fields_map from post_data for reuse.
569
  foreach ( $post_data as $mailchimp_field_tag => $forminator_field_id ) {
570
  $this->addon_quiz_settings['fields_map'][ $mailchimp_field_tag ] = $post_data[ $mailchimp_field_tag ];
571
  }
572
 
573
  $input_exceptions = new Forminator_Addon_Mailchimp_Quiz_Settings_Exception();
574
+ // EMAIL : super required**.
575
  if ( ! isset( $post_data['EMAIL'] ) || empty( $post_data['EMAIL'] ) ) {
576
  $this->_update_quiz_settings_error_message = __( 'Please choose valid Forminator field for email address.', 'forminator' );
577
  $input_exceptions->add_input_exception( $this->_update_quiz_settings_error_message, 'EMAIL' );
600
  }
601
  }
602
 
603
+ // Check availibility on forminator field.
604
  foreach ( $this->addon_quiz_settings['fields_map'] as $mailchimp_field_tag => $forminator_field_id ) {
605
  if ( empty( $forminator_field_id ) ) {
606
  continue;
695
  public function step_choose_mail_list_is_completed() {
696
  $this->addon_quiz_settings = $this->get_quiz_settings_values();
697
  if ( ! isset( $this->addon_quiz_settings['mail_list_id'] ) ) {
698
+ // preliminary value.
699
  $this->addon_quiz_settings['mail_list_id'] = 0;
700
 
701
  return false;
addons/pro/mailchimp/class-forminator-addon-mailchimp.php CHANGED
@@ -116,7 +116,7 @@ class Forminator_Addon_Mailchimp extends Forminator_Addon_Abstract {
116
  * @since 1.0 Mailchimp Addon
117
  */
118
  public function __construct() {
119
- // late init to allow translation
120
  $this->_description = __( 'Make form data as Mailchimp List', 'forminator' );
121
  $this->_activation_error_message = __( 'Sorry but we failed to activate Mailchimp Integration, don\'t hesitate to contact us', 'forminator' );
122
  $this->_deactivation_error_message = __( 'Sorry but we failed to deactivate Mailchimp Integration, plese try again', 'forminator' );
@@ -181,12 +181,12 @@ class Forminator_Addon_Mailchimp extends Forminator_Addon_Abstract {
181
  */
182
  public function is_connected() {
183
  try {
184
- // check if its active
185
  if ( ! $this->is_active() ) {
186
  throw new Forminator_Addon_Mailchimp_Exception( __( 'Mailchimp is not active', 'forminator' ) );
187
  }
188
 
189
- // if user completed settings
190
  $is_connected = $this->settings_is_complete();
191
 
192
  } catch ( Forminator_Addon_Mailchimp_Exception $e ) {
@@ -214,7 +214,7 @@ class Forminator_Addon_Mailchimp extends Forminator_Addon_Abstract {
214
  private function settings_is_complete() {
215
  $setting_values = $this->get_settings_values();
216
 
217
- // check api_key and connected_account exists and not empty
218
  return isset( $setting_values['api_key'] ) && $setting_values['api_key'] && isset( $setting_values['connected_account'] ) && ! empty( $setting_values['connected_account'] );
219
  }
220
 
@@ -231,7 +231,7 @@ class Forminator_Addon_Mailchimp extends Forminator_Addon_Abstract {
231
  public function is_form_connected( $form_id ) {
232
 
233
  try {
234
- // initialize with null
235
  $form_settings_instance = null;
236
  if ( ! $this->is_connected() ) {
237
  throw new Forminator_Addon_Mailchimp_Exception( __( 'Mailchimp addon not connected.', 'forminator' ) );
@@ -262,8 +262,8 @@ class Forminator_Addon_Mailchimp extends Forminator_Addon_Abstract {
262
  * @since 1.1
263
  *
264
  * @param bool $is_form_connected
265
- * @param int $form_id Current Form ID
266
- * @param Forminator_Addon_Mailchimp_Form_Settings|null $form_settings_instance Instance of form settings, or null when unavailable
267
  *
268
  */
269
  $is_form_connected = apply_filters( 'forminator_addon_mailchimp_is_form_connected', $is_form_connected, $form_id, $form_settings_instance );
@@ -285,7 +285,7 @@ class Forminator_Addon_Mailchimp extends Forminator_Addon_Abstract {
285
  public function is_quiz_connected( $quiz_id ) {
286
 
287
  try {
288
- // initialize with null
289
  $quiz_settings_instance = null;
290
  if ( ! $this->is_connected() ) {
291
  throw new Forminator_Addon_Mailchimp_Exception( __( 'Mailchimp addon not connected.', 'forminator' ) );
@@ -316,8 +316,8 @@ class Forminator_Addon_Mailchimp extends Forminator_Addon_Abstract {
316
  * @since 1.1
317
  *
318
  * @param bool $is_quiz_connected
319
- * @param int $quiz_id Current Form ID
320
- * @param Forminator_Addon_Mailchimp_Quiz_Settings|null $quiz_settings_instance Instance of form settings, or null when unavailable
321
  *
322
  */
323
  $is_quiz_connected = apply_filters( 'forminator_addon_mailchimp_is_form_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
@@ -345,7 +345,7 @@ class Forminator_Addon_Mailchimp extends Forminator_Addon_Abstract {
345
  }
346
 
347
  try {
348
- // Check API Key by validating it on get_info request
349
  $info = $this->get_api( $api_key )->get_info();
350
  forminator_addon_maybe_log( __METHOD__, $info );
351
 
@@ -406,7 +406,7 @@ class Forminator_Addon_Mailchimp extends Forminator_Addon_Abstract {
406
  */
407
  public function settings_help() {
408
 
409
- // Display how to get mailchimp API Key by default
410
  /* translators: placeholder is URL to get API Key of MailChimp */
411
  $help = sprintf( __( 'Please get your Mailchimp API key %1$s', 'forminator' ), '<a href="https://admin.mailchimp.com/account/api-key-popup" target="_blank">here</a>' );
412
 
@@ -423,7 +423,7 @@ class Forminator_Addon_Mailchimp extends Forminator_Addon_Abstract {
423
 
424
  $connected_account = $setting_values['connected_account'];
425
 
426
- // Show currently connected mailchimp account if its already connected
427
  /* translators: placeholder is Name and Email of Connected MailChimp Account */
428
  $help = '<span class="sui-description" style="margin-top: 20px;">' . __( 'Change your API Key or disconnect this Mailchimp Integration below.' ) . '</span>';
429
 
@@ -447,7 +447,7 @@ class Forminator_Addon_Mailchimp extends Forminator_Addon_Abstract {
447
  && ! empty( $setting_values['connected_account'] )
448
  ) {
449
 
450
- // Show currently connected mailchimp account if its already connected
451
  /* translators: placeholder is Name and Email of Connected MailChimp Account */
452
  $description .= '<span class="sui-description">' . esc_html__( 'Please take a note that changing API Key or disconnect will affect to ALL of your connected forms.', 'forminator' ) . '</span>';
453
 
@@ -473,7 +473,7 @@ class Forminator_Addon_Mailchimp extends Forminator_Addon_Abstract {
473
 
474
  $connected_account = $setting_values['connected_account'];
475
 
476
- // Show currently connected mailchimp account if its already connected
477
  $myaccount .= sprintf(
478
  /* translators: placeholder is Name and Email of Connected MailChimp Account */
479
  __( 'Your Mailchimp is connected to %1$s: %2$s.', 'forminator' ),
@@ -575,7 +575,7 @@ class Forminator_Addon_Mailchimp extends Forminator_Addon_Abstract {
575
  $identifier = $setting_values['identifier'];
576
  }
577
 
578
- // ON Submit
579
  if ( isset( $submitted_data['api_key'] ) ) {
580
  $api_key = $submitted_data['api_key'];
581
  $identifier = isset( $submitted_data['identifier'] ) ? $submitted_data['identifier'] : '';
@@ -587,7 +587,7 @@ class Forminator_Addon_Mailchimp extends Forminator_Addon_Abstract {
587
  * @since 1.1
588
  *
589
  * @param bool $api_key_validated
590
- * @param string $api_key API Key to be validated
591
  */
592
  $api_key_validated = apply_filters( 'forminator_addon_mailchimp_validate_api_key', $api_key_validated, $api_key );
593
 
@@ -613,7 +613,7 @@ class Forminator_Addon_Mailchimp extends Forminator_Addon_Abstract {
613
 
614
  if ( $show_success ) {
615
  if ( ! empty( $form_id ) ) {
616
- // initiate form settings wizard
617
  return $this->get_form_settings_wizard( array(), $form_id, 0, 0 );
618
  }
619
 
@@ -737,7 +737,7 @@ class Forminator_Addon_Mailchimp extends Forminator_Addon_Abstract {
737
  public function is_quiz_lead_connected( $quiz_id ) {
738
 
739
  try {
740
- // initialize with null
741
  $quiz_settings_instance = null;
742
  if ( ! $this->is_connected() ) {
743
  throw new Forminator_Addon_Mailchimp_Exception( __( 'Mailchimp addon not connected.', 'forminator' ) );
@@ -767,8 +767,8 @@ class Forminator_Addon_Mailchimp extends Forminator_Addon_Abstract {
767
  * @since 1.1
768
  *
769
  * @param bool $is_quiz_connected
770
- * @param int $quiz_id Current Form ID
771
- * @param Forminator_Addon_Mailchimp_Quiz_Settings|null $quiz_settings_instance Instance of form settings, or null when unavailable
772
  *
773
  */
774
  $is_quiz_connected = apply_filters( 'forminator_addon_mailchimp_is_quiz_lead_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
116
  * @since 1.0 Mailchimp Addon
117
  */
118
  public function __construct() {
119
+ // late init to allow translation.
120
  $this->_description = __( 'Make form data as Mailchimp List', 'forminator' );
121
  $this->_activation_error_message = __( 'Sorry but we failed to activate Mailchimp Integration, don\'t hesitate to contact us', 'forminator' );
122
  $this->_deactivation_error_message = __( 'Sorry but we failed to deactivate Mailchimp Integration, plese try again', 'forminator' );
181
  */
182
  public function is_connected() {
183
  try {
184
+ // check if its active.
185
  if ( ! $this->is_active() ) {
186
  throw new Forminator_Addon_Mailchimp_Exception( __( 'Mailchimp is not active', 'forminator' ) );
187
  }
188
 
189
+ // if user completed settings.
190
  $is_connected = $this->settings_is_complete();
191
 
192
  } catch ( Forminator_Addon_Mailchimp_Exception $e ) {
214
  private function settings_is_complete() {
215
  $setting_values = $this->get_settings_values();
216
 
217
+ // check api_key and connected_account exists and not empty.
218
  return isset( $setting_values['api_key'] ) && $setting_values['api_key'] && isset( $setting_values['connected_account'] ) && ! empty( $setting_values['connected_account'] );
219
  }
220
 
231
  public function is_form_connected( $form_id ) {
232
 
233
  try {
234
+ // initialize with null.
235
  $form_settings_instance = null;
236
  if ( ! $this->is_connected() ) {
237
  throw new Forminator_Addon_Mailchimp_Exception( __( 'Mailchimp addon not connected.', 'forminator' ) );
262
  * @since 1.1
263
  *
264
  * @param bool $is_form_connected
265
+ * @param int $form_id Current Form ID.
266
+ * @param Forminator_Addon_Mailchimp_Form_Settings|null $form_settings_instance Instance of form settings, or null when unavailable.
267
  *
268
  */
269
  $is_form_connected = apply_filters( 'forminator_addon_mailchimp_is_form_connected', $is_form_connected, $form_id, $form_settings_instance );
285
  public function is_quiz_connected( $quiz_id ) {
286
 
287
  try {
288
+ // initialize with null.
289
  $quiz_settings_instance = null;
290
  if ( ! $this->is_connected() ) {
291
  throw new Forminator_Addon_Mailchimp_Exception( __( 'Mailchimp addon not connected.', 'forminator' ) );
316
  * @since 1.1
317
  *
318
  * @param bool $is_quiz_connected
319
+ * @param int $quiz_id Current Form ID.
320
+ * @param Forminator_Addon_Mailchimp_Quiz_Settings|null $quiz_settings_instance Instance of form settings, or null when unavailable.
321
  *
322
  */
323
  $is_quiz_connected = apply_filters( 'forminator_addon_mailchimp_is_form_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
345
  }
346
 
347
  try {
348
+ // Check API Key by validating it on get_info request.
349
  $info = $this->get_api( $api_key )->get_info();
350
  forminator_addon_maybe_log( __METHOD__, $info );
351
 
406
  */
407
  public function settings_help() {
408
 
409
+ // Display how to get mailchimp API Key by default.
410
  /* translators: placeholder is URL to get API Key of MailChimp */
411
  $help = sprintf( __( 'Please get your Mailchimp API key %1$s', 'forminator' ), '<a href="https://admin.mailchimp.com/account/api-key-popup" target="_blank">here</a>' );
412
 
423
 
424
  $connected_account = $setting_values['connected_account'];
425
 
426
+ // Show currently connected mailchimp account if its already connected.
427
  /* translators: placeholder is Name and Email of Connected MailChimp Account */
428
  $help = '<span class="sui-description" style="margin-top: 20px;">' . __( 'Change your API Key or disconnect this Mailchimp Integration below.' ) . '</span>';
429
 
447
  && ! empty( $setting_values['connected_account'] )
448
  ) {
449
 
450
+ // Show currently connected mailchimp account if its already connected.
451
  /* translators: placeholder is Name and Email of Connected MailChimp Account */
452
  $description .= '<span class="sui-description">' . esc_html__( 'Please take a note that changing API Key or disconnect will affect to ALL of your connected forms.', 'forminator' ) . '</span>';
453
 
473
 
474
  $connected_account = $setting_values['connected_account'];
475
 
476
+ // Show currently connected mailchimp account if its already connected.
477
  $myaccount .= sprintf(
478
  /* translators: placeholder is Name and Email of Connected MailChimp Account */
479
  __( 'Your Mailchimp is connected to %1$s: %2$s.', 'forminator' ),
575
  $identifier = $setting_values['identifier'];
576
  }
577
 
578
+ // ON Submit.
579
  if ( isset( $submitted_data['api_key'] ) ) {
580
  $api_key = $submitted_data['api_key'];
581
  $identifier = isset( $submitted_data['identifier'] ) ? $submitted_data['identifier'] : '';
587
  * @since 1.1
588
  *
589
  * @param bool $api_key_validated
590
+ * @param string $api_key API Key to be validated.
591
  */
592
  $api_key_validated = apply_filters( 'forminator_addon_mailchimp_validate_api_key', $api_key_validated, $api_key );
593
 
613
 
614
  if ( $show_success ) {
615
  if ( ! empty( $form_id ) ) {
616
+ // initiate form settings wizard.
617
  return $this->get_form_settings_wizard( array(), $form_id, 0, 0 );
618
  }
619
 
737
  public function is_quiz_lead_connected( $quiz_id ) {
738
 
739
  try {
740
+ // initialize with null.
741
  $quiz_settings_instance = null;
742
  if ( ! $this->is_connected() ) {
743
  throw new Forminator_Addon_Mailchimp_Exception( __( 'Mailchimp addon not connected.', 'forminator' ) );
767
  * @since 1.1
768
  *
769
  * @param bool $is_quiz_connected
770
+ * @param int $quiz_id Current Form ID.
771
+ * @param Forminator_Addon_Mailchimp_Quiz_Settings|null $quiz_settings_instance Instance of form settings, or null when unavailable.
772
  *
773
  */
774
  $is_quiz_connected = apply_filters( 'forminator_addon_mailchimp_is_quiz_lead_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
addons/pro/mailchimp/lib/class-forminator-addon-mailchimp-wp-api.php CHANGED
@@ -79,7 +79,7 @@ class Forminator_Addon_Mailchimp_Wp_Api {
79
  $exploded = explode( '-', $this->_api_key );
80
  $data_center = end( $exploded );
81
 
82
- // endpoint data center are taken from api key
83
  $this->_endpoint = str_replace( '{dc}', $data_center, $this->_endpoint );
84
  }
85
 
@@ -119,7 +119,7 @@ class Forminator_Addon_Mailchimp_Wp_Api {
119
  *
120
  * @since 1.1
121
  *
122
- * @param string $user_agent current user agent
123
  */
124
  $user_agent = apply_filters( 'forminator_addon_mailchimp_api_user_agent', $user_agent );
125
 
@@ -140,7 +140,7 @@ class Forminator_Addon_Mailchimp_Wp_Api {
140
  * @throws Forminator_Addon_Mailchimp_Wp_Api_Not_Found_Exception
141
  */
142
  private function request( $verb, $path, $args = array() ) {
143
- // Adding extra user agent for wp remote request
144
  add_filter( 'http_headers_useragent', array( $this, 'filter_user_agent' ) );
145
  $url = trailingslashit( $this->_endpoint ) . $path;
146
  $verb = ! empty( $verb ) ? $verb : 'GET';
@@ -150,10 +150,10 @@ class Forminator_Addon_Mailchimp_Wp_Api {
150
  *
151
  * @since 1.1
152
  *
153
- * @param string $url full url with scheme
154
- * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`
155
- * @param string $path requested path resource
156
- * @param array $args argument sent to this function
157
  */
158
  $url = apply_filters( 'forminator_addon_mailchimp_api_url', $url, $verb, $path, $args );
159
 
@@ -169,9 +169,9 @@ class Forminator_Addon_Mailchimp_Wp_Api {
169
  * @since 1.1
170
  *
171
  * @param array $headers
172
- * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`
173
- * @param string $path requested path resource
174
- * @param array $args argument sent to this function
175
  */
176
  $headers = apply_filters( 'forminator_addon_mailchimp_api_request_headers', $headers, $verb, $path, $args );
177
 
@@ -186,9 +186,9 @@ class Forminator_Addon_Mailchimp_Wp_Api {
186
  *
187
  * @since 1.1
188
  *
189
- * @param array $request_data it will be `http_build_query`-ed when `GET` or `wp_json_encode`-ed otherwise
190
- * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`
191
- * @param string $path requested path resource
192
  */
193
  $args = apply_filters( 'forminator_addon_mailchimp_api_request_data', $request_data, $verb, $path );
194
 
@@ -213,9 +213,9 @@ class Forminator_Addon_Mailchimp_Wp_Api {
213
 
214
  $response = null;
215
 
216
- // DELETE probably won't receiving contents on success
217
  if ( 'DELETE' !== $verb ) {
218
- // Got no response from API
219
  if ( empty( $body ) ) {
220
  forminator_addon_maybe_log( __METHOD__, $res );
221
  throw new Forminator_Addon_Mailchimp_Wp_Api_Exception(
@@ -231,13 +231,13 @@ class Forminator_Addon_Mailchimp_Wp_Api {
231
  $response = json_decode( $body );
232
  $response_code = wp_remote_retrieve_response_code( $res );
233
 
234
- // check response status from API
235
  if ( isset( $response_code ) ) {
236
  if ( $response_code >= 400 ) {
237
  forminator_addon_maybe_log( __METHOD__, $response );
238
  $msg = '';
239
  if ( isset( $response->detail ) ) {
240
- // if exist, error detail is given by mailchimp here
241
  $msg = $response->detail;
242
  }
243
  $this->_last_data_received = $response;
@@ -250,7 +250,7 @@ class Forminator_Addon_Mailchimp_Wp_Api {
250
  }
251
  }
252
 
253
- // Probably response is failed to be json decoded
254
  if ( is_null( $response ) ) {
255
  $this->_last_data_received = $body;
256
  forminator_addon_maybe_log( __METHOD__, $res );
@@ -261,7 +261,7 @@ class Forminator_Addon_Mailchimp_Wp_Api {
261
 
262
  $wp_response = $res;
263
 
264
- // in case not receving json decoded body use $wp_response
265
  if ( is_null( $response ) ) {
266
  $response = $wp_response;
267
  }
@@ -271,8 +271,8 @@ class Forminator_Addon_Mailchimp_Wp_Api {
271
  * @since 1.1
272
  *
273
  * @param mixed $response
274
- * @param string $body original content of http response's body
275
- * @param array|WP_Error $wp_response original wp remote request response
276
  */
277
  $response = apply_filters( 'forminator_addon_mailchimp_api_response', $response, $body, $wp_response );
278
 
79
  $exploded = explode( '-', $this->_api_key );
80
  $data_center = end( $exploded );
81
 
82
+ // endpoint data center are taken from api key.
83
  $this->_endpoint = str_replace( '{dc}', $data_center, $this->_endpoint );
84
  }
85
 
119
  *
120
  * @since 1.1
121
  *
122
+ * @param string $user_agent current user agent.
123
  */
124
  $user_agent = apply_filters( 'forminator_addon_mailchimp_api_user_agent', $user_agent );
125
 
140
  * @throws Forminator_Addon_Mailchimp_Wp_Api_Not_Found_Exception
141
  */
142
  private function request( $verb, $path, $args = array() ) {
143
+ // Adding extra user agent for wp remote request.
144
  add_filter( 'http_headers_useragent', array( $this, 'filter_user_agent' ) );
145
  $url = trailingslashit( $this->_endpoint ) . $path;
146
  $verb = ! empty( $verb ) ? $verb : 'GET';
150
  *
151
  * @since 1.1
152
  *
153
+ * @param string $url full url with scheme.
154
+ * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`.
155
+ * @param string $path requested path resource.
156
+ * @param array $args argument sent to this function.
157
  */
158
  $url = apply_filters( 'forminator_addon_mailchimp_api_url', $url, $verb, $path, $args );
159
 
169
  * @since 1.1
170
  *
171
  * @param array $headers
172
+ * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`.
173
+ * @param string $path requested path resource.
174
+ * @param array $args argument sent to this function.
175
  */
176
  $headers = apply_filters( 'forminator_addon_mailchimp_api_request_headers', $headers, $verb, $path, $args );
177
 
186
  *
187
  * @since 1.1
188
  *
189
+ * @param array $request_data it will be `http_build_query`-ed when `GET` or `wp_json_encode`-ed otherwise.
190
+ * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`.
191
+ * @param string $path requested path resource.
192
  */
193
  $args = apply_filters( 'forminator_addon_mailchimp_api_request_data', $request_data, $verb, $path );
194
 
213
 
214
  $response = null;
215
 
216
+ // DELETE probably won't receiving contents on success.
217
  if ( 'DELETE' !== $verb ) {
218
+ // Got no response from API.
219
  if ( empty( $body ) ) {
220
  forminator_addon_maybe_log( __METHOD__, $res );
221
  throw new Forminator_Addon_Mailchimp_Wp_Api_Exception(
231
  $response = json_decode( $body );
232
  $response_code = wp_remote_retrieve_response_code( $res );
233
 
234
+ // check response status from API.
235
  if ( isset( $response_code ) ) {
236
  if ( $response_code >= 400 ) {
237
  forminator_addon_maybe_log( __METHOD__, $response );
238
  $msg = '';
239
  if ( isset( $response->detail ) ) {
240
+ // if exist, error detail is given by mailchimp here.
241
  $msg = $response->detail;
242
  }
243
  $this->_last_data_received = $response;
250
  }
251
  }
252
 
253
+ // Probably response is failed to be json decoded.
254
  if ( is_null( $response ) ) {
255
  $this->_last_data_received = $body;
256
  forminator_addon_maybe_log( __METHOD__, $res );
261
 
262
  $wp_response = $res;
263
 
264
+ // in case not receving json decoded body use $wp_response.
265
  if ( is_null( $response ) ) {
266
  $response = $wp_response;
267
  }
271
  * @since 1.1
272
  *
273
  * @param mixed $response
274
+ * @param string $body original content of http response's body.
275
+ * @param array|WP_Error $wp_response original wp remote request response.
276
  */
277
  $response = apply_filters( 'forminator_addon_mailchimp_api_response', $response, $body, $wp_response );
278
 
addons/pro/slack/class-forminator-addon-slack-form-hooks.php CHANGED
@@ -63,8 +63,8 @@ class Forminator_Addon_Slack_Form_Hooks extends Forminator_Addon_Form_Hooks_Abst
63
  * @since 1.4
64
  *
65
  * @param array $submitted_data
66
- * @param int $form_id current Form ID
67
- * @param Forminator_Addon_Slack_Form_Settings $form_settings_instance Slack Addon Form Settings instance
68
  */
69
  $submitted_data = apply_filters(
70
  'forminator_addon_slack_form_submitted_data',
@@ -82,16 +82,16 @@ class Forminator_Addon_Slack_Form_Hooks extends Forminator_Addon_Form_Hooks_Abst
82
  *
83
  * @since 1.4
84
  *
85
- * @param int $form_id current Form ID
86
  * @param array $submitted_data
87
- * @param Forminator_Addon_Slack_Form_Settings $form_settings_instance Slack Addon Form Settings instance
88
  */
89
  do_action( 'forminator_addon_slack_before_send_message', $form_id, $submitted_data, $form_settings_instance );
90
 
91
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
92
- // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to slack
93
  if ( $form_settings_instance->is_multi_form_settings_complete( $key ) ) {
94
- // exec only on completed connection
95
  $data[] = array(
96
  'name' => 'status-' . $key,
97
  'value' => $this->get_status_on_send_message( $key, $submitted_data, $addon_setting_value, $form_entry_fields ),
@@ -106,9 +106,9 @@ class Forminator_Addon_Slack_Form_Hooks extends Forminator_Addon_Form_Hooks_Abst
106
  * @since 1.4
107
  *
108
  * @param array $entry_fields
109
- * @param int $form_id current Form ID
110
  * @param array $submitted_data
111
- * @param Forminator_Addon_Slack_Form_Settings $form_settings_instance Slack Addon Form Settings instance
112
  */
113
  $data = apply_filters(
114
  'forminator_addon_slack_entry_fields',
@@ -135,7 +135,7 @@ class Forminator_Addon_Slack_Form_Hooks extends Forminator_Addon_Form_Hooks_Abst
135
  * @return array `is_sent` true means its success send data to Slack, false otherwise
136
  */
137
  private function get_status_on_send_message( $connection_id, $submitted_data, $connection_settings, $form_entry_fields ) {
138
- // initialize as null
139
  $api = null;
140
 
141
  $form_id = $this->form_id;
@@ -165,13 +165,13 @@ class Forminator_Addon_Slack_Form_Hooks extends Forminator_Addon_Form_Hooks_Abst
165
  * @since 1.4
166
  *
167
  * @param string $card_name
168
- * @param int $form_id Current Form id
169
- * @param string $connection_id ID of current connection
170
  * @param array $submitted_data
171
- * @param array $connection_settings current connection setting, contains options of like `name`, `target_id` etc
172
- * @param array $form_entry_fields default entry fields of form
173
- * @param array $form_settings Displayed Form settings
174
- * @param Forminator_Addon_Slack_Form_Settings $form_settings_instance Slack Addon Form Settings instance
175
  */
176
  $attachments = apply_filters(
177
  'forminator_addon_slack_message_attachments',
@@ -196,13 +196,13 @@ class Forminator_Addon_Slack_Form_Hooks extends Forminator_Addon_Form_Hooks_Abst
196
  * @since 1.3
197
  *
198
  * @param array $args
199
- * @param int $form_id Current Form id
200
- * @param string $connection_id ID of current connection
201
  * @param array $submitted_data
202
- * @param array $connection_settings current connection setting, contains options of like `name`, `target_id` etc
203
- * @param array $form_entry_fields default entry fields of form
204
- * @param array $form_settings Displayed Form settings
205
- * @param Forminator_Addon_Slack_Form_Settings $form_settings_instance Slack Addon Form Settings instance
206
  */
207
  $args = apply_filters(
208
  'forminator_addon_slack_send_message_args',
@@ -230,8 +230,8 @@ class Forminator_Addon_Slack_Form_Hooks extends Forminator_Addon_Form_Hooks_Abst
230
  'data_sent' => $api->get_last_data_sent(),
231
  'data_received' => $api->get_last_data_received(),
232
  'url_request' => $api->get_last_url_request(),
233
- 'ts' => $ts, // for delete reference
234
- 'target_id' => $connection_settings['target_id'], // for delete reference
235
  );
236
 
237
  } catch ( Forminator_Addon_Slack_Exception $e ) {
@@ -242,8 +242,8 @@ class Forminator_Addon_Slack_Form_Hooks extends Forminator_Addon_Form_Hooks_Abst
242
  'data_sent' => ( ( $api instanceof Forminator_Addon_Slack_Wp_Api ) ? $api->get_last_data_sent() : array() ),
243
  'data_received' => ( ( $api instanceof Forminator_Addon_Slack_Wp_Api ) ? $api->get_last_data_received() : array() ),
244
  'url_request' => ( ( $api instanceof Forminator_Addon_Slack_Wp_Api ) ? $api->get_last_url_request() : '' ),
245
- 'ts' => '', // for delete reference,
246
- 'target_id' => '', // for delete reference,
247
  );
248
 
249
  return $addon_entry_fields;
@@ -287,7 +287,7 @@ class Forminator_Addon_Slack_Form_Hooks extends Forminator_Addon_Form_Hooks_Abst
287
  }
288
  $post_element_id = str_ireplace( '-post-image', '', $post_element_id );
289
 
290
- // only add postdata as single
291
  if ( in_array( $post_element_id, $post_element_ids, true ) ) {
292
  continue;
293
  }
@@ -361,8 +361,8 @@ class Forminator_Addon_Slack_Form_Hooks extends Forminator_Addon_Form_Hooks_Abst
361
  * @since 1.4
362
  *
363
  * @param array $addon_meta_data
364
- * @param int $form_id current Form ID
365
- * @param Forminator_Addon_Slack_Form_Settings $form_settings_instance Slack Addon Form Settings instance
366
  */
367
  $addon_meta_data = apply_filters(
368
  'forminator_addon_slack_metadata',
@@ -450,7 +450,7 @@ class Forminator_Addon_Slack_Form_Hooks extends Forminator_Addon_Form_Hooks_Abst
450
  }
451
 
452
  if ( Forminator_Addon_Slack::is_show_full_log() ) {
453
- // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_SLACK_SHOW_FULL_LOG', true)`
454
  if ( isset( $status['url_request'] ) ) {
455
  $sub_entries[] = array(
456
  'label' => __( 'API URL', 'forminator' ),
@@ -475,7 +475,7 @@ class Forminator_Addon_Slack_Form_Hooks extends Forminator_Addon_Form_Hooks_Abst
475
 
476
  $additional_entry_item['sub_entries'] = $sub_entries;
477
 
478
- // return single array
479
  return $additional_entry_item;
480
  }
481
 
@@ -500,9 +500,9 @@ class Forminator_Addon_Slack_Form_Hooks extends Forminator_Addon_Form_Hooks_Abst
500
  *
501
  * @since 1.2
502
  *
503
- * @param array $export_headers headers to be displayed on export file
504
- * @param int $form_id current Form ID
505
- * @param Forminator_Addon_Slack_Form_Settings $form_settings_instance Slack Addon Form Settings instance
506
  */
507
  $export_headers = apply_filters(
508
  'forminator_addon_slack_export_headers',
@@ -537,8 +537,8 @@ class Forminator_Addon_Slack_Form_Hooks extends Forminator_Addon_Form_Hooks_Abst
537
  * @since 1.4
538
  *
539
  * @param array $addon_meta_data
540
- * @param int $form_id current Form ID
541
- * @param Forminator_Addon_Slack_Form_Settings $form_settings_instance Slack Addon Form Settings instance
542
  */
543
  $addon_meta_data = apply_filters(
544
  'forminator_addon_slack_metadata',
@@ -556,11 +556,11 @@ class Forminator_Addon_Slack_Form_Hooks extends Forminator_Addon_Form_Hooks_Abst
556
  *
557
  * @since 1.4
558
  *
559
- * @param array $export_columns column to be exported
560
- * @param int $form_id current Form ID
561
- * @param Forminator_Form_Entry_Model $entry_model Form Entry Model
562
- * @param array $addon_meta_data meta data saved by addon on entry fields
563
- * @param Forminator_Addon_Slack_Form_Settings $form_settings_instance Slack Addon Form Settings instance
564
  */
565
  $export_columns = apply_filters(
566
  'forminator_addon_slack_export_columns',
@@ -593,15 +593,15 @@ class Forminator_Addon_Slack_Form_Hooks extends Forminator_Addon_Form_Hooks_Abst
593
 
594
  $addon_meta_data = $addon_meta_data[0];
595
 
596
- // make sure its `status`, because we only add this
597
  if ( 'status' !== $addon_meta_data['name'] ) {
598
  if ( stripos( $addon_meta_data['name'], 'status-' ) === 0 ) {
599
  $meta_data = array();
600
  foreach ( $addon_meta_datas as $addon_meta_data ) {
601
- // make it like single value so it will be processed like single meta data
602
  $addon_meta_data['name'] = 'status';
603
 
604
- // add it on an array for next recursive process
605
  $meta_data[] = $this->get_from_addon_meta_data( array( $addon_meta_data ), $key, $default );
606
  }
607
 
@@ -641,7 +641,7 @@ class Forminator_Addon_Slack_Form_Hooks extends Forminator_Addon_Form_Hooks_Abst
641
  * @return bool
642
  */
643
  public function on_before_delete_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {
644
- // attach hook first
645
  $form_id = $this->form_id;
646
  $form_settings_instance = $this->form_settings_instance;
647
 
@@ -652,9 +652,9 @@ class Forminator_Addon_Slack_Form_Hooks extends Forminator_Addon_Form_Hooks_Abst
652
  * @since 1.4
653
  *
654
  * @param array $addon_meta_data
655
- * @param int $form_id current Form ID
656
- * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model
657
- * @param Forminator_Addon_Slack_Form_Settings $form_settings_instance Slack Addon Form Settings instance
658
  */
659
  $addon_meta_data = apply_filters(
660
  'forminator_addon_slack_metadata',
@@ -669,10 +669,10 @@ class Forminator_Addon_Slack_Form_Hooks extends Forminator_Addon_Form_Hooks_Abst
669
  *
670
  * @since 1.1
671
  *
672
- * @param int $form_id current Form ID
673
- * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model
674
- * @param array $addon_meta_data addon meta data
675
- * @param Forminator_Addon_Slack_Form_Settings $form_settings_instance Slack Addon Form Settings instance
676
  */
677
  do_action(
678
  'forminator_addon_slack_on_before_delete_submission',
@@ -693,7 +693,7 @@ class Forminator_Addon_Slack_Form_Hooks extends Forminator_Addon_Form_Hooks_Abst
693
 
694
  foreach ( $addon_meta_data as $addon_meta_datum ) {
695
 
696
- // basic data validation
697
  if ( ! isset( $addon_meta_datum['value'] ) || ! is_array( $addon_meta_datum['value'] ) ) {
698
  continue;
699
  }
@@ -724,12 +724,12 @@ class Forminator_Addon_Slack_Form_Hooks extends Forminator_Addon_Form_Hooks_Abst
724
  return true;
725
 
726
  } catch ( Forminator_Addon_Slack_Exception $e ) {
727
- // handle all internal addon exceptions with `Forminator_Addon_Slack_Exception`
728
 
729
- // use wp_error, for future usage it can be returned to page entries
730
  $wp_error
731
  = new WP_Error( 'forminator_addon_slack_delete_chat', $e->getMessage() );
732
- // handle this in addon by self, since page entries cant handle error messages on delete yet
733
  wp_die(
734
  esc_html( $wp_error->get_error_message() ),
735
  esc_html( $this->addon->get_title() ),
63
  * @since 1.4
64
  *
65
  * @param array $submitted_data
66
+ * @param int $form_id current Form ID.
67
+ * @param Forminator_Addon_Slack_Form_Settings $form_settings_instance Slack Addon Form Settings instance.
68
  */
69
  $submitted_data = apply_filters(
70
  'forminator_addon_slack_form_submitted_data',
82
  *
83
  * @since 1.4
84
  *
85
+ * @param int $form_id current Form ID.
86
  * @param array $submitted_data
87
+ * @param Forminator_Addon_Slack_Form_Settings $form_settings_instance Slack Addon Form Settings instance.
88
  */
89
  do_action( 'forminator_addon_slack_before_send_message', $form_id, $submitted_data, $form_settings_instance );
90
 
91
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
92
+ // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to slack.
93
  if ( $form_settings_instance->is_multi_form_settings_complete( $key ) ) {
94
+ // exec only on completed connection.
95
  $data[] = array(
96
  'name' => 'status-' . $key,
97
  'value' => $this->get_status_on_send_message( $key, $submitted_data, $addon_setting_value, $form_entry_fields ),
106
  * @since 1.4
107
  *
108
  * @param array $entry_fields
109
+ * @param int $form_id current Form ID.
110
  * @param array $submitted_data
111
+ * @param Forminator_Addon_Slack_Form_Settings $form_settings_instance Slack Addon Form Settings instance.
112
  */
113
  $data = apply_filters(
114
  'forminator_addon_slack_entry_fields',
135
  * @return array `is_sent` true means its success send data to Slack, false otherwise
136
  */
137
  private function get_status_on_send_message( $connection_id, $submitted_data, $connection_settings, $form_entry_fields ) {
138
+ // initialize as null.
139
  $api = null;
140
 
141
  $form_id = $this->form_id;
165
  * @since 1.4
166
  *
167
  * @param string $card_name
168
+ * @param int $form_id Current Form id.
169
+ * @param string $connection_id ID of current connection.
170
  * @param array $submitted_data
171
+ * @param array $connection_settings current connection setting, contains options of like `name`, `target_id` etc.
172
+ * @param array $form_entry_fields default entry fields of form.
173
+ * @param array $form_settings Displayed Form settings.
174
+ * @param Forminator_Addon_Slack_Form_Settings $form_settings_instance Slack Addon Form Settings instance.
175
  */
176
  $attachments = apply_filters(
177
  'forminator_addon_slack_message_attachments',
196
  * @since 1.3
197
  *
198
  * @param array $args
199
+ * @param int $form_id Current Form id.
200
+ * @param string $connection_id ID of current connection.
201
  * @param array $submitted_data
202
+ * @param array $connection_settings current connection setting, contains options of like `name`, `target_id` etc.
203
+ * @param array $form_entry_fields default entry fields of form.
204
+ * @param array $form_settings Displayed Form settings.
205
+ * @param Forminator_Addon_Slack_Form_Settings $form_settings_instance Slack Addon Form Settings instance.
206
  */
207
  $args = apply_filters(
208
  'forminator_addon_slack_send_message_args',
230
  'data_sent' => $api->get_last_data_sent(),
231
  'data_received' => $api->get_last_data_received(),
232
  'url_request' => $api->get_last_url_request(),
233
+ 'ts' => $ts, // for delete reference.
234
+ 'target_id' => $connection_settings['target_id'], // for delete reference.
235
  );
236
 
237
  } catch ( Forminator_Addon_Slack_Exception $e ) {
242
  'data_sent' => ( ( $api instanceof Forminator_Addon_Slack_Wp_Api ) ? $api->get_last_data_sent() : array() ),
243
  'data_received' => ( ( $api instanceof Forminator_Addon_Slack_Wp_Api ) ? $api->get_last_data_received() : array() ),
244
  'url_request' => ( ( $api instanceof Forminator_Addon_Slack_Wp_Api ) ? $api->get_last_url_request() : '' ),
245
+ 'ts' => '', // for delete reference,.
246
+ 'target_id' => '', // for delete reference,.
247
  );
248
 
249
  return $addon_entry_fields;
287
  }
288
  $post_element_id = str_ireplace( '-post-image', '', $post_element_id );
289
 
290
+ // only add postdata as single.
291
  if ( in_array( $post_element_id, $post_element_ids, true ) ) {
292
  continue;
293
  }
361
  * @since 1.4
362
  *
363
  * @param array $addon_meta_data
364
+ * @param int $form_id current Form ID.
365
+ * @param Forminator_Addon_Slack_Form_Settings $form_settings_instance Slack Addon Form Settings instance.
366
  */
367
  $addon_meta_data = apply_filters(
368
  'forminator_addon_slack_metadata',
450
  }
451
 
452
  if ( Forminator_Addon_Slack::is_show_full_log() ) {
453
+ // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_SLACK_SHOW_FULL_LOG', true)`.
454
  if ( isset( $status['url_request'] ) ) {
455
  $sub_entries[] = array(
456
  'label' => __( 'API URL', 'forminator' ),
475
 
476
  $additional_entry_item['sub_entries'] = $sub_entries;
477
 
478
+ // return single array.
479
  return $additional_entry_item;
480
  }
481
 
500
  *
501
  * @since 1.2
502
  *
503
+ * @param array $export_headers headers to be displayed on export file.
504
+ * @param int $form_id current Form ID.
505
+ * @param Forminator_Addon_Slack_Form_Settings $form_settings_instance Slack Addon Form Settings instance.
506
  */
507
  $export_headers = apply_filters(
508
  'forminator_addon_slack_export_headers',
537
  * @since 1.4
538
  *
539
  * @param array $addon_meta_data
540
+ * @param int $form_id current Form ID.
541
+ * @param Forminator_Addon_Slack_Form_Settings $form_settings_instance Slack Addon Form Settings instance.
542
  */
543
  $addon_meta_data = apply_filters(
544
  'forminator_addon_slack_metadata',
556
  *
557
  * @since 1.4
558
  *
559
+ * @param array $export_columns column to be exported.
560
+ * @param int $form_id current Form ID.
561
+ * @param Forminator_Form_Entry_Model $entry_model Form Entry Model.
562
+ * @param array $addon_meta_data meta data saved by addon on entry fields.
563
+ * @param Forminator_Addon_Slack_Form_Settings $form_settings_instance Slack Addon Form Settings instance.
564
  */
565
  $export_columns = apply_filters(
566
  'forminator_addon_slack_export_columns',
593
 
594
  $addon_meta_data = $addon_meta_data[0];
595
 
596
+ // make sure its `status`, because we only add this.
597
  if ( 'status' !== $addon_meta_data['name'] ) {
598
  if ( stripos( $addon_meta_data['name'], 'status-' ) === 0 ) {
599
  $meta_data = array();
600
  foreach ( $addon_meta_datas as $addon_meta_data ) {
601
+ // make it like single value so it will be processed like single meta data.
602
  $addon_meta_data['name'] = 'status';
603
 
604
+ // add it on an array for next recursive process.
605
  $meta_data[] = $this->get_from_addon_meta_data( array( $addon_meta_data ), $key, $default );
606
  }
607
 
641
  * @return bool
642
  */
643
  public function on_before_delete_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {
644
+ // attach hook first.
645
  $form_id = $this->form_id;
646
  $form_settings_instance = $this->form_settings_instance;
647
 
652
  * @since 1.4
653
  *
654
  * @param array $addon_meta_data
655
+ * @param int $form_id current Form ID.
656
+ * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model.
657
+ * @param Forminator_Addon_Slack_Form_Settings $form_settings_instance Slack Addon Form Settings instance.
658
  */
659
  $addon_meta_data = apply_filters(
660
  'forminator_addon_slack_metadata',
669
  *
670
  * @since 1.1
671
  *
672
+ * @param int $form_id current Form ID.
673
+ * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model.
674
+ * @param array $addon_meta_data addon meta data.
675
+ * @param Forminator_Addon_Slack_Form_Settings $form_settings_instance Slack Addon Form Settings instance.
676
  */
677
  do_action(
678
  'forminator_addon_slack_on_before_delete_submission',
693
 
694
  foreach ( $addon_meta_data as $addon_meta_datum ) {
695
 
696
+ // basic data validation.
697
  if ( ! isset( $addon_meta_datum['value'] ) || ! is_array( $addon_meta_datum['value'] ) ) {
698
  continue;
699
  }
724
  return true;
725
 
726
  } catch ( Forminator_Addon_Slack_Exception $e ) {
727
+ // handle all internal addon exceptions with `Forminator_Addon_Slack_Exception`.
728
 
729
+ // use wp_error, for future usage it can be returned to page entries.
730
  $wp_error
731
  = new WP_Error( 'forminator_addon_slack_delete_chat', $e->getMessage() );
732
+ // handle this in addon by self, since page entries cant handle error messages on delete yet.
733
  wp_die(
734
  esc_html( $wp_error->get_error_message() ),
735
  esc_html( $this->addon->get_title() ),
addons/pro/slack/class-forminator-addon-slack-form-settings.php CHANGED
@@ -50,7 +50,7 @@ class Forminator_Addon_Slack_Form_Settings extends Forminator_Addon_Form_Setting
50
  * @return array
51
  */
52
  public function form_settings_wizards() {
53
- // numerical array steps
54
  return array(
55
  array(
56
  'callback' => array( $this, 'pick_name' ),
@@ -602,7 +602,7 @@ class Forminator_Addon_Slack_Form_Settings extends Forminator_Addon_Form_Setting
602
  foreach ( $this->get_form_settings_values() as $key => $value ) {
603
  $multi_ids[] = array(
604
  'id' => $key,
605
- // use name that was added by user on creating connection
606
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
607
  );
608
  }
@@ -618,7 +618,7 @@ class Forminator_Addon_Slack_Form_Settings extends Forminator_Addon_Form_Setting
618
  * @param array $submitted_data
619
  */
620
  public function disconnect_form( $submitted_data ) {
621
- // only execute if multi_id provided on submitted data
622
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
623
  $addon_form_settings = $this->get_form_settings_values();
624
  unset( $addon_form_settings[ $submitted_data['multi_id'] ] );
50
  * @return array
51
  */
52
  public function form_settings_wizards() {
53
+ // numerical array steps.
54
  return array(
55
  array(
56
  'callback' => array( $this, 'pick_name' ),
602
  foreach ( $this->get_form_settings_values() as $key => $value ) {
603
  $multi_ids[] = array(
604
  'id' => $key,
605
+ // use name that was added by user on creating connection.
606
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
607
  );
608
  }
618
  * @param array $submitted_data
619
  */
620
  public function disconnect_form( $submitted_data ) {
621
+ // only execute if multi_id provided on submitted data.
622
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
623
  $addon_form_settings = $this->get_form_settings_values();
624
  unset( $addon_form_settings[ $submitted_data['multi_id'] ] );
addons/pro/slack/class-forminator-addon-slack-poll-hooks.php CHANGED
@@ -48,8 +48,8 @@ class Forminator_Addon_Slack_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abst
48
  * @since 1.6.1
49
  *
50
  * @param array $submitted_data
51
- * @param int $pol_id current Poll ID
52
- * @param Forminator_Addon_Slack_Poll_Settings $poll_settings_instance Slack Addon Poll Settings instance
53
  */
54
  $submitted_data = apply_filters(
55
  'forminator_addon_slack_poll_submitted_data',
@@ -67,16 +67,16 @@ class Forminator_Addon_Slack_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abst
67
  *
68
  * @since 1.6.1
69
  *
70
- * @param int $pol_id current Poll ID
71
  * @param array $submitted_data
72
- * @param Forminator_Addon_Slack_Poll_Settings $poll_settings_instance Slack Addon Poll Settings instance
73
  */
74
  do_action( 'forminator_addon_slack_poll_before_send_message', $pol_id, $submitted_data, $poll_settings_instance );
75
 
76
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
77
- // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to slack
78
  if ( $poll_settings_instance->is_multi_poll_settings_complete( $key ) ) {
79
- // exec only on completed connection
80
  $data[] = array(
81
  'name' => 'status-' . $key,
82
  'value' => $this->get_status_on_send_message( $key, $submitted_data, $addon_setting_value, $form_entry_fields ),
@@ -91,9 +91,9 @@ class Forminator_Addon_Slack_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abst
91
  * @since 1.6.1
92
  *
93
  * @param array $entry_fields
94
- * @param int $pol_id current Poll ID
95
  * @param array $submitted_data
96
- * @param Forminator_Addon_Slack_Poll_Settings $poll_settings_instance Slack Addon Poll Settings instance
97
  */
98
  $data = apply_filters(
99
  'forminator_addon_slack_poll_entry_fields',
@@ -120,7 +120,7 @@ class Forminator_Addon_Slack_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abst
120
  * @return array `is_sent` true means its success send data to Slack, false otherwise
121
  */
122
  private function get_status_on_send_message( $connection_id, $submitted_data, $connection_settings, $poll_entry_fields ) {
123
- // initialize as null
124
  $api = null;
125
 
126
  $poll_id = $this->poll_id;
@@ -142,7 +142,7 @@ class Forminator_Addon_Slack_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abst
142
  $text_message = $connection_settings['message'];
143
  $text_message = forminator_replace_variables( $text_message );
144
 
145
- // {poll_name_replace} //phpcs:ignore
146
  $text_message = str_ireplace( '{poll_name}', forminator_get_name_from_model( $this->poll ), $text_message );
147
 
148
  $attachments = $this->get_poll_data_as_attachments( $submitted_data, $poll_entry_fields );
@@ -153,13 +153,13 @@ class Forminator_Addon_Slack_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abst
153
  * @since 1.4
154
  *
155
  * @param string $card_name
156
- * @param int $poll_id Current Poll id
157
- * @param string $connection_id ID of current connection
158
  * @param array $submitted_data
159
- * @param array $connection_settings current connection setting, contains options of like `name`, `target_id` etc
160
- * @param array $poll_entry_fields default entry fields of form
161
- * @param array $poll_settings Displayed Poll settings
162
- * @param Forminator_Addon_Slack_Poll_Settings $poll_settings_instance Slack Addon Poll Settings instance
163
  */
164
  $attachments = apply_filters(
165
  'forminator_addon_slack_poll_message_attachments',
@@ -184,13 +184,13 @@ class Forminator_Addon_Slack_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abst
184
  * @since 1.3
185
  *
186
  * @param array $args
187
- * @param int $poll_id Current Poll id
188
- * @param string $connection_id ID of current connection
189
  * @param array $submitted_data
190
- * @param array $connection_settings current connection setting, contains options of like `name`, `target_id` etc
191
- * @param array $poll_entry_fields default entry fields of form
192
- * @param array $poll_settings Displayed Poll settings
193
- * @param Forminator_Addon_Slack_Poll_Settings $poll_settings_instance Slack Addon Poll Settings instance
194
  */
195
  $args = apply_filters(
196
  'forminator_addon_slack_poll_send_message_args',
@@ -218,8 +218,8 @@ class Forminator_Addon_Slack_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abst
218
  'data_sent' => $api->get_last_data_sent(),
219
  'data_received' => $api->get_last_data_received(),
220
  'url_request' => $api->get_last_url_request(),
221
- 'ts' => $ts, // for delete reference
222
- 'target_id' => $connection_settings['target_id'], // for delete reference
223
  );
224
 
225
  } catch ( Forminator_Addon_Slack_Exception $e ) {
@@ -230,8 +230,8 @@ class Forminator_Addon_Slack_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abst
230
  'data_sent' => ( ( $api instanceof Forminator_Addon_Slack_Wp_Api ) ? $api->get_last_data_sent() : array() ),
231
  'data_received' => ( ( $api instanceof Forminator_Addon_Slack_Wp_Api ) ? $api->get_last_data_received() : array() ),
232
  'url_request' => ( ( $api instanceof Forminator_Addon_Slack_Wp_Api ) ? $api->get_last_url_request() : '' ),
233
- 'ts' => '', // for delete reference,
234
- 'target_id' => '', // for delete reference,
235
  );
236
 
237
  return $addon_entry_fields;
@@ -290,10 +290,10 @@ class Forminator_Addon_Slack_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abst
290
  $fields_array = $this->poll->get_fields_as_array();
291
  $map_entries = Forminator_Form_Entry_Model::map_polls_entries( $this->poll_id, $fields_array );
292
 
293
- // append new answer
294
  if ( ! $this->poll->is_prevent_store() ) {
295
  $entries = 0;
296
- // exists on map entries
297
  if ( in_array( $answer_data, array_keys( $map_entries ), true ) ) {
298
  $entries = $map_entries[ $answer_data ];
299
  }
@@ -352,9 +352,9 @@ class Forminator_Addon_Slack_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abst
352
  *
353
  * @since 1.6.1
354
  *
355
- * @param array $export_headers headers to be displayed on export file
356
- * @param int $poll_id current Poll ID
357
- * @param Forminator_Addon_Slack_Poll_Settings $poll_settings_instance Slack Addon Poll Settings instance
358
  */
359
  $export_headers = apply_filters(
360
  'forminator_addon_slack_poll_export_headers',
@@ -389,8 +389,8 @@ class Forminator_Addon_Slack_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abst
389
  * @since 1.6.1
390
  *
391
  * @param array $addon_meta_data
392
- * @param int $poll_id current Poll ID
393
- * @param Forminator_Addon_Slack_Poll_Settings $poll_settings_instance Slack Addon Poll Settings instance
394
  */
395
  $addon_meta_data = apply_filters(
396
  'forminator_addon_slack_poll_metadata',
@@ -408,11 +408,11 @@ class Forminator_Addon_Slack_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abst
408
  *
409
  * @since 1.6.1
410
  *
411
- * @param array $export_columns column to be exported
412
- * @param int $poll_id current Poll ID
413
- * @param Forminator_Form_Entry_Model $entry_model Form Entry Model
414
- * @param array $addon_meta_data meta data saved by addon on entry fields
415
- * @param Forminator_Addon_Slack_Poll_Settings $poll_settings_instance Slack Addon Poll Settings instance
416
  */
417
  $export_columns = apply_filters(
418
  'forminator_addon_slack_poll_export_columns',
48
  * @since 1.6.1
49
  *
50
  * @param array $submitted_data
51
+ * @param int $pol_id current Poll ID.
52
+ * @param Forminator_Addon_Slack_Poll_Settings $poll_settings_instance Slack Addon Poll Settings instance.
53
  */
54
  $submitted_data = apply_filters(
55
  'forminator_addon_slack_poll_submitted_data',
67
  *
68
  * @since 1.6.1
69
  *
70
+ * @param int $pol_id current Poll ID.
71
  * @param array $submitted_data
72
+ * @param Forminator_Addon_Slack_Poll_Settings $poll_settings_instance Slack Addon Poll Settings instance.
73
  */
74
  do_action( 'forminator_addon_slack_poll_before_send_message', $pol_id, $submitted_data, $poll_settings_instance );
75
 
76
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
77
+ // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to slack.
78
  if ( $poll_settings_instance->is_multi_poll_settings_complete( $key ) ) {
79
+ // exec only on completed connection.
80
  $data[] = array(
81
  'name' => 'status-' . $key,
82
  'value' => $this->get_status_on_send_message( $key, $submitted_data, $addon_setting_value, $form_entry_fields ),
91
  * @since 1.6.1
92
  *
93
  * @param array $entry_fields
94
+ * @param int $pol_id current Poll ID.
95
  * @param array $submitted_data
96
+ * @param Forminator_Addon_Slack_Poll_Settings $poll_settings_instance Slack Addon Poll Settings instance.
97
  */
98
  $data = apply_filters(
99
  'forminator_addon_slack_poll_entry_fields',
120
  * @return array `is_sent` true means its success send data to Slack, false otherwise
121
  */
122
  private function get_status_on_send_message( $connection_id, $submitted_data, $connection_settings, $poll_entry_fields ) {
123
+ // initialize as null.
124
  $api = null;
125
 
126
  $poll_id = $this->poll_id;
142
  $text_message = $connection_settings['message'];
143
  $text_message = forminator_replace_variables( $text_message );
144
 
145
+ // {poll_name_replace}.
146
  $text_message = str_ireplace( '{poll_name}', forminator_get_name_from_model( $this->poll ), $text_message );
147
 
148
  $attachments = $this->get_poll_data_as_attachments( $submitted_data, $poll_entry_fields );
153
  * @since 1.4
154
  *
155
  * @param string $card_name
156
+ * @param int $poll_id Current Poll id.
157
+ * @param string $connection_id ID of current connection.
158
  * @param array $submitted_data
159
+ * @param array $connection_settings current connection setting, contains options of like `name`, `target_id` etc.
160
+ * @param array $poll_entry_fields default entry fields of form.
161
+ * @param array $poll_settings Displayed Poll settings.
162
+ * @param Forminator_Addon_Slack_Poll_Settings $poll_settings_instance Slack Addon Poll Settings instance.
163
  */
164
  $attachments = apply_filters(
165
  'forminator_addon_slack_poll_message_attachments',
184
  * @since 1.3
185
  *
186
  * @param array $args
187
+ * @param int $poll_id Current Poll id.
188
+ * @param string $connection_id ID of current connection.
189
  * @param array $submitted_data
190
+ * @param array $connection_settings current connection setting, contains options of like `name`, `target_id` etc.
191
+ * @param array $poll_entry_fields default entry fields of form.
192
+ * @param array $poll_settings Displayed Poll settings.
193
+ * @param Forminator_Addon_Slack_Poll_Settings $poll_settings_instance Slack Addon Poll Settings instance.
194
  */
195
  $args = apply_filters(
196
  'forminator_addon_slack_poll_send_message_args',
218
  'data_sent' => $api->get_last_data_sent(),
219
  'data_received' => $api->get_last_data_received(),
220
  'url_request' => $api->get_last_url_request(),
221
+ 'ts' => $ts, // for delete reference.
222
+ 'target_id' => $connection_settings['target_id'], // for delete reference.
223
  );
224
 
225
  } catch ( Forminator_Addon_Slack_Exception $e ) {
230
  'data_sent' => ( ( $api instanceof Forminator_Addon_Slack_Wp_Api ) ? $api->get_last_data_sent() : array() ),
231
  'data_received' => ( ( $api instanceof Forminator_Addon_Slack_Wp_Api ) ? $api->get_last_data_received() : array() ),
232
  'url_request' => ( ( $api instanceof Forminator_Addon_Slack_Wp_Api ) ? $api->get_last_url_request() : '' ),
233
+ 'ts' => '', // for delete reference,.
234
+ 'target_id' => '', // for delete reference,.
235
  );
236
 
237
  return $addon_entry_fields;
290
  $fields_array = $this->poll->get_fields_as_array();
291
  $map_entries = Forminator_Form_Entry_Model::map_polls_entries( $this->poll_id, $fields_array );
292
 
293
+ // append new answer.
294
  if ( ! $this->poll->is_prevent_store() ) {
295
  $entries = 0;
296
+ // exists on map entries.
297
  if ( in_array( $answer_data, array_keys( $map_entries ), true ) ) {
298
  $entries = $map_entries[ $answer_data ];
299
  }
352
  *
353
  * @since 1.6.1
354
  *
355
+ * @param array $export_headers headers to be displayed on export file.
356
+ * @param int $poll_id current Poll ID.
357
+ * @param Forminator_Addon_Slack_Poll_Settings $poll_settings_instance Slack Addon Poll Settings instance.
358
  */
359
  $export_headers = apply_filters(
360
  'forminator_addon_slack_poll_export_headers',
389
  * @since 1.6.1
390
  *
391
  * @param array $addon_meta_data
392
+ * @param int $poll_id current Poll ID.
393
+ * @param Forminator_Addon_Slack_Poll_Settings $poll_settings_instance Slack Addon Poll Settings instance.
394
  */
395
  $addon_meta_data = apply_filters(
396
  'forminator_addon_slack_poll_metadata',
408
  *
409
  * @since 1.6.1
410
  *
411
+ * @param array $export_columns column to be exported.
412
+ * @param int $poll_id current Poll ID.
413
+ * @param Forminator_Form_Entry_Model $entry_model Form Entry Model.
414
+ * @param array $addon_meta_data meta data saved by addon on entry fields.
415
+ * @param Forminator_Addon_Slack_Poll_Settings $poll_settings_instance Slack Addon Poll Settings instance.
416
  */
417
  $export_columns = apply_filters(
418
  'forminator_addon_slack_poll_export_columns',
addons/pro/slack/class-forminator-addon-slack-poll-settings.php CHANGED
@@ -50,7 +50,7 @@ class Forminator_Addon_Slack_Poll_Settings extends Forminator_Addon_Poll_Setting
50
  * @return array
51
  */
52
  public function poll_settings_wizards() {
53
- // numerical array steps
54
  return array(
55
  array(
56
  'callback' => array( $this, 'pick_name' ),
@@ -575,7 +575,7 @@ class Forminator_Addon_Slack_Poll_Settings extends Forminator_Addon_Poll_Setting
575
  foreach ( $this->get_poll_settings_values() as $key => $value ) {
576
  $multi_ids[] = array(
577
  'id' => $key,
578
- // use name that was added by user on creating connection
579
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
580
  );
581
  }
@@ -591,7 +591,7 @@ class Forminator_Addon_Slack_Poll_Settings extends Forminator_Addon_Poll_Setting
591
  * @param array $submitted_data
592
  */
593
  public function disconnect_poll( $submitted_data ) {
594
- // only execute if multi_id provided on submitted data
595
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
596
  $addon_poll_settings = $this->get_poll_settings_values();
597
  unset( $addon_poll_settings[ $submitted_data['multi_id'] ] );
50
  * @return array
51
  */
52
  public function poll_settings_wizards() {
53
+ // numerical array steps.
54
  return array(
55
  array(
56
  'callback' => array( $this, 'pick_name' ),
575
  foreach ( $this->get_poll_settings_values() as $key => $value ) {
576
  $multi_ids[] = array(
577
  'id' => $key,
578
+ // use name that was added by user on creating connection.
579
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
580
  );
581
  }
591
  * @param array $submitted_data
592
  */
593
  public function disconnect_poll( $submitted_data ) {
594
+ // only execute if multi_id provided on submitted data.
595
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
596
  $addon_poll_settings = $this->get_poll_settings_values();
597
  unset( $addon_poll_settings[ $submitted_data['multi_id'] ] );
addons/pro/slack/class-forminator-addon-slack-quiz-hooks.php CHANGED
@@ -48,8 +48,8 @@ class Forminator_Addon_Slack_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abst
48
  * @since 1.6.2
49
  *
50
  * @param array $submitted_data
51
- * @param int $quiz_id current Quiz ID
52
- * @param Forminator_Addon_Slack_Quiz_Settings $quiz_settings_instance Slack Addon Quiz Settings instance
53
  */
54
  $submitted_data = apply_filters(
55
  'forminator_addon_slack_quiz_submitted_data',
@@ -67,16 +67,16 @@ class Forminator_Addon_Slack_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abst
67
  *
68
  * @since 1.6.2
69
  *
70
- * @param int $quiz_id current Quiz ID
71
  * @param array $submitted_data
72
- * @param Forminator_Addon_Slack_Quiz_Settings $quiz_settings_instance Slack Addon Quiz Settings instance
73
  */
74
  do_action( 'forminator_addon_slack_quiz_before_send_message', $quiz_id, $submitted_data, $quiz_settings_instance );
75
 
76
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
77
- // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to slack
78
  if ( $quiz_settings_instance->is_multi_quiz_settings_complete( $key ) ) {
79
- // exec only on completed connection
80
  $data[] = array(
81
  'name' => 'status-' . $key,
82
  'value' => $this->get_status_on_send_message( $key, $submitted_data, $addon_setting_value, $form_entry_fields ),
@@ -91,9 +91,9 @@ class Forminator_Addon_Slack_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abst
91
  * @since 1.6.2
92
  *
93
  * @param array $entry_fields
94
- * @param int $quiz_id current Quiz ID
95
  * @param array $submitted_data
96
- * @param Forminator_Addon_Slack_Quiz_Settings $quiz_settings_instance Slack Addon Quiz Settings instance
97
  */
98
  $data = apply_filters(
99
  'forminator_addon_slack_quiz_entry_fields',
@@ -120,7 +120,7 @@ class Forminator_Addon_Slack_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abst
120
  * @return array `is_sent` true means its success send data to Slack, false otherwise
121
  */
122
  private function get_status_on_send_message( $connection_id, $submitted_data, $connection_settings, $quiz_entry_fields ) {
123
- // initialize as null
124
  $api = null;
125
 
126
  $quiz_id = $this->quiz_id;
@@ -144,7 +144,7 @@ class Forminator_Addon_Slack_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abst
144
  $text_message = $connection_settings['message'];
145
  $text_message = forminator_replace_variables( $text_message );
146
 
147
- // {quiz_name_replace} //phpcs:ignore
148
  $text_message = str_ireplace( '{quiz_name}', forminator_get_name_from_model( $this->quiz ), $text_message );
149
 
150
  $quiz_attachments = $this->get_quiz_data_as_attachments( $submitted_data, $quiz_entry_fields );
@@ -163,13 +163,13 @@ class Forminator_Addon_Slack_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abst
163
  * @since 1.4
164
  *
165
  * @param string $card_name
166
- * @param int $quiz_id Current Quiz id
167
- * @param string $connection_id ID of current connection
168
  * @param array $submitted_data
169
- * @param array $connection_settings current connection setting, contains options of like `name`, `target_id` etc
170
- * @param array $quiz_entry_fields default entry fields of form
171
- * @param array $quiz_settings Displayed Quiz settings
172
- * @param Forminator_Addon_Slack_Quiz_Settings $quiz_settings_instance Slack Addon Quiz Settings instance
173
  */
174
  $attachments = apply_filters(
175
  'forminator_addon_slack_quiz_message_attachments',
@@ -194,13 +194,13 @@ class Forminator_Addon_Slack_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abst
194
  * @since 1.3
195
  *
196
  * @param array $args
197
- * @param int $quiz_id Current Quiz id
198
- * @param string $connection_id ID of current connection
199
  * @param array $submitted_data
200
- * @param array $connection_settings current connection setting, contains options of like `name`, `target_id` etc
201
- * @param array $quiz_entry_fields default entry fields of form
202
- * @param array $quiz_settings Displayed Quiz settings
203
- * @param Forminator_Addon_Slack_Quiz_Settings $quiz_settings_instance Slack Addon Quiz Settings instance
204
  */
205
  $args = apply_filters(
206
  'forminator_addon_slack_quiz_send_message_args',
@@ -228,8 +228,8 @@ class Forminator_Addon_Slack_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abst
228
  'data_sent' => $api->get_last_data_sent(),
229
  'data_received' => $api->get_last_data_received(),
230
  'url_request' => $api->get_last_url_request(),
231
- 'ts' => $ts, // for delete reference
232
- 'target_id' => $connection_settings['target_id'], // for delete reference
233
  );
234
 
235
  } catch ( Forminator_Addon_Slack_Exception $e ) {
@@ -240,8 +240,8 @@ class Forminator_Addon_Slack_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abst
240
  'data_sent' => ( ( $api instanceof Forminator_Addon_Slack_Wp_Api ) ? $api->get_last_data_sent() : array() ),
241
  'data_received' => ( ( $api instanceof Forminator_Addon_Slack_Wp_Api ) ? $api->get_last_data_received() : array() ),
242
  'url_request' => ( ( $api instanceof Forminator_Addon_Slack_Wp_Api ) ? $api->get_last_url_request() : '' ),
243
- 'ts' => '', // for delete reference,
244
- 'target_id' => '', // for delete reference,
245
  );
246
 
247
  return $addon_entry_fields;
@@ -276,7 +276,7 @@ class Forminator_Addon_Slack_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abst
276
  if ( isset( $quiz_entry['name'] ) && isset( $quiz_entry['value'] ) && 'entry' === $quiz_entry['name'] ) {
277
  if ( is_array( $quiz_entry['value'] ) ) {
278
 
279
- // KNOWLEDGE
280
  if ( 'knowledge' === $this->quiz->quiz_type ) {
281
  foreach ( $quiz_entry['value'] as $data ) {
282
  $question = isset( $data['question'] ) ? $data['question'] : '';
@@ -413,7 +413,7 @@ class Forminator_Addon_Slack_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abst
413
  }
414
  $post_element_id = str_ireplace( '-post-image', '', $post_element_id );
415
 
416
- // only add postdata as single
417
  if ( in_array( $post_element_id, $post_element_ids, true ) ) {
418
  continue;
419
  }
@@ -485,9 +485,9 @@ class Forminator_Addon_Slack_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abst
485
  *
486
  * @since 1.6.2
487
  *
488
- * @param array $export_headers headers to be displayed on export file
489
- * @param int $quiz_id current Quiz ID
490
- * @param Forminator_Addon_Slack_Quiz_Settings $quiz_settings_instance Slack Addon Quiz Settings instance
491
  */
492
  $export_headers = apply_filters(
493
  'forminator_addon_slack_quiz_export_headers',
@@ -522,8 +522,8 @@ class Forminator_Addon_Slack_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abst
522
  * @since 1.6.2
523
  *
524
  * @param array $addon_meta_data
525
- * @param int $quiz_id current Quiz ID
526
- * @param Forminator_Addon_Slack_Quiz_Settings $quiz_settings_instance Slack Addon Quiz Settings instance
527
  */
528
  $addon_meta_data = apply_filters(
529
  'forminator_addon_slack_quiz_metadata',
@@ -541,11 +541,11 @@ class Forminator_Addon_Slack_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abst
541
  *
542
  * @since 1.6.2
543
  *
544
- * @param array $export_columns column to be exported
545
- * @param int $quiz_id current Quiz ID
546
- * @param Forminator_Form_Entry_Model $entry_model Form Entry Model
547
- * @param array $addon_meta_data meta data saved by addon on entry fields
548
- * @param Forminator_Addon_Slack_Quiz_Settings $quiz_settings_instance Slack Addon Quiz Settings instance
549
  */
550
  $export_columns = apply_filters(
551
  'forminator_addon_slack_quiz_export_columns',
@@ -582,8 +582,8 @@ class Forminator_Addon_Slack_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abst
582
  * @since 1.6.2
583
  *
584
  * @param array $addon_meta_data
585
- * @param int $quiz_id current Quiz ID
586
- * @param Forminator_Addon_Slack_Quiz_Settings $quiz_settings_instance Slack Addon Quiz Settings instance
587
  */
588
  $addon_meta_data = apply_filters(
589
  'forminator_addon_quiz_slack_metadata',
@@ -671,7 +671,7 @@ class Forminator_Addon_Slack_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abst
671
  }
672
 
673
  if ( Forminator_Addon_Slack::is_show_full_log() ) {
674
- // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_SLACK_SHOW_FULL_LOG', true)`
675
  if ( isset( $status['url_request'] ) ) {
676
  $sub_entries[] = array(
677
  'label' => __( 'API URL', 'forminator' ),
@@ -696,7 +696,7 @@ class Forminator_Addon_Slack_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abst
696
 
697
  $additional_entry_item['sub_entries'] = $sub_entries;
698
 
699
- // return single array
700
  return $additional_entry_item;
701
  }
702
 
48
  * @since 1.6.2
49
  *
50
  * @param array $submitted_data
51
+ * @param int $quiz_id current Quiz ID.
52
+ * @param Forminator_Addon_Slack_Quiz_Settings $quiz_settings_instance Slack Addon Quiz Settings instance.
53
  */
54
  $submitted_data = apply_filters(
55
  'forminator_addon_slack_quiz_submitted_data',
67
  *
68
  * @since 1.6.2
69
  *
70
+ * @param int $quiz_id current Quiz ID.
71
  * @param array $submitted_data
72
+ * @param Forminator_Addon_Slack_Quiz_Settings $quiz_settings_instance Slack Addon Quiz Settings instance.
73
  */
74
  do_action( 'forminator_addon_slack_quiz_before_send_message', $quiz_id, $submitted_data, $quiz_settings_instance );
75
 
76
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
77
+ // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to slack.
78
  if ( $quiz_settings_instance->is_multi_quiz_settings_complete( $key ) ) {
79
+ // exec only on completed connection.
80
  $data[] = array(
81
  'name' => 'status-' . $key,
82
  'value' => $this->get_status_on_send_message( $key, $submitted_data, $addon_setting_value, $form_entry_fields ),
91
  * @since 1.6.2
92
  *
93
  * @param array $entry_fields
94
+ * @param int $quiz_id current Quiz ID.
95
  * @param array $submitted_data
96
+ * @param Forminator_Addon_Slack_Quiz_Settings $quiz_settings_instance Slack Addon Quiz Settings instance.
97
  */
98
  $data = apply_filters(
99
  'forminator_addon_slack_quiz_entry_fields',
120
  * @return array `is_sent` true means its success send data to Slack, false otherwise
121
  */
122
  private function get_status_on_send_message( $connection_id, $submitted_data, $connection_settings, $quiz_entry_fields ) {
123
+ // initialize as null.
124
  $api = null;
125
 
126
  $quiz_id = $this->quiz_id;
144
  $text_message = $connection_settings['message'];
145
  $text_message = forminator_replace_variables( $text_message );
146
 
147
+ // {quiz_name_replace}.
148
  $text_message = str_ireplace( '{quiz_name}', forminator_get_name_from_model( $this->quiz ), $text_message );
149
 
150
  $quiz_attachments = $this->get_quiz_data_as_attachments( $submitted_data, $quiz_entry_fields );
163
  * @since 1.4
164
  *
165
  * @param string $card_name
166
+ * @param int $quiz_id Current Quiz id.
167
+ * @param string $connection_id ID of current connection.
168
  * @param array $submitted_data
169
+ * @param array $connection_settings current connection setting, contains options of like `name`, `target_id` etc.
170
+ * @param array $quiz_entry_fields default entry fields of form.
171
+ * @param array $quiz_settings Displayed Quiz settings.
172
+ * @param Forminator_Addon_Slack_Quiz_Settings $quiz_settings_instance Slack Addon Quiz Settings instance.
173
  */
174
  $attachments = apply_filters(
175
  'forminator_addon_slack_quiz_message_attachments',
194
  * @since 1.3
195
  *
196
  * @param array $args
197
+ * @param int $quiz_id Current Quiz id.
198
+ * @param string $connection_id ID of current connection.
199
  * @param array $submitted_data
200
+ * @param array $connection_settings current connection setting, contains options of like `name`, `target_id` etc.
201
+ * @param array $quiz_entry_fields default entry fields of form.
202
+ * @param array $quiz_settings Displayed Quiz settings.
203
+ * @param Forminator_Addon_Slack_Quiz_Settings $quiz_settings_instance Slack Addon Quiz Settings instance.
204
  */
205
  $args = apply_filters(
206
  'forminator_addon_slack_quiz_send_message_args',
228
  'data_sent' => $api->get_last_data_sent(),
229
  'data_received' => $api->get_last_data_received(),
230
  'url_request' => $api->get_last_url_request(),
231
+ 'ts' => $ts, // for delete reference.
232
+ 'target_id' => $connection_settings['target_id'], // for delete reference.
233
  );
234
 
235
  } catch ( Forminator_Addon_Slack_Exception $e ) {
240
  'data_sent' => ( ( $api instanceof Forminator_Addon_Slack_Wp_Api ) ? $api->get_last_data_sent() : array() ),
241
  'data_received' => ( ( $api instanceof Forminator_Addon_Slack_Wp_Api ) ? $api->get_last_data_received() : array() ),
242
  'url_request' => ( ( $api instanceof Forminator_Addon_Slack_Wp_Api ) ? $api->get_last_url_request() : '' ),
243
+ 'ts' => '', // for delete reference,.
244
+ 'target_id' => '', // for delete reference,.
245
  );
246
 
247
  return $addon_entry_fields;
276
  if ( isset( $quiz_entry['name'] ) && isset( $quiz_entry['value'] ) && 'entry' === $quiz_entry['name'] ) {
277
  if ( is_array( $quiz_entry['value'] ) ) {
278
 
279
+ // KNOWLEDGE.
280
  if ( 'knowledge' === $this->quiz->quiz_type ) {
281
  foreach ( $quiz_entry['value'] as $data ) {
282
  $question = isset( $data['question'] ) ? $data['question'] : '';
413
  }
414
  $post_element_id = str_ireplace( '-post-image', '', $post_element_id );
415
 
416
+ // only add postdata as single.
417
  if ( in_array( $post_element_id, $post_element_ids, true ) ) {
418
  continue;
419
  }
485
  *
486
  * @since 1.6.2
487
  *
488
+ * @param array $export_headers headers to be displayed on export file.
489
+ * @param int $quiz_id current Quiz ID.
490
+ * @param Forminator_Addon_Slack_Quiz_Settings $quiz_settings_instance Slack Addon Quiz Settings instance.
491
  */
492
  $export_headers = apply_filters(
493
  'forminator_addon_slack_quiz_export_headers',
522
  * @since 1.6.2
523
  *
524
  * @param array $addon_meta_data
525
+ * @param int $quiz_id current Quiz ID.
526
+ * @param Forminator_Addon_Slack_Quiz_Settings $quiz_settings_instance Slack Addon Quiz Settings instance.
527
  */
528
  $addon_meta_data = apply_filters(
529
  'forminator_addon_slack_quiz_metadata',
541
  *
542
  * @since 1.6.2
543
  *
544
+ * @param array $export_columns column to be exported.
545
+ * @param int $quiz_id current Quiz ID.
546
+ * @param Forminator_Form_Entry_Model $entry_model Form Entry Model.
547
+ * @param array $addon_meta_data meta data saved by addon on entry fields.
548
+ * @param Forminator_Addon_Slack_Quiz_Settings $quiz_settings_instance Slack Addon Quiz Settings instance.
549
  */
550
  $export_columns = apply_filters(
551
  'forminator_addon_slack_quiz_export_columns',
582
  * @since 1.6.2
583
  *
584
  * @param array $addon_meta_data
585
+ * @param int $quiz_id current Quiz ID.
586
+ * @param Forminator_Addon_Slack_Quiz_Settings $quiz_settings_instance Slack Addon Quiz Settings instance.
587
  */
588
  $addon_meta_data = apply_filters(
589
  'forminator_addon_quiz_slack_metadata',
671
  }
672
 
673
  if ( Forminator_Addon_Slack::is_show_full_log() ) {
674
+ // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_SLACK_SHOW_FULL_LOG', true)`.
675
  if ( isset( $status['url_request'] ) ) {
676
  $sub_entries[] = array(
677
  'label' => __( 'API URL', 'forminator' ),
696
 
697
  $additional_entry_item['sub_entries'] = $sub_entries;
698
 
699
+ // return single array.
700
  return $additional_entry_item;
701
  }
702
 
addons/pro/slack/class-forminator-addon-slack-quiz-settings.php CHANGED
@@ -50,7 +50,7 @@ class Forminator_Addon_Slack_Quiz_Settings extends Forminator_Addon_Quiz_Setting
50
  * @return array
51
  */
52
  public function quiz_settings_wizards() {
53
- // numerical array steps
54
  return array(
55
  array(
56
  'callback' => array( $this, 'pick_name' ),
@@ -580,7 +580,7 @@ class Forminator_Addon_Slack_Quiz_Settings extends Forminator_Addon_Quiz_Setting
580
  foreach ( $this->get_quiz_settings_values() as $key => $value ) {
581
  $multi_ids[] = array(
582
  'id' => $key,
583
- // use name that was added by user on creating connection
584
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
585
  );
586
  }
@@ -596,7 +596,7 @@ class Forminator_Addon_Slack_Quiz_Settings extends Forminator_Addon_Quiz_Setting
596
  * @param array $submitted_data
597
  */
598
  public function disconnect_quiz( $submitted_data ) {
599
- // only execute if multi_id provided on submitted data
600
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
601
  $addon_quiz_settings = $this->get_quiz_settings_values();
602
  unset( $addon_quiz_settings[ $submitted_data['multi_id'] ] );
50
  * @return array
51
  */
52
  public function quiz_settings_wizards() {
53
+ // numerical array steps.
54
  return array(
55
  array(
56
  'callback' => array( $this, 'pick_name' ),
580
  foreach ( $this->get_quiz_settings_values() as $key => $value ) {
581
  $multi_ids[] = array(
582
  'id' => $key,
583
+ // use name that was added by user on creating connection.
584
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
585
  );
586
  }
596
  * @param array $submitted_data
597
  */
598
  public function disconnect_quiz( $submitted_data ) {
599
+ // only execute if multi_id provided on submitted data.
600
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
601
  $addon_quiz_settings = $this->get_quiz_settings_values();
602
  unset( $addon_quiz_settings[ $submitted_data['multi_id'] ] );
addons/pro/slack/class-forminator-addon-slack.php CHANGED
@@ -54,7 +54,7 @@ final class Forminator_Addon_Slack extends Forminator_Addon_Abstract {
54
  * @since 1.0 Slack Addon
55
  */
56
  public function __construct() {
57
- // late init to allow translation
58
  $this->_description = __( 'Get awesome by your form.', 'forminator' );
59
  $this->_activation_error_message = __( 'Sorry but we failed to activate Slack Integration, don\'t hesitate to contact us', 'forminator' );
60
  $this->_deactivation_error_message = __( 'Sorry but we failed to deactivate Slack Integration, please try again', 'forminator' );
@@ -95,16 +95,16 @@ final class Forminator_Addon_Slack extends Forminator_Addon_Abstract {
95
  */
96
  public function is_connected() {
97
  try {
98
- // check if its active
99
  if ( ! $this->is_active() ) {
100
  throw new Forminator_Addon_Slack_Exception( __( 'Slack is not active', 'forminator' ) );
101
  }
102
 
103
- // if user completed api setup
104
  $is_connected = false;
105
 
106
  $setting_values = $this->get_settings_values();
107
- // if user completed api setup
108
  if ( isset( $setting_values['token'] ) && ! empty( $setting_values['token'] ) ) {
109
  $is_connected = true;
110
  }
@@ -145,7 +145,7 @@ final class Forminator_Addon_Slack extends Forminator_Addon_Abstract {
145
  throw new Forminator_Addon_Slack_Exception( __( 'Invalid Form Settings of Slack', 'forminator' ) );
146
  }
147
 
148
- // Mark as active when there is at least one active connection
149
  if ( false === $form_settings_instance->find_one_active_connection() ) {
150
  throw new Forminator_Addon_Slack_Exception( __( 'No active Slack connection found in this form', 'forminator' ) );
151
  }
@@ -162,8 +162,8 @@ final class Forminator_Addon_Slack extends Forminator_Addon_Abstract {
162
  * @since 1.0
163
  *
164
  * @param bool $is_form_connected
165
- * @param int $form_id Current Form ID
166
- * @param Forminator_Addon_Slack_Form_Settings|null $form_settings_instance Instance of form settings, or null when unavailable
167
  *
168
  */
169
  $is_form_connected = apply_filters( 'forminator_addon_slack_is_form_connected', $is_form_connected, $form_id, $form_settings_instance );
@@ -340,7 +340,7 @@ final class Forminator_Addon_Slack extends Forminator_Addon_Abstract {
340
  }
341
 
342
  if ( ! $has_errors ) {
343
- // validate api
344
  try {
345
  if ( $this->get_client_id() !== $client_id || $this->get_client_secret() !== $client_secret ) {
346
  // reset connection!
@@ -454,7 +454,7 @@ final class Forminator_Addon_Slack extends Forminator_Addon_Abstract {
454
  $has_errors = true;
455
 
456
  $setting_values = $this->get_settings_values();
457
- // reset err msg
458
  if ( $this->_auth_error_message ) {
459
  unset( $setting_values['auth_error_message'] );
460
  $this->save_settings_values( $setting_values );
@@ -485,7 +485,7 @@ final class Forminator_Addon_Slack extends Forminator_Addon_Abstract {
485
  public function is_authorized( $submitted_data ) {
486
  $setting_values = $this->get_settings_values();
487
 
488
- // check api_key and and api_url set up
489
  return isset( $setting_values['token'] ) && ! empty( $setting_values['token'] );
490
  }
491
 
@@ -644,7 +644,7 @@ final class Forminator_Addon_Slack extends Forminator_Addon_Abstract {
644
  $code = $query_args['code'];
645
  $token = '';
646
 
647
- // prefer new instance
648
  $api = Forminator_Addon_Slack_Wp_Api::get_instance( uniqid() );
649
  $redirect_uri = forminator_addon_integration_section_admin_url( $this, 'authorize', false );
650
  $token_request = $api->get_access_token( $code, $redirect_uri );
@@ -669,12 +669,12 @@ final class Forminator_Addon_Slack extends Forminator_Addon_Abstract {
669
  $this->save_settings_values( $settings );
670
  $template_params['is_close'] = true;
671
  } catch ( Exception $e ) {
672
- // catch all exception
673
  $template_params['error_message'] = $e->getMessage();
674
  }
675
  } else {
676
  $template_params['error_message'] = __( 'Failed to get authorization code.', 'forminator' );
677
- // todo : translate $query_args[error]
678
  $settings['auth_error_message'] = $template_params['error_message'];
679
  $this->save_settings_values( $settings );
680
  $template_params['is_close'] = true;
@@ -776,7 +776,7 @@ final class Forminator_Addon_Slack extends Forminator_Addon_Abstract {
776
  throw new Forminator_Addon_Slack_Exception( 'Invalid Poll Settings of Slack' );
777
  }
778
 
779
- // Mark as active when there is at least one active connection
780
  if ( false === $poll_settings_instance->find_one_active_connection() ) {
781
  throw new Forminator_Addon_Slack_Exception( 'No active Slack connection found in this poll' );
782
  }
@@ -794,8 +794,8 @@ final class Forminator_Addon_Slack extends Forminator_Addon_Abstract {
794
  * @since 1.6.1
795
  *
796
  * @param bool $is_poll_connected
797
- * @param int $poll_id Current Poll ID
798
- * @param Forminator_Addon_Slack_Poll_Settings|null $poll_settings_instance Instance of poll settings, or null when unavailable
799
  *
800
  */
801
  $is_poll_connected = apply_filters( 'forminator_addon_slack_is_poll_connected', $is_poll_connected, $poll_id, $poll_settings_instance );
@@ -836,7 +836,7 @@ final class Forminator_Addon_Slack extends Forminator_Addon_Abstract {
836
  throw new Forminator_Addon_Slack_Exception( 'Invalid Quiz Settings of Slack' );
837
  }
838
 
839
- // Mark as active when there is at least one active connection
840
  if ( false === $quiz_settings_instance->find_one_active_connection() ) {
841
  throw new Forminator_Addon_Slack_Exception( 'No active Slack connection found in this quiz' );
842
  }
@@ -854,8 +854,8 @@ final class Forminator_Addon_Slack extends Forminator_Addon_Abstract {
854
  * @since 1.6.1
855
  *
856
  * @param bool $is_quiz_connected
857
- * @param int $quiz_id Current Quiz ID
858
- * @param Forminator_Addon_Slack_Quiz_Settings|null $quiz_settings_instance Instance of Quiz settings, or null when unavailable
859
  *
860
  */
861
  $is_quiz_connected = apply_filters( 'forminator_addon_slack_is_quiz_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
54
  * @since 1.0 Slack Addon
55
  */
56
  public function __construct() {
57
+ // late init to allow translation.
58
  $this->_description = __( 'Get awesome by your form.', 'forminator' );
59
  $this->_activation_error_message = __( 'Sorry but we failed to activate Slack Integration, don\'t hesitate to contact us', 'forminator' );
60
  $this->_deactivation_error_message = __( 'Sorry but we failed to deactivate Slack Integration, please try again', 'forminator' );
95
  */
96
  public function is_connected() {
97
  try {
98
+ // check if its active.
99
  if ( ! $this->is_active() ) {
100
  throw new Forminator_Addon_Slack_Exception( __( 'Slack is not active', 'forminator' ) );
101
  }
102
 
103
+ // if user completed api setup.
104
  $is_connected = false;
105
 
106
  $setting_values = $this->get_settings_values();
107
+ // if user completed api setup.
108
  if ( isset( $setting_values['token'] ) && ! empty( $setting_values['token'] ) ) {
109
  $is_connected = true;
110
  }
145
  throw new Forminator_Addon_Slack_Exception( __( 'Invalid Form Settings of Slack', 'forminator' ) );
146
  }
147
 
148
+ // Mark as active when there is at least one active connection.
149
  if ( false === $form_settings_instance->find_one_active_connection() ) {
150
  throw new Forminator_Addon_Slack_Exception( __( 'No active Slack connection found in this form', 'forminator' ) );
151
  }
162
  * @since 1.0
163
  *
164
  * @param bool $is_form_connected
165
+ * @param int $form_id Current Form ID.
166
+ * @param Forminator_Addon_Slack_Form_Settings|null $form_settings_instance Instance of form settings, or null when unavailable.
167
  *
168
  */
169
  $is_form_connected = apply_filters( 'forminator_addon_slack_is_form_connected', $is_form_connected, $form_id, $form_settings_instance );
340
  }
341
 
342
  if ( ! $has_errors ) {
343
+ // validate api.
344
  try {
345
  if ( $this->get_client_id() !== $client_id || $this->get_client_secret() !== $client_secret ) {
346
  // reset connection!
454
  $has_errors = true;
455
 
456
  $setting_values = $this->get_settings_values();
457
+ // reset err msg.
458
  if ( $this->_auth_error_message ) {
459
  unset( $setting_values['auth_error_message'] );
460
  $this->save_settings_values( $setting_values );
485
  public function is_authorized( $submitted_data ) {
486
  $setting_values = $this->get_settings_values();
487
 
488
+ // check api_key and and api_url set up.
489
  return isset( $setting_values['token'] ) && ! empty( $setting_values['token'] );
490
  }
491
 
644
  $code = $query_args['code'];
645
  $token = '';
646
 
647
+ // prefer new instance.
648
  $api = Forminator_Addon_Slack_Wp_Api::get_instance( uniqid() );
649
  $redirect_uri = forminator_addon_integration_section_admin_url( $this, 'authorize', false );
650
  $token_request = $api->get_access_token( $code, $redirect_uri );
669
  $this->save_settings_values( $settings );
670
  $template_params['is_close'] = true;
671
  } catch ( Exception $e ) {
672
+ // catch all exception.
673
  $template_params['error_message'] = $e->getMessage();
674
  }
675
  } else {
676
  $template_params['error_message'] = __( 'Failed to get authorization code.', 'forminator' );
677
+ // todo : translate $query_args[error].
678
  $settings['auth_error_message'] = $template_params['error_message'];
679
  $this->save_settings_values( $settings );
680
  $template_params['is_close'] = true;
776
  throw new Forminator_Addon_Slack_Exception( 'Invalid Poll Settings of Slack' );
777
  }
778
 
779
+ // Mark as active when there is at least one active connection.
780
  if ( false === $poll_settings_instance->find_one_active_connection() ) {
781
  throw new Forminator_Addon_Slack_Exception( 'No active Slack connection found in this poll' );
782
  }
794
  * @since 1.6.1
795
  *
796
  * @param bool $is_poll_connected
797
+ * @param int $poll_id Current Poll ID.
798
+ * @param Forminator_Addon_Slack_Poll_Settings|null $poll_settings_instance Instance of poll settings, or null when unavailable.
799
  *
800
  */
801
  $is_poll_connected = apply_filters( 'forminator_addon_slack_is_poll_connected', $is_poll_connected, $poll_id, $poll_settings_instance );
836
  throw new Forminator_Addon_Slack_Exception( 'Invalid Quiz Settings of Slack' );
837
  }
838
 
839
+ // Mark as active when there is at least one active connection.
840
  if ( false === $quiz_settings_instance->find_one_active_connection() ) {
841
  throw new Forminator_Addon_Slack_Exception( 'No active Slack connection found in this quiz' );
842
  }
854
  * @since 1.6.1
855
  *
856
  * @param bool $is_quiz_connected
857
+ * @param int $quiz_id Current Quiz ID.
858
+ * @param Forminator_Addon_Slack_Quiz_Settings|null $quiz_settings_instance Instance of Quiz settings, or null when unavailable.
859
  *
860
  */
861
  $is_quiz_connected = apply_filters( 'forminator_addon_slack_is_quiz_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
addons/pro/slack/lib/class-forminator-addon-slack-wp-api.php CHANGED
@@ -113,7 +113,7 @@ class Forminator_Addon_Slack_Wp_Api {
113
  *
114
  * @since 1.1
115
  *
116
- * @param string $user_agent current user agent
117
  */
118
  $user_agent = apply_filters( 'forminator_addon_slack_api_user_agent', $user_agent );
119
 
@@ -134,7 +134,7 @@ class Forminator_Addon_Slack_Wp_Api {
134
  * @throws Forminator_Addon_Slack_Wp_Api_Not_Found_Exception
135
  */
136
  private function request( $verb, $path, $args = array() ) {
137
- // Adding extra user agent for wp remote request
138
  add_filter( 'http_headers_useragent', array( $this, 'filter_user_agent' ) );
139
 
140
  $url = trailingslashit( $this->_endpoint ) . $path;
@@ -145,10 +145,10 @@ class Forminator_Addon_Slack_Wp_Api {
145
  *
146
  * @since 1.1
147
  *
148
- * @param string $url full url with scheme
149
- * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`
150
- * @param string $path requested path resource
151
- * @param array $args argument sent to this function
152
  */
153
  $url = apply_filters( 'forminator_addon_slack_api_url', $url, $verb, $path, $args );
154
 
@@ -168,9 +168,9 @@ class Forminator_Addon_Slack_Wp_Api {
168
  * @since 1.1
169
  *
170
  * @param array $headers
171
- * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`
172
- * @param string $path requested path resource
173
- * @param array $args argument sent to this function
174
  */
175
  $headers = apply_filters( 'forminator_addon_slack_api_request_headers', $headers, $verb, $path, $args );
176
 
@@ -185,9 +185,9 @@ class Forminator_Addon_Slack_Wp_Api {
185
  *
186
  * @since 1.1
187
  *
188
- * @param array $request_data it will be `http_build_query`-ed when `GET` or `wp_json_encode`-ed otherwise
189
- * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`
190
- * @param string $path requested path resource
191
  */
192
  $args = apply_filters( 'forminator_addon_slack_api_request_data', $request_data, $verb, $path );
193
 
@@ -229,7 +229,7 @@ class Forminator_Addon_Slack_Wp_Api {
229
 
230
  $body = wp_remote_retrieve_body( $res );
231
 
232
- // probably silent mode
233
  if ( ! empty( $body ) ) {
234
  $res = json_decode( $body );
235
  if ( isset( $res->ok ) && false === $res->ok ) {
@@ -248,9 +248,9 @@ class Forminator_Addon_Slack_Wp_Api {
248
  *
249
  * @since 1.1
250
  *
251
- * @param mixed $response original wp remote request response or decoded body if available
252
- * @param string $body original content of http response's body
253
- * @param array|WP_Error $wp_response original wp remote request response
254
  */
255
  $res = apply_filters( 'forminator_addon_slack_api_response', $response, $body, $wp_response );
256
 
113
  *
114
  * @since 1.1
115
  *
116
+ * @param string $user_agent current user agent.
117
  */
118
  $user_agent = apply_filters( 'forminator_addon_slack_api_user_agent', $user_agent );
119
 
134
  * @throws Forminator_Addon_Slack_Wp_Api_Not_Found_Exception
135
  */
136
  private function request( $verb, $path, $args = array() ) {
137
+ // Adding extra user agent for wp remote request.
138
  add_filter( 'http_headers_useragent', array( $this, 'filter_user_agent' ) );
139
 
140
  $url = trailingslashit( $this->_endpoint ) . $path;
145
  *
146
  * @since 1.1
147
  *
148
+ * @param string $url full url with scheme.
149
+ * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`.
150
+ * @param string $path requested path resource.
151
+ * @param array $args argument sent to this function.
152
  */
153
  $url = apply_filters( 'forminator_addon_slack_api_url', $url, $verb, $path, $args );
154
 
168
  * @since 1.1
169
  *
170
  * @param array $headers
171
+ * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`.
172
+ * @param string $path requested path resource.
173
+ * @param array $args argument sent to this function.
174
  */
175
  $headers = apply_filters( 'forminator_addon_slack_api_request_headers', $headers, $verb, $path, $args );
176
 
185
  *
186
  * @since 1.1
187
  *
188
+ * @param array $request_data it will be `http_build_query`-ed when `GET` or `wp_json_encode`-ed otherwise.
189
+ * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`.
190
+ * @param string $path requested path resource.
191
  */
192
  $args = apply_filters( 'forminator_addon_slack_api_request_data', $request_data, $verb, $path );
193
 
229
 
230
  $body = wp_remote_retrieve_body( $res );
231
 
232
+ // probably silent mode.
233
  if ( ! empty( $body ) ) {
234
  $res = json_decode( $body );
235
  if ( isset( $res->ok ) && false === $res->ok ) {
248
  *
249
  * @since 1.1
250
  *
251
+ * @param mixed $response original wp remote request response or decoded body if available.
252
+ * @param string $body original content of http response's body.
253
+ * @param array|WP_Error $wp_response original wp remote request response.
254
  */
255
  $res = apply_filters( 'forminator_addon_slack_api_response', $response, $body, $wp_response );
256
 
addons/pro/slack/views/form-settings/pick-name.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
addons/pro/slack/views/form-settings/select-target.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'target_id' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'target_id' => '',
addons/pro/slack/views/form-settings/select-type.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'type' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'type' => '',
addons/pro/slack/views/form-settings/setup-message.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'message' => '',
5
  'message_error' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'message' => '',
5
  'message_error' => '',
addons/pro/slack/views/poll-settings/pick-name.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
addons/pro/slack/views/poll-settings/select-target.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'target_id' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'target_id' => '',
addons/pro/slack/views/poll-settings/select-type.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'type' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'type' => '',
addons/pro/slack/views/poll-settings/setup-message.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'message' => '',
5
  'message_error' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'message' => '',
5
  'message_error' => '',
addons/pro/slack/views/quiz-settings/pick-name.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
addons/pro/slack/views/quiz-settings/select-target.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'target_id' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'target_id' => '',
addons/pro/slack/views/quiz-settings/select-type.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'type' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'type' => '',
addons/pro/slack/views/quiz-settings/setup-message.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'message' => '',
5
  'message_error' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'message' => '',
5
  'message_error' => '',
addons/pro/slack/views/sections/authorize.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'is_close' => false,
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'is_close' => false,
addons/pro/slack/views/settings/authorize.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'auth_url' => '',
5
  'token' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'auth_url' => '',
5
  'token' => '',
addons/pro/slack/views/settings/error-authorize.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'auth_url' => '',
5
  'error_message' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'auth_url' => '',
5
  'error_message' => '',
addons/pro/slack/views/settings/setup-client.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'token' => '',
5
  'error_message' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'token' => '',
5
  'error_message' => '',
addons/pro/slack/views/settings/wait-authorize.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'auth_url' => '',
5
  'token' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'auth_url' => '',
5
  'token' => '',
addons/pro/trello/class-forminator-addon-trello-form-hooks.php CHANGED
@@ -64,8 +64,8 @@ class Forminator_Addon_Trello_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
64
  *
65
  * @param array $submitted_data
66
  * @param array $form_entry_fields
67
- * @param int $form_id current Form ID
68
- * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance
69
  */
70
  $submitted_data = apply_filters(
71
  'forminator_addon_trello_form_submitted_data',
@@ -82,8 +82,8 @@ class Forminator_Addon_Trello_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
82
  *
83
  * @param array $form_entry_fields
84
  * @param array $submitted_data
85
- * @param int $form_id current Form ID
86
- * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance
87
  */
88
  $form_entry_fields = apply_filters(
89
  'forminator_addon_trello_form_entry_fields',
@@ -104,16 +104,16 @@ class Forminator_Addon_Trello_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
104
  *
105
  * @since 1.2
106
  *
107
- * @param int $form_id current Form ID
108
  * @param array $submitted_data
109
- * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance
110
  */
111
  do_action( 'forminator_addon_trello_before_create_card', $form_id, $submitted_data, $form_settings_instance );
112
 
113
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
114
- // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to trello
115
  if ( $form_settings_instance->is_multi_form_settings_complete( $key ) ) {
116
- // exec only on completed connection
117
  $data[] = array(
118
  'name' => 'status-' . $key,
119
  'value' => $this->get_status_on_create_card( $key, $submitted_data, $addon_setting_value, $form_entry_fields ),
@@ -128,10 +128,10 @@ class Forminator_Addon_Trello_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
128
  * @since 1.2
129
  *
130
  * @param array $entry_fields
131
- * @param int $form_id current Form ID
132
  * @param array $submitted_data
133
  * @param array $form_entry_fields
134
- * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance
135
  */
136
  $data = apply_filters(
137
  'forminator_addon_trello_entry_fields',
@@ -159,7 +159,7 @@ class Forminator_Addon_Trello_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
159
  * @return array `is_sent` true means its success send data to Trello, false otherwise
160
  */
161
  private function get_status_on_create_card( $connection_id, $submitted_data, $connection_settings, $form_entry_fields ) {
162
- // initialize as null
163
  $api = null;
164
 
165
  $form_id = $this->form_id;
@@ -178,7 +178,7 @@ class Forminator_Addon_Trello_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
178
 
179
  if ( isset( $connection_settings['card_name'] ) ) {
180
  $card_name = $connection_settings['card_name'];
181
- // disable all_fields here
182
  $card_name = str_ireplace( '{all_fields}', '', $card_name );
183
  $card_name = forminator_addon_replace_custom_vars( $card_name, $submitted_data, $this->custom_form, $form_entry_fields, false );
184
 
@@ -188,13 +188,13 @@ class Forminator_Addon_Trello_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
188
  * @since 1.2
189
  *
190
  * @param string $card_name
191
- * @param int $form_id Current Form id
192
- * @param string $connection_id ID of current connection
193
  * @param array $submitted_data
194
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
195
- * @param array $form_entry_fields default entry fields of form
196
- * @param array $form_settings Displayed Form settings
197
- * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance
198
  */
199
  $card_name = apply_filters(
200
  'forminator_addon_trello_card_name',
@@ -223,13 +223,13 @@ class Forminator_Addon_Trello_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
223
  * @since 1.2
224
  *
225
  * @param string $card_description
226
- * @param int $form_id Current Form id
227
- * @param string $connection_id ID of current connection
228
  * @param array $submitted_data
229
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
230
- * @param array $form_entry_fields default entry fields of form
231
- * @param array $form_settings Displayed Form settings
232
- * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance
233
  */
234
  $card_description = apply_filters(
235
  'forminator_addon_trello_card_description',
@@ -275,12 +275,12 @@ class Forminator_Addon_Trello_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
275
  * @since 1.2
276
  *
277
  * @param array $args
278
- * @param int $form_id Current Form id
279
- * @param string $connection_id ID of current connection
280
  * @param array $submitted_data
281
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
282
- * @param array $form_settings Displayed Form settings
283
- * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance
284
  */
285
  $args = apply_filters(
286
  'forminator_addon_trello_create_card_args',
@@ -355,7 +355,7 @@ class Forminator_Addon_Trello_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
355
  }
356
  $post_element_id = str_ireplace( '-post-image', '', $post_element_id );
357
 
358
- // only add postdata as single
359
  if ( in_array( $post_element_id, $post_element_ids, true ) ) {
360
  continue;
361
  }
@@ -394,7 +394,7 @@ class Forminator_Addon_Trello_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
394
  * @since 1.2
395
  *
396
  * @param string $markdown
397
- * @param array $form_fields all fields on form
398
  */
399
  $markdown = apply_filters(
400
  'forminator_addon_trello_all_fields_markdown',
@@ -425,9 +425,9 @@ class Forminator_Addon_Trello_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
425
  * @since 1.2
426
  *
427
  * @param string $markdown
428
- * @param string $type field type
429
- * @param string $label field label
430
- * @param string $value field string
431
  */
432
  $markdown = apply_filters(
433
  'forminator_addon_trello_field_markdown',
@@ -463,8 +463,8 @@ class Forminator_Addon_Trello_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
463
  * @since 1.2
464
  *
465
  * @param array $addon_meta_data
466
- * @param int $form_id current Form ID
467
- * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance
468
  */
469
  $addon_meta_data = apply_filters(
470
  'forminator_addon_trello_metadata',
@@ -552,7 +552,7 @@ class Forminator_Addon_Trello_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
552
  }
553
 
554
  if ( Forminator_Addon_Trello::is_show_full_log() ) {
555
- // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_TRELLO_SHOW_FULL_LOG', true)`
556
  if ( isset( $status['url_request'] ) ) {
557
  $sub_entries[] = array(
558
  'label' => __( 'API URL', 'forminator' ),
@@ -577,7 +577,7 @@ class Forminator_Addon_Trello_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
577
 
578
  $additional_entry_item['sub_entries'] = $sub_entries;
579
 
580
- // return single array
581
  return $additional_entry_item;
582
  }
583
 
@@ -602,9 +602,9 @@ class Forminator_Addon_Trello_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
602
  *
603
  * @since 1.2
604
  *
605
- * @param array $export_headers headers to be displayed on export file
606
- * @param int $form_id current Form ID
607
- * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance
608
  */
609
  $export_headers = apply_filters(
610
  'forminator_addon_trello_export_headers',
@@ -639,8 +639,8 @@ class Forminator_Addon_Trello_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
639
  * @since 1.2
640
  *
641
  * @param array $addon_meta_data
642
- * @param int $form_id current Form ID
643
- * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance
644
  */
645
  $addon_meta_data = apply_filters(
646
  'forminator_addon_trello_metadata',
@@ -658,11 +658,11 @@ class Forminator_Addon_Trello_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
658
  *
659
  * @since 1.2
660
  *
661
- * @param array $export_columns column to be exported
662
- * @param int $form_id current Form ID
663
- * @param Forminator_Form_Entry_Model $entry_model Form Entry Model
664
- * @param array $addon_meta_data meta data saved by addon on entry fields
665
- * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance
666
  */
667
  $export_columns = apply_filters(
668
  'forminator_addon_trello_export_columns',
@@ -695,15 +695,15 @@ class Forminator_Addon_Trello_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
695
 
696
  $addon_meta_data = $addon_meta_data[0];
697
 
698
- // make sure its `status`, because we only add this
699
  if ( 'status' !== $addon_meta_data['name'] ) {
700
  if ( stripos( $addon_meta_data['name'], 'status-' ) === 0 ) {
701
  $meta_data = array();
702
  foreach ( $addon_meta_datas as $addon_meta_data ) {
703
- // make it like single value so it will be processed like single meta data
704
  $addon_meta_data['name'] = 'status';
705
 
706
- // add it on an array for next recursive process
707
  $meta_data[] = $this->get_from_addon_meta_data( array( $addon_meta_data ), $key, $default );
708
  }
709
 
@@ -743,7 +743,7 @@ class Forminator_Addon_Trello_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
743
  * @return bool
744
  */
745
  public function on_before_delete_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {
746
- // attach hook first
747
  $form_id = $this->form_id;
748
  $form_settings_instance = $this->form_settings_instance;
749
 
@@ -754,9 +754,9 @@ class Forminator_Addon_Trello_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
754
  * @since 1.1
755
  *
756
  * @param array $addon_meta_data
757
- * @param int $form_id current Form ID
758
- * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model
759
- * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance
760
  */
761
  $addon_meta_data = apply_filters(
762
  'forminator_addon_trello_metadata',
@@ -771,10 +771,10 @@ class Forminator_Addon_Trello_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
771
  *
772
  * @since 1.1
773
  *
774
- * @param int $form_id current Form ID
775
- * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model
776
- * @param array $addon_meta_data addon meta data
777
- * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance
778
  */
779
  do_action(
780
  'forminator_addon_trello_on_before_delete_submission',
@@ -795,7 +795,7 @@ class Forminator_Addon_Trello_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
795
 
796
  foreach ( $addon_meta_data as $addon_meta_datum ) {
797
 
798
- // basic data validation
799
  if ( ! isset( $addon_meta_datum['value'] ) || ! is_array( $addon_meta_datum['value'] ) ) {
800
  continue;
801
  }
@@ -830,12 +830,12 @@ class Forminator_Addon_Trello_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
830
  return true;
831
 
832
  } catch ( Forminator_Addon_Trello_Exception $e ) {
833
- // handle all internal addon exceptions with `Forminator_Addon_Trello_Exception`
834
 
835
- // use wp_error, for future usage it can be returned to page entries
836
  $wp_error
837
  = new WP_Error( 'forminator_addon_trello_delete_card', $e->getMessage() );
838
- // handle this in addon by self, since page entries cant handle error messages on delete yet
839
  wp_die(
840
  esc_html( $wp_error->get_error_message() ),
841
  esc_html( $this->addon->get_title() ),
@@ -878,7 +878,7 @@ class Forminator_Addon_Trello_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
878
  * @param string $card_delete_mode
879
  * @param array $addon_meta_datum
880
  * @param int $form_id
881
- * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance
882
  */
883
  $args = apply_filters(
884
  'forminator_addon_trello_delete_card_args',
@@ -906,12 +906,12 @@ class Forminator_Addon_Trello_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
906
  *
907
  * @since 1.2
908
  *
909
- * @param array $args args sent to Trello API
910
  * @param string $card_id
911
  * @param string $card_delete_mode
912
  * @param array $addon_meta_datum
913
  * @param int $form_id
914
- * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance
915
  *
916
  */
917
  do_action(
64
  *
65
  * @param array $submitted_data
66
  * @param array $form_entry_fields
67
+ * @param int $form_id current Form ID.
68
+ * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance.
69
  */
70
  $submitted_data = apply_filters(
71
  'forminator_addon_trello_form_submitted_data',
82
  *
83
  * @param array $form_entry_fields
84
  * @param array $submitted_data
85
+ * @param int $form_id current Form ID.
86
+ * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance.
87
  */
88
  $form_entry_fields = apply_filters(
89
  'forminator_addon_trello_form_entry_fields',
104
  *
105
  * @since 1.2
106
  *
107
+ * @param int $form_id current Form ID.
108
  * @param array $submitted_data
109
+ * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance.
110
  */
111
  do_action( 'forminator_addon_trello_before_create_card', $form_id, $submitted_data, $form_settings_instance );
112
 
113
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
114
+ // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to trello.
115
  if ( $form_settings_instance->is_multi_form_settings_complete( $key ) ) {
116
+ // exec only on completed connection.
117
  $data[] = array(
118
  'name' => 'status-' . $key,
119
  'value' => $this->get_status_on_create_card( $key, $submitted_data, $addon_setting_value, $form_entry_fields ),
128
  * @since 1.2
129
  *
130
  * @param array $entry_fields
131
+ * @param int $form_id current Form ID.
132
  * @param array $submitted_data
133
  * @param array $form_entry_fields
134
+ * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance.
135
  */
136
  $data = apply_filters(
137
  'forminator_addon_trello_entry_fields',
159
  * @return array `is_sent` true means its success send data to Trello, false otherwise
160
  */
161
  private function get_status_on_create_card( $connection_id, $submitted_data, $connection_settings, $form_entry_fields ) {
162
+ // initialize as null.
163
  $api = null;
164
 
165
  $form_id = $this->form_id;
178
 
179
  if ( isset( $connection_settings['card_name'] ) ) {
180
  $card_name = $connection_settings['card_name'];
181
+ // disable all_fields here.
182
  $card_name = str_ireplace( '{all_fields}', '', $card_name );
183
  $card_name = forminator_addon_replace_custom_vars( $card_name, $submitted_data, $this->custom_form, $form_entry_fields, false );
184
 
188
  * @since 1.2
189
  *
190
  * @param string $card_name
191
+ * @param int $form_id Current Form id.
192
+ * @param string $connection_id ID of current connection.
193
  * @param array $submitted_data
194
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
195
+ * @param array $form_entry_fields default entry fields of form.
196
+ * @param array $form_settings Displayed Form settings.
197
+ * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance.
198
  */
199
  $card_name = apply_filters(
200
  'forminator_addon_trello_card_name',
223
  * @since 1.2
224
  *
225
  * @param string $card_description
226
+ * @param int $form_id Current Form id.
227
+ * @param string $connection_id ID of current connection.
228
  * @param array $submitted_data
229
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
230
+ * @param array $form_entry_fields default entry fields of form.
231
+ * @param array $form_settings Displayed Form settings.
232
+ * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance.
233
  */
234
  $card_description = apply_filters(
235
  'forminator_addon_trello_card_description',
275
  * @since 1.2
276
  *
277
  * @param array $args
278
+ * @param int $form_id Current Form id.
279
+ * @param string $connection_id ID of current connection.
280
  * @param array $submitted_data
281
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
282
+ * @param array $form_settings Displayed Form settings.
283
+ * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance.
284
  */
285
  $args = apply_filters(
286
  'forminator_addon_trello_create_card_args',
355
  }
356
  $post_element_id = str_ireplace( '-post-image', '', $post_element_id );
357
 
358
+ // only add postdata as single.
359
  if ( in_array( $post_element_id, $post_element_ids, true ) ) {
360
  continue;
361
  }
394
  * @since 1.2
395
  *
396
  * @param string $markdown
397
+ * @param array $form_fields all fields on form.
398
  */
399
  $markdown = apply_filters(
400
  'forminator_addon_trello_all_fields_markdown',
425
  * @since 1.2
426
  *
427
  * @param string $markdown
428
+ * @param string $type field type.
429
+ * @param string $label field label.
430
+ * @param string $value field string.
431
  */
432
  $markdown = apply_filters(
433
  'forminator_addon_trello_field_markdown',
463
  * @since 1.2
464
  *
465
  * @param array $addon_meta_data
466
+ * @param int $form_id current Form ID.
467
+ * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance.
468
  */
469
  $addon_meta_data = apply_filters(
470
  'forminator_addon_trello_metadata',
552
  }
553
 
554
  if ( Forminator_Addon_Trello::is_show_full_log() ) {
555
+ // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_TRELLO_SHOW_FULL_LOG', true)`.
556
  if ( isset( $status['url_request'] ) ) {
557
  $sub_entries[] = array(
558
  'label' => __( 'API URL', 'forminator' ),
577
 
578
  $additional_entry_item['sub_entries'] = $sub_entries;
579
 
580
+ // return single array.
581
  return $additional_entry_item;
582
  }
583
 
602
  *
603
  * @since 1.2
604
  *
605
+ * @param array $export_headers headers to be displayed on export file.
606
+ * @param int $form_id current Form ID.
607
+ * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance.
608
  */
609
  $export_headers = apply_filters(
610
  'forminator_addon_trello_export_headers',
639
  * @since 1.2
640
  *
641
  * @param array $addon_meta_data
642
+ * @param int $form_id current Form ID.
643
+ * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance.
644
  */
645
  $addon_meta_data = apply_filters(
646
  'forminator_addon_trello_metadata',
658
  *
659
  * @since 1.2
660
  *
661
+ * @param array $export_columns column to be exported.
662
+ * @param int $form_id current Form ID.
663
+ * @param Forminator_Form_Entry_Model $entry_model Form Entry Model.
664
+ * @param array $addon_meta_data meta data saved by addon on entry fields.
665
+ * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance.
666
  */
667
  $export_columns = apply_filters(
668
  'forminator_addon_trello_export_columns',
695
 
696
  $addon_meta_data = $addon_meta_data[0];
697
 
698
+ // make sure its `status`, because we only add this.
699
  if ( 'status' !== $addon_meta_data['name'] ) {
700
  if ( stripos( $addon_meta_data['name'], 'status-' ) === 0 ) {
701
  $meta_data = array();
702
  foreach ( $addon_meta_datas as $addon_meta_data ) {
703
+ // make it like single value so it will be processed like single meta data.
704
  $addon_meta_data['name'] = 'status';
705
 
706
+ // add it on an array for next recursive process.
707
  $meta_data[] = $this->get_from_addon_meta_data( array( $addon_meta_data ), $key, $default );
708
  }
709
 
743
  * @return bool
744
  */
745
  public function on_before_delete_entry( Forminator_Form_Entry_Model $entry_model, $addon_meta_data ) {
746
+ // attach hook first.
747
  $form_id = $this->form_id;
748
  $form_settings_instance = $this->form_settings_instance;
749
 
754
  * @since 1.1
755
  *
756
  * @param array $addon_meta_data
757
+ * @param int $form_id current Form ID.
758
+ * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model.
759
+ * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance.
760
  */
761
  $addon_meta_data = apply_filters(
762
  'forminator_addon_trello_metadata',
771
  *
772
  * @since 1.1
773
  *
774
+ * @param int $form_id current Form ID.
775
+ * @param Forminator_Form_Entry_Model $entry_model Forminator Entry Model.
776
+ * @param array $addon_meta_data addon meta data.
777
+ * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance.
778
  */
779
  do_action(
780
  'forminator_addon_trello_on_before_delete_submission',
795
 
796
  foreach ( $addon_meta_data as $addon_meta_datum ) {
797
 
798
+ // basic data validation.
799
  if ( ! isset( $addon_meta_datum['value'] ) || ! is_array( $addon_meta_datum['value'] ) ) {
800
  continue;
801
  }
830
  return true;
831
 
832
  } catch ( Forminator_Addon_Trello_Exception $e ) {
833
+ // handle all internal addon exceptions with `Forminator_Addon_Trello_Exception`.
834
 
835
+ // use wp_error, for future usage it can be returned to page entries.
836
  $wp_error
837
  = new WP_Error( 'forminator_addon_trello_delete_card', $e->getMessage() );
838
+ // handle this in addon by self, since page entries cant handle error messages on delete yet.
839
  wp_die(
840
  esc_html( $wp_error->get_error_message() ),
841
  esc_html( $this->addon->get_title() ),
878
  * @param string $card_delete_mode
879
  * @param array $addon_meta_datum
880
  * @param int $form_id
881
+ * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance.
882
  */
883
  $args = apply_filters(
884
  'forminator_addon_trello_delete_card_args',
906
  *
907
  * @since 1.2
908
  *
909
+ * @param array $args args sent to Trello API.
910
  * @param string $card_id
911
  * @param string $card_delete_mode
912
  * @param array $addon_meta_datum
913
  * @param int $form_id
914
+ * @param Forminator_Addon_Trello_Form_Settings $form_settings_instance Trello Addon Form Settings instance.
915
  *
916
  */
917
  do_action(
addons/pro/trello/class-forminator-addon-trello-form-settings.php CHANGED
@@ -42,7 +42,7 @@ class Forminator_Addon_Trello_Form_Settings extends Forminator_Addon_Form_Settin
42
  * @return array
43
  */
44
  public function form_settings_wizards() {
45
- // numerical array steps
46
  return array(
47
  array(
48
  'callback' => array( $this, 'setup_name' ),
@@ -494,7 +494,7 @@ class Forminator_Addon_Trello_Form_Settings extends Forminator_Addon_Form_Settin
494
  $members = array();
495
 
496
  try {
497
- // get available labels
498
  $api = $this->addon->get_api();
499
  $labels_request = $api->get_board_labels( $board_id );
500
 
@@ -511,16 +511,16 @@ class Forminator_Addon_Trello_Form_Settings extends Forminator_Addon_Form_Settin
511
  }
512
  }
513
 
514
- // get available members
515
  $members_request = $api->get_board_members( $board_id );
516
 
517
  foreach ( $members_request as $data ) {
518
  if ( isset( $data->id ) && isset( $data->username ) ) {
519
  $display_name = $data->username;
520
- // its from API var
521
  // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
522
  if ( isset( $data->fullName ) && ! empty( $data->fullName ) ) {
523
- // its from API var
524
  // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
525
  $display_name = $data->fullName;
526
  }
@@ -573,7 +573,7 @@ class Forminator_Addon_Trello_Form_Settings extends Forminator_Addon_Form_Settin
573
  $input_exceptions->add_input_exception( 'Please pick valid position.', 'position_error' );
574
  }
575
 
576
- // optional label
577
  if ( ! empty( $label_ids ) && is_array( $label_ids ) ) {
578
  $labels_keys = array_keys( $labels );
579
  foreach ( $label_ids as $label_id ) {
@@ -586,7 +586,7 @@ class Forminator_Addon_Trello_Form_Settings extends Forminator_Addon_Form_Settin
586
  $label_ids = array();
587
  }
588
 
589
- // optional member
590
  if ( ! empty( $member_ids ) && is_array( $member_ids ) ) {
591
  $members_keys = array_keys( $members );
592
  foreach ( $member_ids as $member_id ) {
@@ -711,7 +711,7 @@ class Forminator_Addon_Trello_Form_Settings extends Forminator_Addon_Form_Settin
711
  foreach ( $form_settings_values as $key => $value ) {
712
  $multi_ids[] = array(
713
  'id' => $key,
714
- // use name that was added by user on creating connection
715
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
716
  );
717
  }
@@ -737,7 +737,7 @@ class Forminator_Addon_Trello_Form_Settings extends Forminator_Addon_Form_Settin
737
  * @param array $submitted_data
738
  */
739
  public function disconnect_form( $submitted_data ) {
740
- // only execute if multi_id provided on submitted data
741
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
742
  $addon_form_settings = $this->get_form_settings_values();
743
  unset( $addon_form_settings[ $submitted_data['multi_id'] ] );
42
  * @return array
43
  */
44
  public function form_settings_wizards() {
45
+ // numerical array steps.
46
  return array(
47
  array(
48
  'callback' => array( $this, 'setup_name' ),
494
  $members = array();
495
 
496
  try {
497
+ // get available labels.
498
  $api = $this->addon->get_api();
499
  $labels_request = $api->get_board_labels( $board_id );
500
 
511
  }
512
  }
513
 
514
+ // get available members.
515
  $members_request = $api->get_board_members( $board_id );
516
 
517
  foreach ( $members_request as $data ) {
518
  if ( isset( $data->id ) && isset( $data->username ) ) {
519
  $display_name = $data->username;
520
+ // its from API var.
521
  // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
522
  if ( isset( $data->fullName ) && ! empty( $data->fullName ) ) {
523
+ // its from API var.
524
  // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
525
  $display_name = $data->fullName;
526
  }
573
  $input_exceptions->add_input_exception( 'Please pick valid position.', 'position_error' );
574
  }
575
 
576
+ // optional label.
577
  if ( ! empty( $label_ids ) && is_array( $label_ids ) ) {
578
  $labels_keys = array_keys( $labels );
579
  foreach ( $label_ids as $label_id ) {
586
  $label_ids = array();
587
  }
588
 
589
+ // optional member.
590
  if ( ! empty( $member_ids ) && is_array( $member_ids ) ) {
591
  $members_keys = array_keys( $members );
592
  foreach ( $member_ids as $member_id ) {
711
  foreach ( $form_settings_values as $key => $value ) {
712
  $multi_ids[] = array(
713
  'id' => $key,
714
+ // use name that was added by user on creating connection.
715
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
716
  );
717
  }
737
  * @param array $submitted_data
738
  */
739
  public function disconnect_form( $submitted_data ) {
740
+ // only execute if multi_id provided on submitted data.
741
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
742
  $addon_form_settings = $this->get_form_settings_values();
743
  unset( $addon_form_settings[ $submitted_data['multi_id'] ] );
addons/pro/trello/class-forminator-addon-trello-poll-hooks.php CHANGED
@@ -64,8 +64,8 @@ class Forminator_Addon_Trello_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
64
  *
65
  * @param array $submitted_data
66
  * @param array $current_entry_fields
67
- * @param int $poll_id current Poll ID
68
- * @param Forminator_Addon_Trello_Poll_Settings $poll_settings_instance Trello Addon Poll Settings instance
69
  */
70
  $submitted_data = apply_filters(
71
  'forminator_addon_trello_poll_submitted_data',
@@ -82,8 +82,8 @@ class Forminator_Addon_Trello_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
82
  *
83
  * @param array $current_entry_fields
84
  * @param array $submitted_data
85
- * @param int $poll_id current Poll ID
86
- * @param Forminator_Addon_Trello_Poll_Settings $poll_settings_instance Trello Addon Poll Settings instance
87
  */
88
  $current_entry_fields = apply_filters(
89
  'forminator_addon_trello_poll_current_entry_fields',
@@ -102,16 +102,16 @@ class Forminator_Addon_Trello_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
102
  *
103
  * @since 1.6.1
104
  *
105
- * @param int $poll_id current Poll ID
106
  * @param array $submitted_data
107
- * @param Forminator_Addon_Trello_Poll_Settings $poll_settings_instance Trello Addon Poll Settings instance
108
  */
109
  do_action( 'forminator_addon_trello_poll_before_create_card', $poll_id, $submitted_data, $poll_settings_instance );
110
 
111
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
112
- // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to trello
113
  if ( $poll_settings_instance->is_multi_poll_settings_complete( $key ) ) {
114
- // exec only on completed connection
115
  $data[] = array(
116
  'name' => 'status-' . $key,
117
  'value' => $this->get_status_on_create_card( $key, $submitted_data, $addon_setting_value, $current_entry_fields ),
@@ -126,10 +126,10 @@ class Forminator_Addon_Trello_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
126
  * @since 1.6.1
127
  *
128
  * @param array $entry_fields
129
- * @param int $poll_id current Poll ID
130
  * @param array $submitted_data
131
  * @param array $current_entry_fields
132
- * @param Forminator_Addon_Trello_Poll_Settings $poll_settings_instance Trello Addon Poll Settings instance
133
  */
134
  $data = apply_filters(
135
  'forminator_addon_trello_poll_entry_fields',
@@ -157,7 +157,7 @@ class Forminator_Addon_Trello_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
157
  * @return array `is_sent` true means its success send data to Trello, false otherwise
158
  */
159
  private function get_status_on_create_card( $connection_id, $submitted_data, $connection_settings, $current_entry_fields ) {
160
- // initialize as null
161
  $api = null;
162
 
163
  $poll_id = $this->poll_id;
@@ -176,9 +176,9 @@ class Forminator_Addon_Trello_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
176
 
177
  if ( isset( $connection_settings['card_name'] ) ) {
178
  $card_name = $connection_settings['card_name'];
179
- // disable all_fields here
180
  $card_name = forminator_replace_variables( $card_name );
181
- // {poll_name_replace} //phpcs:ignore
182
  $card_name = str_ireplace( '{poll_name}', forminator_get_name_from_model( $this->poll ), $card_name );
183
  $card_name = str_ireplace( '{poll_answer}', $this->poll_answer_to_plain_text( $submitted_data ), $card_name );
184
  $card_name = str_ireplace( '{poll_result}', $this->poll_result_to_plain_text( $submitted_data ), $card_name );
@@ -189,13 +189,13 @@ class Forminator_Addon_Trello_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
189
  * @since 1.6.1
190
  *
191
  * @param string $card_name
192
- * @param int $poll_id Current Poll id
193
- * @param string $connection_id ID of current connection
194
  * @param array $submitted_data
195
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
196
- * @param array $current_entry_fields default entry fields of poll
197
- * @param array $poll_settings Displayed Poll settings
198
- * @param Forminator_Addon_Trello_Poll_Settings $poll_settings_instance Trello Addon Poll Settings instance
199
  */
200
  $card_name = apply_filters(
201
  'forminator_addon_trello_poll_card_name',
@@ -228,13 +228,13 @@ class Forminator_Addon_Trello_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
228
  * @since 1.6.1
229
  *
230
  * @param string $card_description
231
- * @param int $poll_id Current Poll id
232
- * @param string $connection_id ID of current connection
233
  * @param array $submitted_data
234
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
235
- * @param array $current_entry_fields default entry fields of poll
236
- * @param array $poll_settings Displayed Poll settings
237
- * @param Forminator_Addon_Trello_Poll_Settings $poll_settings_instance Trello Addon Poll Settings instance
238
  */
239
  $card_description = apply_filters(
240
  'forminator_addon_trello_poll_card_description',
@@ -280,12 +280,12 @@ class Forminator_Addon_Trello_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
280
  * @since 1.6.1
281
  *
282
  * @param array $args
283
- * @param int $poll_id Current Poll id
284
- * @param string $connection_id ID of current connection
285
  * @param array $submitted_data
286
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
287
- * @param array $poll_settings Displayed Poll settings
288
- * @param Forminator_Addon_Trello_Poll_Settings $poll_settings_instance Trello Addon Poll Settings instance
289
  */
290
  $args = apply_filters(
291
  'forminator_addon_trello_poll_create_card_args',
@@ -348,8 +348,8 @@ class Forminator_Addon_Trello_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
348
  * @since 1.6.1
349
  *
350
  * @param string $markdown
351
- * @param array $submitted_data Submit data
352
- * @param array $fields_labels Poll Answers Labels
353
  */
354
  $markdown = apply_filters(
355
  'forminator_addon_trello_poll_name_markdown',
@@ -389,8 +389,8 @@ class Forminator_Addon_Trello_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
389
  * @since 1.6.1
390
  *
391
  * @param string $markdown
392
- * @param array $submitted_data Submit data
393
- * @param array $fields_labels Poll Answers Labels
394
  */
395
  $markdown = apply_filters(
396
  'forminator_addon_trello_poll_answer_markdown',
@@ -415,12 +415,12 @@ class Forminator_Addon_Trello_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
415
  $fields_array = $this->poll->get_fields_as_array();
416
  $map_entries = Forminator_Form_Entry_Model::map_polls_entries( $this->poll_id, $fields_array );
417
 
418
- // append new answer
419
  if ( ! $this->poll->is_prevent_store() ) {
420
  $answer_data = isset( $submitted_data[ $this->poll_id ] ) ? $submitted_data[ $this->poll_id ] : '';
421
 
422
  $entries = 0;
423
- // exists on map entries
424
  if ( in_array( $answer_data, array_keys( $map_entries ), true ) ) {
425
  $entries = $map_entries[ $answer_data ];
426
  }
@@ -452,8 +452,8 @@ class Forminator_Addon_Trello_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
452
  * @since 1.6.1
453
  *
454
  * @param string $markdown
455
- * @param array $fields_array Answers list
456
- * @param array $map_entries Poll Entries
457
  */
458
  $markdown = apply_filters(
459
  'forminator_addon_trello_poll_result_markdown',
@@ -494,8 +494,8 @@ class Forminator_Addon_Trello_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
494
  * @since 1.6.2
495
  *
496
  * @param string $plain_text
497
- * @param array $submitted_data Submit data
498
- * @param array $fields_labels Poll Answers Labels
499
  */
500
  $plain_text = apply_filters(
501
  'forminator_addon_trello_poll_answer_plain_text',
@@ -520,12 +520,12 @@ class Forminator_Addon_Trello_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
520
  $fields_array = $this->poll->get_fields_as_array();
521
  $map_entries = Forminator_Form_Entry_Model::map_polls_entries( $this->poll_id, $fields_array );
522
 
523
- // append new answer
524
  if ( ! $this->poll->is_prevent_store() ) {
525
  $answer_data = isset( $submitted_data[ $this->poll_id ] ) ? $submitted_data[ $this->poll_id ] : '';
526
 
527
  $entries = 0;
528
- // exists on map entries
529
  if ( in_array( $answer_data, array_keys( $map_entries ), true ) ) {
530
  $entries = $map_entries[ $answer_data ];
531
  }
@@ -557,8 +557,8 @@ class Forminator_Addon_Trello_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
557
  * @since 1.6.2
558
  *
559
  * @param string $markdown
560
- * @param array $fields_array Answers list
561
- * @param array $map_entries Poll Entries
562
  */
563
  $plain_text = apply_filters(
564
  'forminator_addon_trello_poll_result_plain_text',
@@ -591,9 +591,9 @@ class Forminator_Addon_Trello_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
591
  *
592
  * @since 1.6.1
593
  *
594
- * @param array $export_headers headers to be displayed on export file
595
- * @param int $poll_id current Poll ID
596
- * @param Forminator_Addon_Trello_Poll_Settings $poll_settings_instance Trello Addon Poll Settings instance
597
  */
598
  $export_headers = apply_filters(
599
  'forminator_addon_trello_poll_export_headers',
@@ -628,8 +628,8 @@ class Forminator_Addon_Trello_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
628
  * @since 1.6.1
629
  *
630
  * @param array $addon_meta_data
631
- * @param int $poll_id current Poll ID
632
- * @param Forminator_Addon_Trello_Poll_Settings $poll_settings_instance Trello Addon Poll Settings instance
633
  */
634
  $addon_meta_data = apply_filters(
635
  'forminator_addon_trello_poll_metadata',
@@ -647,11 +647,11 @@ class Forminator_Addon_Trello_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
647
  *
648
  * @since 1.6.1
649
  *
650
- * @param array $export_columns column to be exported
651
- * @param int $poll_id current Poll ID
652
- * @param Forminator_Form_Entry_Model $entry_model Form Entry Model
653
- * @param array $addon_meta_data meta data saved by addon on entry fields
654
- * @param Forminator_Addon_Trello_Poll_Settings $poll_settings_instance Trello Addon Poll Settings instance
655
  */
656
  $export_columns = apply_filters(
657
  'forminator_addon_trello_poll_export_columns',
64
  *
65
  * @param array $submitted_data
66
  * @param array $current_entry_fields
67
+ * @param int $poll_id current Poll ID.
68
+ * @param Forminator_Addon_Trello_Poll_Settings $poll_settings_instance Trello Addon Poll Settings instance.
69
  */
70
  $submitted_data = apply_filters(
71
  'forminator_addon_trello_poll_submitted_data',
82
  *
83
  * @param array $current_entry_fields
84
  * @param array $submitted_data
85
+ * @param int $poll_id current Poll ID.
86
+ * @param Forminator_Addon_Trello_Poll_Settings $poll_settings_instance Trello Addon Poll Settings instance.
87
  */
88
  $current_entry_fields = apply_filters(
89
  'forminator_addon_trello_poll_current_entry_fields',
102
  *
103
  * @since 1.6.1
104
  *
105
+ * @param int $poll_id current Poll ID.
106
  * @param array $submitted_data
107
+ * @param Forminator_Addon_Trello_Poll_Settings $poll_settings_instance Trello Addon Poll Settings instance.
108
  */
109
  do_action( 'forminator_addon_trello_poll_before_create_card', $poll_id, $submitted_data, $poll_settings_instance );
110
 
111
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
112
+ // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to trello.
113
  if ( $poll_settings_instance->is_multi_poll_settings_complete( $key ) ) {
114
+ // exec only on completed connection.
115
  $data[] = array(
116
  'name' => 'status-' . $key,
117
  'value' => $this->get_status_on_create_card( $key, $submitted_data, $addon_setting_value, $current_entry_fields ),
126
  * @since 1.6.1
127
  *
128
  * @param array $entry_fields
129
+ * @param int $poll_id current Poll ID.
130
  * @param array $submitted_data
131
  * @param array $current_entry_fields
132
+ * @param Forminator_Addon_Trello_Poll_Settings $poll_settings_instance Trello Addon Poll Settings instance.
133
  */
134
  $data = apply_filters(
135
  'forminator_addon_trello_poll_entry_fields',
157
  * @return array `is_sent` true means its success send data to Trello, false otherwise
158
  */
159
  private function get_status_on_create_card( $connection_id, $submitted_data, $connection_settings, $current_entry_fields ) {
160
+ // initialize as null.
161
  $api = null;
162
 
163
  $poll_id = $this->poll_id;
176
 
177
  if ( isset( $connection_settings['card_name'] ) ) {
178
  $card_name = $connection_settings['card_name'];
179
+ // disable all_fields here.
180
  $card_name = forminator_replace_variables( $card_name );
181
+ // {poll_name_replace}.
182
  $card_name = str_ireplace( '{poll_name}', forminator_get_name_from_model( $this->poll ), $card_name );
183
  $card_name = str_ireplace( '{poll_answer}', $this->poll_answer_to_plain_text( $submitted_data ), $card_name );
184
  $card_name = str_ireplace( '{poll_result}', $this->poll_result_to_plain_text( $submitted_data ), $card_name );
189
  * @since 1.6.1
190
  *
191
  * @param string $card_name
192
+ * @param int $poll_id Current Poll id.
193
+ * @param string $connection_id ID of current connection.
194
  * @param array $submitted_data
195
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
196
+ * @param array $current_entry_fields default entry fields of poll.
197
+ * @param array $poll_settings Displayed Poll settings.
198
+ * @param Forminator_Addon_Trello_Poll_Settings $poll_settings_instance Trello Addon Poll Settings instance.
199
  */
200
  $card_name = apply_filters(
201
  'forminator_addon_trello_poll_card_name',
228
  * @since 1.6.1
229
  *
230
  * @param string $card_description
231
+ * @param int $poll_id Current Poll id.
232
+ * @param string $connection_id ID of current connection.
233
  * @param array $submitted_data
234
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
235
+ * @param array $current_entry_fields default entry fields of poll.
236
+ * @param array $poll_settings Displayed Poll settings.
237
+ * @param Forminator_Addon_Trello_Poll_Settings $poll_settings_instance Trello Addon Poll Settings instance.
238
  */
239
  $card_description = apply_filters(
240
  'forminator_addon_trello_poll_card_description',
280
  * @since 1.6.1
281
  *
282
  * @param array $args
283
+ * @param int $poll_id Current Poll id.
284
+ * @param string $connection_id ID of current connection.
285
  * @param array $submitted_data
286
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
287
+ * @param array $poll_settings Displayed Poll settings.
288
+ * @param Forminator_Addon_Trello_Poll_Settings $poll_settings_instance Trello Addon Poll Settings instance.
289
  */
290
  $args = apply_filters(
291
  'forminator_addon_trello_poll_create_card_args',
348
  * @since 1.6.1
349
  *
350
  * @param string $markdown
351
+ * @param array $submitted_data Submit data.
352
+ * @param array $fields_labels Poll Answers Labels.
353
  */
354
  $markdown = apply_filters(
355
  'forminator_addon_trello_poll_name_markdown',
389
  * @since 1.6.1
390
  *
391
  * @param string $markdown
392
+ * @param array $submitted_data Submit data.
393
+ * @param array $fields_labels Poll Answers Labels.
394
  */
395
  $markdown = apply_filters(
396
  'forminator_addon_trello_poll_answer_markdown',
415
  $fields_array = $this->poll->get_fields_as_array();
416
  $map_entries = Forminator_Form_Entry_Model::map_polls_entries( $this->poll_id, $fields_array );
417
 
418
+ // append new answer.
419
  if ( ! $this->poll->is_prevent_store() ) {
420
  $answer_data = isset( $submitted_data[ $this->poll_id ] ) ? $submitted_data[ $this->poll_id ] : '';
421
 
422
  $entries = 0;
423
+ // exists on map entries.
424
  if ( in_array( $answer_data, array_keys( $map_entries ), true ) ) {
425
  $entries = $map_entries[ $answer_data ];
426
  }
452
  * @since 1.6.1
453
  *
454
  * @param string $markdown
455
+ * @param array $fields_array Answers list.
456
+ * @param array $map_entries Poll Entries.
457
  */
458
  $markdown = apply_filters(
459
  'forminator_addon_trello_poll_result_markdown',
494
  * @since 1.6.2
495
  *
496
  * @param string $plain_text
497
+ * @param array $submitted_data Submit data.
498
+ * @param array $fields_labels Poll Answers Labels.
499
  */
500
  $plain_text = apply_filters(
501
  'forminator_addon_trello_poll_answer_plain_text',
520
  $fields_array = $this->poll->get_fields_as_array();
521
  $map_entries = Forminator_Form_Entry_Model::map_polls_entries( $this->poll_id, $fields_array );
522
 
523
+ // append new answer.
524
  if ( ! $this->poll->is_prevent_store() ) {
525
  $answer_data = isset( $submitted_data[ $this->poll_id ] ) ? $submitted_data[ $this->poll_id ] : '';
526
 
527
  $entries = 0;
528
+ // exists on map entries.
529
  if ( in_array( $answer_data, array_keys( $map_entries ), true ) ) {
530
  $entries = $map_entries[ $answer_data ];
531
  }
557
  * @since 1.6.2
558
  *
559
  * @param string $markdown
560
+ * @param array $fields_array Answers list.
561
+ * @param array $map_entries Poll Entries.
562
  */
563
  $plain_text = apply_filters(
564
  'forminator_addon_trello_poll_result_plain_text',
591
  *
592
  * @since 1.6.1
593
  *
594
+ * @param array $export_headers headers to be displayed on export file.
595
+ * @param int $poll_id current Poll ID.
596
+ * @param Forminator_Addon_Trello_Poll_Settings $poll_settings_instance Trello Addon Poll Settings instance.
597
  */
598
  $export_headers = apply_filters(
599
  'forminator_addon_trello_poll_export_headers',
628
  * @since 1.6.1
629
  *
630
  * @param array $addon_meta_data
631
+ * @param int $poll_id current Poll ID.
632
+ * @param Forminator_Addon_Trello_Poll_Settings $poll_settings_instance Trello Addon Poll Settings instance.
633
  */
634
  $addon_meta_data = apply_filters(
635
  'forminator_addon_trello_poll_metadata',
647
  *
648
  * @since 1.6.1
649
  *
650
+ * @param array $export_columns column to be exported.
651
+ * @param int $poll_id current Poll ID.
652
+ * @param Forminator_Form_Entry_Model $entry_model Form Entry Model.
653
+ * @param array $addon_meta_data meta data saved by addon on entry fields.
654
+ * @param Forminator_Addon_Trello_Poll_Settings $poll_settings_instance Trello Addon Poll Settings instance.
655
  */
656
  $export_columns = apply_filters(
657
  'forminator_addon_trello_poll_export_columns',
addons/pro/trello/class-forminator-addon-trello-poll-settings.php CHANGED
@@ -42,7 +42,7 @@ class Forminator_Addon_Trello_Poll_Settings extends Forminator_Addon_Poll_Settin
42
  * @return array
43
  */
44
  public function poll_settings_wizards() {
45
- // numerical array steps
46
  return array(
47
  array(
48
  'callback' => array( $this, 'setup_name' ),
@@ -501,7 +501,7 @@ class Forminator_Addon_Trello_Poll_Settings extends Forminator_Addon_Poll_Settin
501
  $members = array();
502
 
503
  try {
504
- // get available labels
505
  $api = $this->addon->get_api();
506
  $labels_request = $api->get_board_labels( $board_id );
507
 
@@ -518,16 +518,16 @@ class Forminator_Addon_Trello_Poll_Settings extends Forminator_Addon_Poll_Settin
518
  }
519
  }
520
 
521
- // get available members
522
  $members_request = $api->get_board_members( $board_id );
523
 
524
  foreach ( $members_request as $data ) {
525
  if ( isset( $data->id ) && isset( $data->username ) ) {
526
  $display_name = $data->username;
527
- // its from API var
528
  // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
529
  if ( isset( $data->fullName ) && ! empty( $data->fullName ) ) {
530
- // its from API var
531
  // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
532
  $display_name = $data->fullName;
533
  }
@@ -580,7 +580,7 @@ class Forminator_Addon_Trello_Poll_Settings extends Forminator_Addon_Poll_Settin
580
  $input_exceptions->add_input_exception( 'Please pick valid position.', 'position_error' );
581
  }
582
 
583
- // optional label
584
  if ( ! empty( $label_ids ) && is_array( $label_ids ) ) {
585
  $labels_keys = array_keys( $labels );
586
  foreach ( $label_ids as $label_id ) {
@@ -593,7 +593,7 @@ class Forminator_Addon_Trello_Poll_Settings extends Forminator_Addon_Poll_Settin
593
  $label_ids = array();
594
  }
595
 
596
- // optional member
597
  if ( ! empty( $member_ids ) && is_array( $member_ids ) ) {
598
  $members_keys = array_keys( $members );
599
  foreach ( $member_ids as $member_id ) {
@@ -718,7 +718,7 @@ class Forminator_Addon_Trello_Poll_Settings extends Forminator_Addon_Poll_Settin
718
  foreach ( $poll_settings_values as $key => $value ) {
719
  $multi_ids[] = array(
720
  'id' => $key,
721
- // use name that was added by user on creating connection
722
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
723
  );
724
  }
@@ -744,7 +744,7 @@ class Forminator_Addon_Trello_Poll_Settings extends Forminator_Addon_Poll_Settin
744
  * @param array $submitted_data
745
  */
746
  public function disconnect_poll( $submitted_data ) {
747
- // only execute if multi_id provided on submitted data
748
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
749
  $addon_poll_settings = $this->get_poll_settings_values();
750
  unset( $addon_poll_settings[ $submitted_data['multi_id'] ] );
42
  * @return array
43
  */
44
  public function poll_settings_wizards() {
45
+ // numerical array steps.
46
  return array(
47
  array(
48
  'callback' => array( $this, 'setup_name' ),
501
  $members = array();
502
 
503
  try {
504
+ // get available labels.
505
  $api = $this->addon->get_api();
506
  $labels_request = $api->get_board_labels( $board_id );
507
 
518
  }
519
  }
520
 
521
+ // get available members.
522
  $members_request = $api->get_board_members( $board_id );
523
 
524
  foreach ( $members_request as $data ) {
525
  if ( isset( $data->id ) && isset( $data->username ) ) {
526
  $display_name = $data->username;
527
+ // its from API var.
528
  // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
529
  if ( isset( $data->fullName ) && ! empty( $data->fullName ) ) {
530
+ // its from API var.
531
  // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
532
  $display_name = $data->fullName;
533
  }
580
  $input_exceptions->add_input_exception( 'Please pick valid position.', 'position_error' );
581
  }
582
 
583
+ // optional label.
584
  if ( ! empty( $label_ids ) && is_array( $label_ids ) ) {
585
  $labels_keys = array_keys( $labels );
586
  foreach ( $label_ids as $label_id ) {
593
  $label_ids = array();
594
  }
595
 
596
+ // optional member.
597
  if ( ! empty( $member_ids ) && is_array( $member_ids ) ) {
598
  $members_keys = array_keys( $members );
599
  foreach ( $member_ids as $member_id ) {
718
  foreach ( $poll_settings_values as $key => $value ) {
719
  $multi_ids[] = array(
720
  'id' => $key,
721
+ // use name that was added by user on creating connection.
722
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
723
  );
724
  }
744
  * @param array $submitted_data
745
  */
746
  public function disconnect_poll( $submitted_data ) {
747
+ // only execute if multi_id provided on submitted data.
748
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
749
  $addon_poll_settings = $this->get_poll_settings_values();
750
  unset( $addon_poll_settings[ $submitted_data['multi_id'] ] );
addons/pro/trello/class-forminator-addon-trello-quiz-hooks.php CHANGED
@@ -64,8 +64,8 @@ class Forminator_Addon_Trello_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
64
  *
65
  * @param array $submitted_data
66
  * @param array $current_entry_fields
67
- * @param int $quiz_id current Quiz ID
68
- * @param Forminator_Addon_Trello_Quiz_Settings $quiz_settings_instance Trello Addon Quiz Settings instance
69
  */
70
  $submitted_data = apply_filters(
71
  'forminator_addon_trello_quiz_submitted_data',
@@ -82,8 +82,8 @@ class Forminator_Addon_Trello_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
82
  *
83
  * @param array $current_entry_fields
84
  * @param array $submitted_data
85
- * @param int $quiz_id current quiz ID
86
- * @param Forminator_Addon_Trello_Quiz_Settings $quiz_settings_instance Trello Addon Quiz Settings instance
87
  */
88
  $current_entry_fields = apply_filters(
89
  'forminator_addon_trello_quiz_current_entry_fields',
@@ -102,16 +102,16 @@ class Forminator_Addon_Trello_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
102
  *
103
  * @since 1.6.2
104
  *
105
- * @param int $quiz_id current Quiz ID
106
  * @param array $submitted_data
107
- * @param Forminator_Addon_Trello_Quiz_Settings $quiz_settings_instance Trello Addon Quiz Settings instance
108
  */
109
  do_action( 'forminator_addon_trello_quiz_before_create_card', $quiz_id, $submitted_data, $quiz_settings_instance );
110
 
111
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
112
- // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to trello
113
  if ( $quiz_settings_instance->is_multi_quiz_settings_complete( $key ) ) {
114
- // exec only on completed connection
115
  $data[] = array(
116
  'name' => 'status-' . $key,
117
  'value' => $this->get_status_on_create_card( $key, $submitted_data, $addon_setting_value, $current_entry_fields ),
@@ -126,10 +126,10 @@ class Forminator_Addon_Trello_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
126
  * @since 1.6.2
127
  *
128
  * @param array $entry_fields
129
- * @param int $quiz_id current Quiz ID
130
  * @param array $submitted_data
131
  * @param array $current_entry_fields
132
- * @param Forminator_Addon_Trello_Quiz_Settings $quiz_settings_instance Trello Addon Quiz Settings instance
133
  */
134
  $data = apply_filters(
135
  'forminator_addon_trello_quiz_entry_fields',
@@ -157,7 +157,7 @@ class Forminator_Addon_Trello_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
157
  * @return array `is_sent` true means its success send data to Trello, false otherwise
158
  */
159
  private function get_status_on_create_card( $connection_id, $submitted_data, $connection_settings, $current_entry_fields ) {
160
- // initialize as null
161
  $api = null;
162
 
163
  $quiz_id = $this->quiz_id;
@@ -181,9 +181,9 @@ class Forminator_Addon_Trello_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
181
 
182
  if ( isset( $connection_settings['card_name'] ) ) {
183
  $card_name = $connection_settings['card_name'];
184
- // disable all_fields here
185
  $card_name = forminator_replace_variables( $card_name );
186
- // {quizname_replace} //phpcs:ignore
187
  $card_name = str_ireplace( '{quiz_name}', forminator_get_name_from_model( $this->quiz ), $card_name );
188
 
189
  if ( isset( $quiz_settings['hasLeads'] ) && $quiz_settings['hasLeads'] ) {
@@ -196,13 +196,13 @@ class Forminator_Addon_Trello_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
196
  * @since 1.6.2
197
  *
198
  * @param string $card_name
199
- * @param int $quiz_id Current Quiz id
200
- * @param string $connection_id ID of current connection
201
  * @param array $submitted_data
202
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
203
- * @param array $current_entry_fields default entry fields of quiz
204
- * @param array $quiz_settings Displayed Quiz settings
205
- * @param Forminator_Addon_Trello_Quiz_Settings $quiz_settings_instance Trello Addon Quiz Settings instance
206
  */
207
  $card_name = apply_filters(
208
  'forminator_addon_trello_quiz_card_name',
@@ -237,13 +237,13 @@ class Forminator_Addon_Trello_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
237
  * @since 1.6.2
238
  *
239
  * @param string $card_description
240
- * @param int $quiz_id Current Quiz id
241
- * @param string $connection_id ID of current connection
242
  * @param array $submitted_data
243
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
244
- * @param array $current_entry_fields default entry fields of quiz
245
- * @param array $quiz_settings Displayed Quiz settings
246
- * @param Forminator_Addon_Trello_Quiz_Settings $quiz_settings_instance Trello Addon Quiz Settings instance
247
  */
248
  $card_description = apply_filters(
249
  'forminator_addon_trello_quiz_card_description',
@@ -287,12 +287,12 @@ class Forminator_Addon_Trello_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
287
  * @since 1.6.2
288
  *
289
  * @param array $args
290
- * @param int $quiz_id Current Quiz id
291
- * @param string $connection_id ID of current connection
292
  * @param array $submitted_data
293
- * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc
294
- * @param array $quiz_settings Displayed Quiz settings
295
- * @param Forminator_Addon_Trello_Quiz_Settings $quiz_settings_instance Trello Addon Quiz Settings instance
296
  */
297
  $args = apply_filters(
298
  'forminator_addon_trello_quiz_create_card_args',
@@ -392,7 +392,7 @@ class Forminator_Addon_Trello_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
392
  * @since 1.6.2
393
  *
394
  * @param string $markdown
395
- * @param array $quiz_entry_fields Entry Fields
396
  */
397
  $markdown = apply_filters(
398
  'forminator_addon_trello_quiz_answer_markdown',
@@ -463,7 +463,7 @@ class Forminator_Addon_Trello_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
463
  * @since 1.6.2
464
  *
465
  * @param string $markdown
466
- * @param array $quiz_entry_fields Entry Fields
467
  */
468
  $markdown = apply_filters(
469
  'forminator_addon_trello_quiz_result_markdown',
@@ -495,9 +495,9 @@ class Forminator_Addon_Trello_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
495
  *
496
  * @since 1.6.2
497
  *
498
- * @param array $export_headers headers to be displayed on export file
499
- * @param int $quiz_id current Quiz ID
500
- * @param Forminator_Addon_Trello_Quiz_Settings $quiz_settings_instance Trello Addon Quiz Settings instance
501
  */
502
  $export_headers = apply_filters(
503
  'forminator_addon_trello_quiz_export_headers',
@@ -532,8 +532,8 @@ class Forminator_Addon_Trello_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
532
  * @since 1.6.2
533
  *
534
  * @param array $addon_meta_data
535
- * @param int $quiz_id current Quiz ID
536
- * @param Forminator_Addon_Trello_Quiz_Settings $quiz_settings_instance Trello Addon Quiz Settings instance
537
  */
538
  $addon_meta_data = apply_filters(
539
  'forminator_addon_trello_quiz_metadata',
@@ -551,11 +551,11 @@ class Forminator_Addon_Trello_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
551
  *
552
  * @since 1.6.2
553
  *
554
- * @param array $export_columns column to be exported
555
- * @param int $quiz_id current Quiz ID
556
- * @param Forminator_Form_Entry_Model $entry_model Form Entry Model
557
- * @param array $addon_meta_data meta data saved by addon on entry fields
558
- * @param Forminator_Addon_Trello_Quiz_Settings $quiz_settings_instance Trello Addon Quiz Settings instance
559
  */
560
  $export_columns = apply_filters(
561
  'forminator_addon_trello_quiz_export_columns',
@@ -592,8 +592,8 @@ class Forminator_Addon_Trello_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
592
  * @since 1.6.2
593
  *
594
  * @param array $addon_meta_data
595
- * @param int $quiz_id current Quiz ID
596
- * @param Forminator_Addon_Trello_Quiz_Settings $quiz_settings_instance Trello Addon Quiz Settings instance
597
  */
598
  $addon_meta_data = apply_filters(
599
  'forminator_addon_quiz_trello_metadata',
@@ -681,7 +681,7 @@ class Forminator_Addon_Trello_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
681
  }
682
 
683
  if ( Forminator_Addon_Trello::is_show_full_log() ) {
684
- // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_TRELLO_SHOW_FULL_LOG', true)`
685
  if ( isset( $status['url_request'] ) ) {
686
  $sub_entries[] = array(
687
  'label' => __( 'API URL', 'forminator' ),
@@ -706,7 +706,7 @@ class Forminator_Addon_Trello_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
706
 
707
  $additional_entry_item['sub_entries'] = $sub_entries;
708
 
709
- // return single array
710
  return $additional_entry_item;
711
  }
712
  }
64
  *
65
  * @param array $submitted_data
66
  * @param array $current_entry_fields
67
+ * @param int $quiz_id current Quiz ID.
68
+ * @param Forminator_Addon_Trello_Quiz_Settings $quiz_settings_instance Trello Addon Quiz Settings instance.
69
  */
70
  $submitted_data = apply_filters(
71
  'forminator_addon_trello_quiz_submitted_data',
82
  *
83
  * @param array $current_entry_fields
84
  * @param array $submitted_data
85
+ * @param int $quiz_id current quiz ID.
86
+ * @param Forminator_Addon_Trello_Quiz_Settings $quiz_settings_instance Trello Addon Quiz Settings instance.
87
  */
88
  $current_entry_fields = apply_filters(
89
  'forminator_addon_trello_quiz_current_entry_fields',
102
  *
103
  * @since 1.6.2
104
  *
105
+ * @param int $quiz_id current Quiz ID.
106
  * @param array $submitted_data
107
+ * @param Forminator_Addon_Trello_Quiz_Settings $quiz_settings_instance Trello Addon Quiz Settings instance.
108
  */
109
  do_action( 'forminator_addon_trello_quiz_before_create_card', $quiz_id, $submitted_data, $quiz_settings_instance );
110
 
111
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
112
+ // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to trello.
113
  if ( $quiz_settings_instance->is_multi_quiz_settings_complete( $key ) ) {
114
+ // exec only on completed connection.
115
  $data[] = array(
116
  'name' => 'status-' . $key,
117
  'value' => $this->get_status_on_create_card( $key, $submitted_data, $addon_setting_value, $current_entry_fields ),
126
  * @since 1.6.2
127
  *
128
  * @param array $entry_fields
129
+ * @param int $quiz_id current Quiz ID.
130
  * @param array $submitted_data
131
  * @param array $current_entry_fields
132
+ * @param Forminator_Addon_Trello_Quiz_Settings $quiz_settings_instance Trello Addon Quiz Settings instance.
133
  */
134
  $data = apply_filters(
135
  'forminator_addon_trello_quiz_entry_fields',
157
  * @return array `is_sent` true means its success send data to Trello, false otherwise
158
  */
159
  private function get_status_on_create_card( $connection_id, $submitted_data, $connection_settings, $current_entry_fields ) {
160
+ // initialize as null.
161
  $api = null;
162
 
163
  $quiz_id = $this->quiz_id;
181
 
182
  if ( isset( $connection_settings['card_name'] ) ) {
183
  $card_name = $connection_settings['card_name'];
184
+ // disable all_fields here.
185
  $card_name = forminator_replace_variables( $card_name );
186
+ // {quizname_replace}.
187
  $card_name = str_ireplace( '{quiz_name}', forminator_get_name_from_model( $this->quiz ), $card_name );
188
 
189
  if ( isset( $quiz_settings['hasLeads'] ) && $quiz_settings['hasLeads'] ) {
196
  * @since 1.6.2
197
  *
198
  * @param string $card_name
199
+ * @param int $quiz_id Current Quiz id.
200
+ * @param string $connection_id ID of current connection.
201
  * @param array $submitted_data
202
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
203
+ * @param array $current_entry_fields default entry fields of quiz.
204
+ * @param array $quiz_settings Displayed Quiz settings.
205
+ * @param Forminator_Addon_Trello_Quiz_Settings $quiz_settings_instance Trello Addon Quiz Settings instance.
206
  */
207
  $card_name = apply_filters(
208
  'forminator_addon_trello_quiz_card_name',
237
  * @since 1.6.2
238
  *
239
  * @param string $card_description
240
+ * @param int $quiz_id Current Quiz id.
241
+ * @param string $connection_id ID of current connection.
242
  * @param array $submitted_data
243
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
244
+ * @param array $current_entry_fields default entry fields of quiz.
245
+ * @param array $quiz_settings Displayed Quiz settings.
246
+ * @param Forminator_Addon_Trello_Quiz_Settings $quiz_settings_instance Trello Addon Quiz Settings instance.
247
  */
248
  $card_description = apply_filters(
249
  'forminator_addon_trello_quiz_card_description',
287
  * @since 1.6.2
288
  *
289
  * @param array $args
290
+ * @param int $quiz_id Current Quiz id.
291
+ * @param string $connection_id ID of current connection.
292
  * @param array $submitted_data
293
+ * @param array $connection_settings current connection setting, contains options of like `name`, `list_id` etc.
294
+ * @param array $quiz_settings Displayed Quiz settings.
295
+ * @param Forminator_Addon_Trello_Quiz_Settings $quiz_settings_instance Trello Addon Quiz Settings instance.
296
  */
297
  $args = apply_filters(
298
  'forminator_addon_trello_quiz_create_card_args',
392
  * @since 1.6.2
393
  *
394
  * @param string $markdown
395
+ * @param array $quiz_entry_fields Entry Fields.
396
  */
397
  $markdown = apply_filters(
398
  'forminator_addon_trello_quiz_answer_markdown',
463
  * @since 1.6.2
464
  *
465
  * @param string $markdown
466
+ * @param array $quiz_entry_fields Entry Fields.
467
  */
468
  $markdown = apply_filters(
469
  'forminator_addon_trello_quiz_result_markdown',
495
  *
496
  * @since 1.6.2
497
  *
498
+ * @param array $export_headers headers to be displayed on export file.
499
+ * @param int $quiz_id current Quiz ID.
500
+ * @param Forminator_Addon_Trello_Quiz_Settings $quiz_settings_instance Trello Addon Quiz Settings instance.
501
  */
502
  $export_headers = apply_filters(
503
  'forminator_addon_trello_quiz_export_headers',
532
  * @since 1.6.2
533
  *
534
  * @param array $addon_meta_data
535
+ * @param int $quiz_id current Quiz ID.
536
+ * @param Forminator_Addon_Trello_Quiz_Settings $quiz_settings_instance Trello Addon Quiz Settings instance.
537
  */
538
  $addon_meta_data = apply_filters(
539
  'forminator_addon_trello_quiz_metadata',
551
  *
552
  * @since 1.6.2
553
  *
554
+ * @param array $export_columns column to be exported.
555
+ * @param int $quiz_id current Quiz ID.
556
+ * @param Forminator_Form_Entry_Model $entry_model Form Entry Model.
557
+ * @param array $addon_meta_data meta data saved by addon on entry fields.
558
+ * @param Forminator_Addon_Trello_Quiz_Settings $quiz_settings_instance Trello Addon Quiz Settings instance.
559
  */
560
  $export_columns = apply_filters(
561
  'forminator_addon_trello_quiz_export_columns',
592
  * @since 1.6.2
593
  *
594
  * @param array $addon_meta_data
595
+ * @param int $quiz_id current Quiz ID.
596
+ * @param Forminator_Addon_Trello_Quiz_Settings $quiz_settings_instance Trello Addon Quiz Settings instance.
597
  */
598
  $addon_meta_data = apply_filters(
599
  'forminator_addon_quiz_trello_metadata',
681
  }
682
 
683
  if ( Forminator_Addon_Trello::is_show_full_log() ) {
684
+ // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_TRELLO_SHOW_FULL_LOG', true)`.
685
  if ( isset( $status['url_request'] ) ) {
686
  $sub_entries[] = array(
687
  'label' => __( 'API URL', 'forminator' ),
706
 
707
  $additional_entry_item['sub_entries'] = $sub_entries;
708
 
709
+ // return single array.
710
  return $additional_entry_item;
711
  }
712
  }
addons/pro/trello/class-forminator-addon-trello-quiz-settings.php CHANGED
@@ -42,7 +42,7 @@ class Forminator_Addon_Trello_Quiz_Settings extends Forminator_Addon_Quiz_Settin
42
  * @return array
43
  */
44
  public function quiz_settings_wizards() {
45
- // numerical array steps
46
  return array(
47
  array(
48
  'callback' => array( $this, 'setup_name' ),
@@ -507,7 +507,7 @@ class Forminator_Addon_Trello_Quiz_Settings extends Forminator_Addon_Quiz_Settin
507
  $members = array();
508
 
509
  try {
510
- // get available labels
511
  $api = $this->addon->get_api();
512
  $labels_request = $api->get_board_labels( $board_id );
513
 
@@ -524,16 +524,16 @@ class Forminator_Addon_Trello_Quiz_Settings extends Forminator_Addon_Quiz_Settin
524
  }
525
  }
526
 
527
- // get available members
528
  $members_request = $api->get_board_members( $board_id );
529
 
530
  foreach ( $members_request as $data ) {
531
  if ( isset( $data->id ) && isset( $data->username ) ) {
532
  $display_name = $data->username;
533
- // its from API var
534
  // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
535
  if ( isset( $data->fullName ) && ! empty( $data->fullName ) ) {
536
- // its from API var
537
  // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
538
  $display_name = $data->fullName;
539
  }
@@ -586,7 +586,7 @@ class Forminator_Addon_Trello_Quiz_Settings extends Forminator_Addon_Quiz_Settin
586
  $input_exceptions->add_input_exception( 'Please pick valid position.', 'position_error' );
587
  }
588
 
589
- // optional label
590
  if ( ! empty( $label_ids ) && is_array( $label_ids ) ) {
591
  $labels_keys = array_keys( $labels );
592
  foreach ( $label_ids as $label_id ) {
@@ -599,7 +599,7 @@ class Forminator_Addon_Trello_Quiz_Settings extends Forminator_Addon_Quiz_Settin
599
  $label_ids = array();
600
  }
601
 
602
- // optional member
603
  if ( ! empty( $member_ids ) && is_array( $member_ids ) ) {
604
  $members_keys = array_keys( $members );
605
  foreach ( $member_ids as $member_id ) {
@@ -724,7 +724,7 @@ class Forminator_Addon_Trello_Quiz_Settings extends Forminator_Addon_Quiz_Settin
724
  foreach ( $quiz_settings_values as $key => $value ) {
725
  $multi_ids[] = array(
726
  'id' => $key,
727
- // use name that was added by user on creating connection
728
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
729
  );
730
  }
@@ -750,7 +750,7 @@ class Forminator_Addon_Trello_Quiz_Settings extends Forminator_Addon_Quiz_Settin
750
  * @param array $submitted_data
751
  */
752
  public function disconnect_quiz( $submitted_data ) {
753
- // only execute if multi_id provided on submitted data
754
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
755
  $addon_quiz_settings = $this->get_quiz_settings_values();
756
  unset( $addon_quiz_settings[ $submitted_data['multi_id'] ] );
42
  * @return array
43
  */
44
  public function quiz_settings_wizards() {
45
+ // numerical array steps.
46
  return array(
47
  array(
48
  'callback' => array( $this, 'setup_name' ),
507
  $members = array();
508
 
509
  try {
510
+ // get available labels.
511
  $api = $this->addon->get_api();
512
  $labels_request = $api->get_board_labels( $board_id );
513
 
524
  }
525
  }
526
 
527
+ // get available members.
528
  $members_request = $api->get_board_members( $board_id );
529
 
530
  foreach ( $members_request as $data ) {
531
  if ( isset( $data->id ) && isset( $data->username ) ) {
532
  $display_name = $data->username;
533
+ // its from API var.
534
  // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
535
  if ( isset( $data->fullName ) && ! empty( $data->fullName ) ) {
536
+ // its from API var.
537
  // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
538
  $display_name = $data->fullName;
539
  }
586
  $input_exceptions->add_input_exception( 'Please pick valid position.', 'position_error' );
587
  }
588
 
589
+ // optional label.
590
  if ( ! empty( $label_ids ) && is_array( $label_ids ) ) {
591
  $labels_keys = array_keys( $labels );
592
  foreach ( $label_ids as $label_id ) {
599
  $label_ids = array();
600
  }
601
 
602
+ // optional member.
603
  if ( ! empty( $member_ids ) && is_array( $member_ids ) ) {
604
  $members_keys = array_keys( $members );
605
  foreach ( $member_ids as $member_id ) {
724
  foreach ( $quiz_settings_values as $key => $value ) {
725
  $multi_ids[] = array(
726
  'id' => $key,
727
+ // use name that was added by user on creating connection.
728
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
729
  );
730
  }
750
  * @param array $submitted_data
751
  */
752
  public function disconnect_quiz( $submitted_data ) {
753
+ // only execute if multi_id provided on submitted data.
754
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
755
  $addon_quiz_settings = $this->get_quiz_settings_values();
756
  unset( $addon_quiz_settings[ $submitted_data['multi_id'] ] );
addons/pro/trello/class-forminator-addon-trello.php CHANGED
@@ -66,7 +66,7 @@ final class Forminator_Addon_Trello extends Forminator_Addon_Abstract {
66
  * @since 1.0 Trello Addon
67
  */
68
  public function __construct() {
69
- // late init to allow translation
70
  $this->_description = __( 'Get awesome by your form.', 'forminator' );
71
  $this->_activation_error_message = __( 'Sorry but we failed to activate Trello Integration, don\'t hesitate to contact us', 'forminator' );
72
  $this->_deactivation_error_message = __( 'Sorry but we failed to deactivate Trello Integration, please try again', 'forminator' );
@@ -109,14 +109,14 @@ final class Forminator_Addon_Trello extends Forminator_Addon_Abstract {
109
  */
110
  public function is_connected() {
111
  try {
112
- // check if its active
113
  if ( ! $this->is_active() ) {
114
  throw new Forminator_Addon_Trello_Exception( __( 'Trello is not active', 'forminator' ) );
115
  }
116
 
117
  $is_connected = false;
118
  $setting_values = $this->get_settings_values();
119
- // if user completed api setup
120
  if ( isset( $setting_values['token'] ) && ! empty( $setting_values['token'] ) ) {
121
  $is_connected = true;
122
  }
@@ -157,7 +157,7 @@ final class Forminator_Addon_Trello extends Forminator_Addon_Abstract {
157
  throw new Forminator_Addon_Trello_Exception( __( 'Invalid Form Settings of Trello', 'forminator' ) );
158
  }
159
 
160
- // Mark as active when there is at least one active connection
161
  if ( false === $form_settings_instance->find_one_active_connection() ) {
162
  throw new Forminator_Addon_Trello_Exception( __( 'No active Trello connection found in this form', 'forminator' ) );
163
  }
@@ -175,8 +175,8 @@ final class Forminator_Addon_Trello extends Forminator_Addon_Abstract {
175
  * @since 1.2
176
  *
177
  * @param bool $is_form_connected
178
- * @param int $form_id Current Form ID
179
- * @param Forminator_Addon_Trello_Form_Settings|null $form_settings_instance Instance of form settings, or null when unavailable
180
  *
181
  */
182
  $is_form_connected = apply_filters( 'forminator_addon_trello_is_form_connected', $is_form_connected, $form_id, $form_settings_instance );
@@ -265,7 +265,7 @@ final class Forminator_Addon_Trello extends Forminator_Addon_Abstract {
265
  */
266
  $card_delete_mode = apply_filters( 'forminator_addon_trello_card_delete_mode', $card_delete_mode );
267
 
268
- // fallback to delete
269
  if ( ! in_array( $card_delete_mode, self::get_card_delete_modes(), true ) ) {
270
  $card_delete_mode = self::CARD_DELETE_MODE_DELETE;
271
  }
@@ -294,7 +294,7 @@ final class Forminator_Addon_Trello extends Forminator_Addon_Abstract {
294
  */
295
  public function get_app_key() {
296
  $app_key = $this->_app_key;
297
- // check override by config constant
298
  if ( defined( 'FORMINATOR_ADDON_TRELLO_APP_KEY' ) && FORMINATOR_ADDON_TRELLO_APP_KEY ) {
299
  $app_key = FORMINATOR_ADDON_TRELLO_APP_KEY;
300
  }
@@ -402,7 +402,7 @@ final class Forminator_Addon_Trello extends Forminator_Addon_Abstract {
402
  public function is_authorized( $submitted_data ) {
403
  $setting_values = $this->get_settings_values();
404
 
405
- // check api_key and and api_url set up
406
  return isset( $setting_values['token'] ) && ! empty( $setting_values['token'] );
407
  }
408
 
@@ -506,7 +506,7 @@ final class Forminator_Addon_Trello extends Forminator_Addon_Abstract {
506
  $return_url = forminator_addon_integration_section_admin_url( $this, 'authorize', true );
507
  }
508
  $return_url = rawurlencode( $return_url );
509
- // https://developers.trello.com/page/authorization
510
  $auth_params = array(
511
  'callback_method' => 'fragment',
512
  'scope' => 'read,write,account',
@@ -544,7 +544,7 @@ final class Forminator_Addon_Trello extends Forminator_Addon_Abstract {
544
  */
545
  public function validate_token( $token ) {
546
  try {
547
- // ensure new instance
548
  $api = $this->get_api( $token );
549
  $me_request = $api->get_( 'members/me/' );
550
 
@@ -641,15 +641,15 @@ final class Forminator_Addon_Trello extends Forminator_Addon_Abstract {
641
  $this->connected_account = array();
642
  try {
643
  $api = $this->get_api();
644
- // revoke token from trello server
645
  forminator_addon_maybe_log( __METHOD__, $this->_token );
646
  $api->delete_( 'tokens/' . $this->_token );
647
  } catch ( Forminator_Addon_Trello_Wp_Api_Exception $e ) {
648
- // API error, okay to be ignored, can be externally un-authorized
649
  forminator_addon_maybe_log( __METHOD__, $e->getMessage() );
650
  } catch ( Forminator_Addon_Trello_Exception $e ) {
651
- // this will never throws, but here for reference
652
- // just in case we add more logic on deactivate
653
  $this->_deactivation_error_message = $e->getMessage();
654
 
655
  return false;
@@ -702,7 +702,7 @@ final class Forminator_Addon_Trello extends Forminator_Addon_Abstract {
702
  throw new Forminator_Addon_Trello_Exception( 'Invalid Poll Settings of Trello' );
703
  }
704
 
705
- // Mark as active when there is at least one active connection
706
  if ( false === $poll_settings_instance->find_one_active_connection() ) {
707
  throw new Forminator_Addon_Trello_Exception( 'No active Poll connection found in this poll' );
708
  }
@@ -720,8 +720,8 @@ final class Forminator_Addon_Trello extends Forminator_Addon_Abstract {
720
  * @since 1.6.1
721
  *
722
  * @param bool $is_poll_connected
723
- * @param int $poll_id Current Poll ID
724
- * @param Forminator_Addon_Trello_Poll_Settings|null $poll_settings_instance Instance of poll settings, or null when unavailable
725
  *
726
  */
727
  $is_poll_connected = apply_filters( 'forminator_addon_trello_is_poll_connected', $is_poll_connected, $poll_id, $poll_settings_instance );
@@ -762,7 +762,7 @@ final class Forminator_Addon_Trello extends Forminator_Addon_Abstract {
762
  throw new Forminator_Addon_Trello_Exception( 'Invalid Quiz Settings of Trello' );
763
  }
764
 
765
- // Mark as active when there is at least one active connection
766
  if ( false === $quiz_settings_instance->find_one_active_connection() ) {
767
  throw new Forminator_Addon_Trello_Exception( 'No active Trello connection found in this quiz' );
768
  }
@@ -780,8 +780,8 @@ final class Forminator_Addon_Trello extends Forminator_Addon_Abstract {
780
  * @since 1.6.1
781
  *
782
  * @param bool $is_quiz_connected
783
- * @param int $quiz_id Current Quiz ID
784
- * @param Forminator_Addon_Trello_Quiz_Settings|null $quiz_settings_instance Instance of quiz settings, or null when unavailable
785
  *
786
  */
787
  $is_quiz_connected = apply_filters( 'forminator_addon_trello_is_quiz_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
66
  * @since 1.0 Trello Addon
67
  */
68
  public function __construct() {
69
+ // late init to allow translation.
70
  $this->_description = __( 'Get awesome by your form.', 'forminator' );
71
  $this->_activation_error_message = __( 'Sorry but we failed to activate Trello Integration, don\'t hesitate to contact us', 'forminator' );
72
  $this->_deactivation_error_message = __( 'Sorry but we failed to deactivate Trello Integration, please try again', 'forminator' );
109
  */
110
  public function is_connected() {
111
  try {
112
+ // check if its active.
113
  if ( ! $this->is_active() ) {
114
  throw new Forminator_Addon_Trello_Exception( __( 'Trello is not active', 'forminator' ) );
115
  }
116
 
117
  $is_connected = false;
118
  $setting_values = $this->get_settings_values();
119
+ // if user completed api setup.
120
  if ( isset( $setting_values['token'] ) && ! empty( $setting_values['token'] ) ) {
121
  $is_connected = true;
122
  }
157
  throw new Forminator_Addon_Trello_Exception( __( 'Invalid Form Settings of Trello', 'forminator' ) );
158
  }
159
 
160
+ // Mark as active when there is at least one active connection.
161
  if ( false === $form_settings_instance->find_one_active_connection() ) {
162
  throw new Forminator_Addon_Trello_Exception( __( 'No active Trello connection found in this form', 'forminator' ) );
163
  }
175
  * @since 1.2
176
  *
177
  * @param bool $is_form_connected
178
+ * @param int $form_id Current Form ID.
179
+ * @param Forminator_Addon_Trello_Form_Settings|null $form_settings_instance Instance of form settings, or null when unavailable.
180
  *
181
  */
182
  $is_form_connected = apply_filters( 'forminator_addon_trello_is_form_connected', $is_form_connected, $form_id, $form_settings_instance );
265
  */
266
  $card_delete_mode = apply_filters( 'forminator_addon_trello_card_delete_mode', $card_delete_mode );
267
 
268
+ // fallback to delete.
269
  if ( ! in_array( $card_delete_mode, self::get_card_delete_modes(), true ) ) {
270
  $card_delete_mode = self::CARD_DELETE_MODE_DELETE;
271
  }
294
  */
295
  public function get_app_key() {
296
  $app_key = $this->_app_key;
297
+ // check override by config constant.
298
  if ( defined( 'FORMINATOR_ADDON_TRELLO_APP_KEY' ) && FORMINATOR_ADDON_TRELLO_APP_KEY ) {
299
  $app_key = FORMINATOR_ADDON_TRELLO_APP_KEY;
300
  }
402
  public function is_authorized( $submitted_data ) {
403
  $setting_values = $this->get_settings_values();
404
 
405
+ // check api_key and and api_url set up.
406
  return isset( $setting_values['token'] ) && ! empty( $setting_values['token'] );
407
  }
408
 
506
  $return_url = forminator_addon_integration_section_admin_url( $this, 'authorize', true );
507
  }
508
  $return_url = rawurlencode( $return_url );
509
+ // https://developers.trello.com/page/authorization.
510
  $auth_params = array(
511
  'callback_method' => 'fragment',
512
  'scope' => 'read,write,account',
544
  */
545
  public function validate_token( $token ) {
546
  try {
547
+ // ensure new instance.
548
  $api = $this->get_api( $token );
549
  $me_request = $api->get_( 'members/me/' );
550
 
641
  $this->connected_account = array();
642
  try {
643
  $api = $this->get_api();
644
+ // revoke token from trello server.
645
  forminator_addon_maybe_log( __METHOD__, $this->_token );
646
  $api->delete_( 'tokens/' . $this->_token );
647
  } catch ( Forminator_Addon_Trello_Wp_Api_Exception $e ) {
648
+ // API error, okay to be ignored, can be externally un-authorized.
649
  forminator_addon_maybe_log( __METHOD__, $e->getMessage() );
650
  } catch ( Forminator_Addon_Trello_Exception $e ) {
651
+ // this will never throws, but here for reference.
652
+ // just in case we add more logic on deactivate.
653
  $this->_deactivation_error_message = $e->getMessage();
654
 
655
  return false;
702
  throw new Forminator_Addon_Trello_Exception( 'Invalid Poll Settings of Trello' );
703
  }
704
 
705
+ // Mark as active when there is at least one active connection.
706
  if ( false === $poll_settings_instance->find_one_active_connection() ) {
707
  throw new Forminator_Addon_Trello_Exception( 'No active Poll connection found in this poll' );
708
  }
720
  * @since 1.6.1
721
  *
722
  * @param bool $is_poll_connected
723
+ * @param int $poll_id Current Poll ID.
724
+ * @param Forminator_Addon_Trello_Poll_Settings|null $poll_settings_instance Instance of poll settings, or null when unavailable.
725
  *
726
  */
727
  $is_poll_connected = apply_filters( 'forminator_addon_trello_is_poll_connected', $is_poll_connected, $poll_id, $poll_settings_instance );
762
  throw new Forminator_Addon_Trello_Exception( 'Invalid Quiz Settings of Trello' );
763
  }
764
 
765
+ // Mark as active when there is at least one active connection.
766
  if ( false === $quiz_settings_instance->find_one_active_connection() ) {
767
  throw new Forminator_Addon_Trello_Exception( 'No active Trello connection found in this quiz' );
768
  }
780
  * @since 1.6.1
781
  *
782
  * @param bool $is_quiz_connected
783
+ * @param int $quiz_id Current Quiz ID.
784
+ * @param Forminator_Addon_Trello_Quiz_Settings|null $quiz_settings_instance Instance of quiz settings, or null when unavailable.
785
  *
786
  */
787
  $is_quiz_connected = apply_filters( 'forminator_addon_trello_is_quiz_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
addons/pro/trello/lib/class-forminator-addon-trello-wp-api.php CHANGED
@@ -94,7 +94,7 @@ class Forminator_Addon_Trello_Wp_Api {
94
  *
95
  * @since 1.1
96
  *
97
- * @param string $user_agent current user agent
98
  */
99
  $user_agent = apply_filters( 'forminator_addon_trello_api_user_agent', $user_agent );
100
 
@@ -115,7 +115,7 @@ class Forminator_Addon_Trello_Wp_Api {
115
  * @throws Forminator_Addon_Trello_Wp_Api_Not_Found_Exception
116
  */
117
  private function request( $verb, $path, $args = array() ) {
118
- // Adding extra user agent for wp remote request
119
  add_filter( 'http_headers_useragent', array( $this, 'filter_user_agent' ) );
120
 
121
  $url = trailingslashit( $this->_endpoint ) . $path;
@@ -126,10 +126,10 @@ class Forminator_Addon_Trello_Wp_Api {
126
  *
127
  * @since 1.1
128
  *
129
- * @param string $url full url with scheme
130
- * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`
131
- * @param string $path requested path resource
132
- * @param array $args argument sent to this function
133
  */
134
  $url = apply_filters( 'forminator_addon_trello_api_url', $url, $verb, $path, $args );
135
 
@@ -143,9 +143,9 @@ class Forminator_Addon_Trello_Wp_Api {
143
  * @since 1.1
144
  *
145
  * @param array $headers
146
- * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`
147
- * @param string $path requested path resource
148
- * @param array $args argument sent to this function
149
  */
150
  $headers = apply_filters( 'forminator_addon_trello_api_request_headers', $headers, $verb, $path, $args );
151
 
@@ -160,9 +160,9 @@ class Forminator_Addon_Trello_Wp_Api {
160
  *
161
  * @since 1.1
162
  *
163
- * @param array $request_data it will be `http_build_query`-ed when `GET` or `wp_json_encode`-ed otherwise
164
- * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`
165
- * @param string $path requested path resource
166
  */
167
  $args = apply_filters( 'forminator_addon_trello_api_request_data', $request_data, $verb, $path );
168
 
@@ -205,7 +205,7 @@ class Forminator_Addon_Trello_Wp_Api {
205
 
206
  $body = wp_remote_retrieve_body( $res );
207
 
208
- // probably silent mode
209
  if ( ! empty( $body ) ) {
210
  $res = json_decode( $body );
211
  forminator_addon_maybe_log( __METHOD__, $res );
@@ -217,9 +217,9 @@ class Forminator_Addon_Trello_Wp_Api {
217
  *
218
  * @since 1.1
219
  *
220
- * @param mixed $response original wp remote request response or decoded body if available
221
- * @param string $body original content of http response's body
222
- * @param array|WP_Error $wp_response original wp remote request response
223
  */
224
  $res = apply_filters( 'forminator_addon_trello_api_response', $response, $body, $wp_response );
225
 
94
  *
95
  * @since 1.1
96
  *
97
+ * @param string $user_agent current user agent.
98
  */
99
  $user_agent = apply_filters( 'forminator_addon_trello_api_user_agent', $user_agent );
100
 
115
  * @throws Forminator_Addon_Trello_Wp_Api_Not_Found_Exception
116
  */
117
  private function request( $verb, $path, $args = array() ) {
118
+ // Adding extra user agent for wp remote request.
119
  add_filter( 'http_headers_useragent', array( $this, 'filter_user_agent' ) );
120
 
121
  $url = trailingslashit( $this->_endpoint ) . $path;
126
  *
127
  * @since 1.1
128
  *
129
+ * @param string $url full url with scheme.
130
+ * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`.
131
+ * @param string $path requested path resource.
132
+ * @param array $args argument sent to this function.
133
  */
134
  $url = apply_filters( 'forminator_addon_trello_api_url', $url, $verb, $path, $args );
135
 
143
  * @since 1.1
144
  *
145
  * @param array $headers
146
+ * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`.
147
+ * @param string $path requested path resource.
148
+ * @param array $args argument sent to this function.
149
  */
150
  $headers = apply_filters( 'forminator_addon_trello_api_request_headers', $headers, $verb, $path, $args );
151
 
160
  *
161
  * @since 1.1
162
  *
163
+ * @param array $request_data it will be `http_build_query`-ed when `GET` or `wp_json_encode`-ed otherwise.
164
+ * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`.
165
+ * @param string $path requested path resource.
166
  */
167
  $args = apply_filters( 'forminator_addon_trello_api_request_data', $request_data, $verb, $path );
168
 
205
 
206
  $body = wp_remote_retrieve_body( $res );
207
 
208
+ // probably silent mode.
209
  if ( ! empty( $body ) ) {
210
  $res = json_decode( $body );
211
  forminator_addon_maybe_log( __METHOD__, $res );
217
  *
218
  * @since 1.1
219
  *
220
+ * @param mixed $response original wp remote request response or decoded body if available.
221
+ * @param string $body original content of http response's body.
222
+ * @param array|WP_Error $wp_response original wp remote request response.
223
  */
224
  $res = apply_filters( 'forminator_addon_trello_api_response', $response, $body, $wp_response );
225
 
addons/pro/trello/views/form-settings/setup-board.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'board_id' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'board_id' => '',
addons/pro/trello/views/form-settings/setup-card.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'card_name' => '',
5
  'card_name_error' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'card_name' => '',
5
  'card_name_error' => '',
addons/pro/trello/views/form-settings/setup-list.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'list_id' => '',
@@ -24,7 +24,7 @@ $vars['step_description'] = sprintf(
24
  ?>
25
  <div class="integration-header">
26
  <h3 class="sui-box-title" id="dialogTitle2"><?php echo esc_html( __( 'Assign List', 'forminator' ) ); ?></h3>
27
- <p><?php echo $vars['step_description']; // phpcs:ignore ?></p>
28
  <?php if ( ! empty( $vars['error_message'] ) ) : ?>
29
  <span class="sui-notice sui-notice-error"><p><?php echo esc_html( $vars['error_message'] ); ?></p></span>
30
  <?php endif; ?>
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'list_id' => '',
24
  ?>
25
  <div class="integration-header">
26
  <h3 class="sui-box-title" id="dialogTitle2"><?php echo esc_html( __( 'Assign List', 'forminator' ) ); ?></h3>
27
+ <p><?php echo wp_kses_post( $vars['step_description'] ); ?></p>
28
  <?php if ( ! empty( $vars['error_message'] ) ) : ?>
29
  <span class="sui-notice sui-notice-error"><p><?php echo esc_html( $vars['error_message'] ); ?></p></span>
30
  <?php endif; ?>
addons/pro/trello/views/form-settings/setup-name.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
addons/pro/trello/views/poll-settings/setup-board.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'board_id' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'board_id' => '',
addons/pro/trello/views/poll-settings/setup-card.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'card_name' => '',
5
  'card_name_error' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'card_name' => '',
5
  'card_name_error' => '',
addons/pro/trello/views/poll-settings/setup-list.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'list_id' => '',
@@ -24,7 +24,7 @@ $vars['step_description'] = sprintf(
24
  ?>
25
  <div class="integration-header">
26
  <h3 class="sui-box-title" id="dialogTitle2"><?php echo esc_html( __( 'Assign List', 'forminator' ) ); ?></h3>
27
- <p><?php echo $vars['step_description']; // phpcs:ignore ?></p>
28
  <?php if ( ! empty( $vars['error_message'] ) ) : ?>
29
  <span class="sui-notice sui-notice-error"><p><?php echo esc_html( $vars['error_message'] ); ?></p></span>
30
  <?php endif; ?>
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'list_id' => '',
24
  ?>
25
  <div class="integration-header">
26
  <h3 class="sui-box-title" id="dialogTitle2"><?php echo esc_html( __( 'Assign List', 'forminator' ) ); ?></h3>
27
+ <p><?php echo wp_kses_post( $vars['step_description'] ); ?></p>
28
  <?php if ( ! empty( $vars['error_message'] ) ) : ?>
29
  <span class="sui-notice sui-notice-error"><p><?php echo esc_html( $vars['error_message'] ); ?></p></span>
30
  <?php endif; ?>
addons/pro/trello/views/poll-settings/setup-name.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
addons/pro/trello/views/quiz-settings/setup-board.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'board_id' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'board_id' => '',
addons/pro/trello/views/quiz-settings/setup-card.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'card_name' => '',
5
  'card_name_error' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'card_name' => '',
5
  'card_name_error' => '',
addons/pro/trello/views/quiz-settings/setup-list.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'list_id' => '',
@@ -24,7 +24,7 @@ $vars['step_description'] = sprintf(
24
  ?>
25
  <div class="integration-header">
26
  <h3 class="sui-box-title" id="dialogTitle2"><?php echo esc_html( __( 'Assign List', 'forminator' ) ); ?></h3>
27
- <p><?php echo $vars['step_description']; // phpcs:ignore ?></p>
28
  <?php if ( ! empty( $vars['error_message'] ) ) : ?>
29
  <span class="sui-notice sui-notice-error"><p><?php echo esc_html( $vars['error_message'] ); ?></p></span>
30
  <?php endif; ?>
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'list_id' => '',
24
  ?>
25
  <div class="integration-header">
26
  <h3 class="sui-box-title" id="dialogTitle2"><?php echo esc_html( __( 'Assign List', 'forminator' ) ); ?></h3>
27
+ <p><?php echo wp_kses_post( $vars['step_description'] ); ?></p>
28
  <?php if ( ! empty( $vars['error_message'] ) ) : ?>
29
  <span class="sui-notice sui-notice-error"><p><?php echo esc_html( $vars['error_message'] ); ?></p></span>
30
  <?php endif; ?>
addons/pro/trello/views/quiz-settings/setup-name.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
addons/pro/trello/views/sections/authorize.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'is_close' => false,
@@ -44,7 +44,7 @@ foreach ( $template_vars as $key => $val ) {
44
 
45
  var hashParams = {};
46
  var e,
47
- a = /\+/g, // Regex for replacing addition symbol with a space
48
  r = /([^&;=]+)=?([^&;]*)/g,
49
  d = function (s) {
50
  return decodeURIComponent(s.replace(a, " "));
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'is_close' => false,
44
 
45
  var hashParams = {};
46
  var e,
47
+ a = /\+/g, // Regex for replacing addition symbol with a space.
48
  r = /([^&;=]+)=?([^&;]*)/g,
49
  d = function (s) {
50
  return decodeURIComponent(s.replace(a, " "));
addons/pro/trello/views/settings/authorize.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'connected_account' => array(),
5
  'auth_url' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'connected_account' => array(),
5
  'auth_url' => '',
addons/pro/trello/views/settings/wait-authorize.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'connected_account' => array(),
5
  'auth_url' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'connected_account' => array(),
5
  'auth_url' => '',
addons/pro/zapier/class-forminator-addon-zapier-form-hooks.php CHANGED
@@ -65,8 +65,8 @@ class Forminator_Addon_Zapier_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
65
  * @since 1.1
66
  *
67
  * @param array $submitted_data
68
- * @param int $form_id current Form ID
69
- * @param Forminator_Addon_Zapier_Form_Settings $form_settings_instance Zapier Addon Form Settings instance
70
  */
71
  $submitted_data = apply_filters(
72
  'forminator_addon_zapier_form_submitted_data',
@@ -87,14 +87,14 @@ class Forminator_Addon_Zapier_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
87
  *
88
  * @since 1.1
89
  *
90
- * @param int $form_id current Form ID
91
  * @param array $submitted_data
92
- * @param Forminator_Addon_Zapier_Form_Settings $form_settings_instance Zapier Addon Form Settings instance
93
  */
94
  do_action( 'forminator_addon_zapier_before_post_to_webhook', $form_id, $submitted_data, $form_settings_instance );
95
 
96
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
97
- // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to zapier
98
  $data[] = array(
99
  'name' => 'status-' . $key,
100
  'value' => $this->get_status_on_send_data( $key, $submitted_data, $addon_setting_value, $form_settings, $form_entry_fields ),
@@ -108,9 +108,9 @@ class Forminator_Addon_Zapier_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
108
  * @since 1.1
109
  *
110
  * @param array $entry_fields
111
- * @param int $form_id current Form ID
112
  * @param array $submitted_data
113
- * @param Forminator_Addon_Zapier_Form_Settings $form_settings_instance Zapier Form Settings instance
114
  */
115
  $data = apply_filters(
116
  'forminator_addon_zapier_entry_fields',
@@ -139,7 +139,7 @@ class Forminator_Addon_Zapier_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
139
  * @return array `is_sent` true means its success send data to zapier, false otherwise
140
  */
141
  private function get_status_on_send_data( $connection_id, $submitted_data, $connection_settings, $form_settings, $form_entry_fields ) {
142
- // initialize as null
143
  $zapier_api = null;
144
 
145
  $form_id = $this->form_id;
@@ -158,8 +158,8 @@ class Forminator_Addon_Zapier_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
158
  * @since 1.1
159
  *
160
  * @param string $endpoint
161
- * @param int $form_id current Form ID
162
- * @param array $connection_settings current connection setting, it contains `name` and `webhook_url`
163
  */
164
  $endpoint = apply_filters(
165
  'forminator_addon_zapier_endpoint',
@@ -172,13 +172,13 @@ class Forminator_Addon_Zapier_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
172
 
173
  $args = $submitted_data;
174
 
175
- // find calculation fields on entry
176
  $calculation_fields_meta_values = self::find_calculation_fields_meta_from_entry_fields( $form_entry_fields );
177
  foreach ( $calculation_fields_meta_values as $element_id => $meta_value ) {
178
  $args[ $element_id ] = Forminator_Form_Entry_Model::meta_value_to_string( 'calculation', $meta_value );
179
  }
180
 
181
- // find stripe fields (rarely will be multiple field) on entry
182
  $stripe_fields_meta_values = self::find_stripe_fields_meta_from_entry_fields( $form_entry_fields );
183
  foreach ( $stripe_fields_meta_values as $element_id => $meta_value ) {
184
  $args[ $element_id ] = Forminator_Form_Entry_Model::meta_value_to_string( 'stripe', $meta_value );
@@ -193,12 +193,12 @@ class Forminator_Addon_Zapier_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
193
  * @since 1.1
194
  *
195
  * @param array $args
196
- * @param int $form_id Current Form id
197
- * @param string $connection_id ID of current connection
198
  * @param array $submitted_data
199
- * @param array $connection_settings current connection setting, contains `name` and `webhook_url`
200
- * @param array $form_settings Displayed Form settings
201
- * @param Forminator_Addon_Zapier_Form_Settings $form_settings_instance Zapier Form Settings instance
202
  */
203
  $args = apply_filters(
204
  'forminator_addon_zapier_post_to_webhook_args',
@@ -261,8 +261,8 @@ class Forminator_Addon_Zapier_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
261
  * @since 1.1
262
  *
263
  * @param array $addon_meta_data
264
- * @param int $form_id current Form ID
265
- * @param Forminator_Addon_Zapier_Form_Settings $form_settings_instance Zapier Form Settings instance
266
  */
267
  $addon_meta_data = apply_filters(
268
  'forminator_addon_zapier_metadata',
@@ -278,9 +278,9 @@ class Forminator_Addon_Zapier_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
278
 
279
  $addon_meta_data = $addon_meta_data[0];
280
 
281
- // make sure its `status`, because we only add this
282
- // when its `status` then its single connection (backward compat on dev)
283
- // when its status-$MULTI_ID its multiple connection its default behaviour
284
  if ( 'status' !== $addon_meta_data['name'] ) {
285
  if ( stripos( $addon_meta_data['name'], 'status-' ) === 0 ) {
286
  return $this->on_render_entry_multi_connection( $addon_meta_datas );
@@ -368,7 +368,7 @@ class Forminator_Addon_Zapier_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
368
  }
369
 
370
  if ( Forminator_Addon_Zapier::is_show_full_log() ) {
371
- // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_ZAPIER_SHOW_FULL_LOG', true)`
372
  if ( isset( $status['url_request'] ) ) {
373
  $sub_entries[] = array(
374
  'label' => __( 'API URL', 'forminator' ),
@@ -393,7 +393,7 @@ class Forminator_Addon_Zapier_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
393
 
394
  $additional_entry_item['sub_entries'] = $sub_entries;
395
 
396
- // return single array
397
  return $additional_entry_item;
398
  }
399
 
@@ -418,9 +418,9 @@ class Forminator_Addon_Zapier_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
418
  *
419
  * @since 1.1
420
  *
421
- * @param array $export_headers headers to be displayed on export file
422
- * @param int $form_id current Form ID
423
- * @param Forminator_Addon_Zapier_Form_Settings $form_settings_instance Zapier Form Settings instance
424
  */
425
  $export_headers = apply_filters(
426
  'forminator_addon_zapier_export_headers',
@@ -455,8 +455,8 @@ class Forminator_Addon_Zapier_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
455
  * @since 1.1
456
  *
457
  * @param array $addon_meta_data
458
- * @param int $form_id current Form ID
459
- * @param Forminator_Addon_Zapier_Form_Settings $form_settings_instance Zapier Form Settings instance
460
  */
461
  $addon_meta_data = apply_filters(
462
  'forminator_addon_zapier_metadata',
@@ -474,11 +474,11 @@ class Forminator_Addon_Zapier_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
474
  *
475
  * @since 1.1
476
  *
477
- * @param array $export_columns column to be exported
478
- * @param int $form_id current Form ID
479
- * @param Forminator_Form_Entry_Model $entry_model Form Entry Model
480
- * @param array $addon_meta_data meta data saved by addon on entry fields
481
- * @param Forminator_Addon_Zapier_Form_Settings $form_settings_instance Zapier Form Settings instance
482
  */
483
  $export_columns = apply_filters(
484
  'forminator_addon_zapier_export_columns',
@@ -511,15 +511,15 @@ class Forminator_Addon_Zapier_Form_Hooks extends Forminator_Addon_Form_Hooks_Abs
511
 
512
  $addon_meta_data = $addon_meta_data[0];
513
 
514
- // make sure its `status`, because we only add this
515
  if ( 'status' !== $addon_meta_data['name'] ) {
516
  if ( stripos( $addon_meta_data['name'], 'status-' ) === 0 ) {
517
  $meta_data = array();
518
  foreach ( $addon_meta_datas as $addon_meta_data ) {
519
- // make it like single value so it will be processed like single meta data
520
  $addon_meta_data['name'] = 'status';
521
 
522
- // add it on an array for next recursive process
523
  $meta_data[] = $this->get_from_addon_meta_data( array( $addon_meta_data ), $key, $default );
524
  }
525
 
65
  * @since 1.1
66
  *
67
  * @param array $submitted_data
68
+ * @param int $form_id current Form ID.
69
+ * @param Forminator_Addon_Zapier_Form_Settings $form_settings_instance Zapier Addon Form Settings instance.
70
  */
71
  $submitted_data = apply_filters(
72
  'forminator_addon_zapier_form_submitted_data',
87
  *
88
  * @since 1.1
89
  *
90
+ * @param int $form_id current Form ID.
91
  * @param array $submitted_data
92
+ * @param Forminator_Addon_Zapier_Form_Settings $form_settings_instance Zapier Addon Form Settings instance.
93
  */
94
  do_action( 'forminator_addon_zapier_before_post_to_webhook', $form_id, $submitted_data, $form_settings_instance );
95
 
96
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
97
+ // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to zapier.
98
  $data[] = array(
99
  'name' => 'status-' . $key,
100
  'value' => $this->get_status_on_send_data( $key, $submitted_data, $addon_setting_value, $form_settings, $form_entry_fields ),
108
  * @since 1.1
109
  *
110
  * @param array $entry_fields
111
+ * @param int $form_id current Form ID.
112
  * @param array $submitted_data
113
+ * @param Forminator_Addon_Zapier_Form_Settings $form_settings_instance Zapier Form Settings instance.
114
  */
115
  $data = apply_filters(
116
  'forminator_addon_zapier_entry_fields',
139
  * @return array `is_sent` true means its success send data to zapier, false otherwise
140
  */
141
  private function get_status_on_send_data( $connection_id, $submitted_data, $connection_settings, $form_settings, $form_entry_fields ) {
142
+ // initialize as null.
143
  $zapier_api = null;
144
 
145
  $form_id = $this->form_id;
158
  * @since 1.1
159
  *
160
  * @param string $endpoint
161
+ * @param int $form_id current Form ID.
162
+ * @param array $connection_settings current connection setting, it contains `name` and `webhook_url`.
163
  */
164
  $endpoint = apply_filters(
165
  'forminator_addon_zapier_endpoint',
172
 
173
  $args = $submitted_data;
174
 
175
+ // find calculation fields on entry.
176
  $calculation_fields_meta_values = self::find_calculation_fields_meta_from_entry_fields( $form_entry_fields );
177
  foreach ( $calculation_fields_meta_values as $element_id => $meta_value ) {
178
  $args[ $element_id ] = Forminator_Form_Entry_Model::meta_value_to_string( 'calculation', $meta_value );
179
  }
180
 
181
+ // find stripe fields (rarely will be multiple field) on entry.
182
  $stripe_fields_meta_values = self::find_stripe_fields_meta_from_entry_fields( $form_entry_fields );
183
  foreach ( $stripe_fields_meta_values as $element_id => $meta_value ) {
184
  $args[ $element_id ] = Forminator_Form_Entry_Model::meta_value_to_string( 'stripe', $meta_value );
193
  * @since 1.1
194
  *
195
  * @param array $args
196
+ * @param int $form_id Current Form id.
197
+ * @param string $connection_id ID of current connection.
198
  * @param array $submitted_data
199
+ * @param array $connection_settings current connection setting, contains `name` and `webhook_url`.
200
+ * @param array $form_settings Displayed Form settings.
201
+ * @param Forminator_Addon_Zapier_Form_Settings $form_settings_instance Zapier Form Settings instance.
202
  */
203
  $args = apply_filters(
204
  'forminator_addon_zapier_post_to_webhook_args',
261
  * @since 1.1
262
  *
263
  * @param array $addon_meta_data
264
+ * @param int $form_id current Form ID.
265
+ * @param Forminator_Addon_Zapier_Form_Settings $form_settings_instance Zapier Form Settings instance.
266
  */
267
  $addon_meta_data = apply_filters(
268
  'forminator_addon_zapier_metadata',
278
 
279
  $addon_meta_data = $addon_meta_data[0];
280
 
281
+ // make sure its `status`, because we only add this.
282
+ // when its `status` then its single connection (backward compat on dev).
283
+ // when its status-$MULTI_ID its multiple connection its default behaviour.
284
  if ( 'status' !== $addon_meta_data['name'] ) {
285
  if ( stripos( $addon_meta_data['name'], 'status-' ) === 0 ) {
286
  return $this->on_render_entry_multi_connection( $addon_meta_datas );
368
  }
369
 
370
  if ( Forminator_Addon_Zapier::is_show_full_log() ) {
371
+ // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_ZAPIER_SHOW_FULL_LOG', true)`.
372
  if ( isset( $status['url_request'] ) ) {
373
  $sub_entries[] = array(
374
  'label' => __( 'API URL', 'forminator' ),
393
 
394
  $additional_entry_item['sub_entries'] = $sub_entries;
395
 
396
+ // return single array.
397
  return $additional_entry_item;
398
  }
399
 
418
  *
419
  * @since 1.1
420
  *
421
+ * @param array $export_headers headers to be displayed on export file.
422
+ * @param int $form_id current Form ID.
423
+ * @param Forminator_Addon_Zapier_Form_Settings $form_settings_instance Zapier Form Settings instance.
424
  */
425
  $export_headers = apply_filters(
426
  'forminator_addon_zapier_export_headers',
455
  * @since 1.1
456
  *
457
  * @param array $addon_meta_data
458
+ * @param int $form_id current Form ID.
459
+ * @param Forminator_Addon_Zapier_Form_Settings $form_settings_instance Zapier Form Settings instance.
460
  */
461
  $addon_meta_data = apply_filters(
462
  'forminator_addon_zapier_metadata',
474
  *
475
  * @since 1.1
476
  *
477
+ * @param array $export_columns column to be exported.
478
+ * @param int $form_id current Form ID.
479
+ * @param Forminator_Form_Entry_Model $entry_model Form Entry Model.
480
+ * @param array $addon_meta_data meta data saved by addon on entry fields.
481
+ * @param Forminator_Addon_Zapier_Form_Settings $form_settings_instance Zapier Form Settings instance.
482
  */
483
  $export_columns = apply_filters(
484
  'forminator_addon_zapier_export_columns',
511
 
512
  $addon_meta_data = $addon_meta_data[0];
513
 
514
+ // make sure its `status`, because we only add this.
515
  if ( 'status' !== $addon_meta_data['name'] ) {
516
  if ( stripos( $addon_meta_data['name'], 'status-' ) === 0 ) {
517
  $meta_data = array();
518
  foreach ( $addon_meta_datas as $addon_meta_data ) {
519
+ // make it like single value so it will be processed like single meta data.
520
  $addon_meta_data['name'] = 'status';
521
 
522
+ // add it on an array for next recursive process.
523
  $meta_data[] = $this->get_from_addon_meta_data( array( $addon_meta_data ), $key, $default );
524
  }
525
 
addons/pro/zapier/class-forminator-addon-zapier-form-settings.php CHANGED
@@ -50,7 +50,7 @@ class Forminator_Addon_Zapier_Form_Settings extends Forminator_Addon_Form_Settin
50
  * @return array
51
  */
52
  public function form_settings_wizards() {
53
- // numerical array steps
54
  return array(
55
  // 0
56
  array(
@@ -224,13 +224,13 @@ class Forminator_Addon_Zapier_Form_Settings extends Forminator_Addon_Form_Settin
224
  throw $current_input_exception;
225
  }
226
 
227
- // must be this prefix
228
  if ( stripos( $submitted_data['webhook_url'], 'https://hooks.zapier.com/' ) !== 0 ) {
229
  $current_input_exception->add_input_exception( __( 'Please put a valid Webhook URL.', 'forminator' ), 'webhook_url' );
230
  throw $current_input_exception;
231
  }
232
 
233
- // must not be in silent mode
234
  if ( stripos( $submitted_data['webhook_url'], 'silent' ) !== false ) {
235
  $current_input_exception->add_input_exception( __( 'Please disable Silent Mode on Webhook URL.', 'forminator' ), 'webhook_url' );
236
  throw $current_input_exception;
@@ -253,8 +253,8 @@ class Forminator_Addon_Zapier_Form_Settings extends Forminator_Addon_Form_Settin
253
  * @since 1.1
254
  *
255
  * @param string $endpoint
256
- * @param int $form_id current Form ID
257
- * @param array $connection_settings Submitted data by user, it contains `name` and `webhook_url`
258
  */
259
  $endpoint = apply_filters(
260
  'forminator_addon_zapier_endpoint',
@@ -266,7 +266,7 @@ class Forminator_Addon_Zapier_Form_Settings extends Forminator_Addon_Form_Settin
266
  forminator_addon_maybe_log( __METHOD__, $endpoint );
267
  $api = $this->addon->get_api( $endpoint );
268
 
269
- // build form sample data
270
  $sample_data = $this->build_form_sample_data();
271
  $sample_data['is_test'] = true;
272
 
@@ -280,8 +280,8 @@ class Forminator_Addon_Zapier_Form_Settings extends Forminator_Addon_Form_Settin
280
  * @since 1.1
281
  *
282
  * @param array $sample_data
283
- * @param int $form_id current Form ID
284
- * @param array $submitted_data Submitted data by user, it contains `name` and `webhook_url`
285
  */
286
  $sample_data = apply_filters(
287
  'forminator_addon_zapier_sample_data',
@@ -329,7 +329,7 @@ class Forminator_Addon_Zapier_Form_Settings extends Forminator_Addon_Form_Settin
329
  $sample_data['form-title'] = $this->form_settings['formName'];
330
  $sample_data['entry-time'] = current_time( 'Y-m-d H:i:s' );
331
 
332
- // wrap in array as zapier best practices
333
  return array( $sample_data );
334
  }
335
 
@@ -377,9 +377,9 @@ class Forminator_Addon_Zapier_Form_Settings extends Forminator_Addon_Form_Settin
377
  public function find_one_active_connection() {
378
  $addon_form_settings = $this->get_form_settings_values();
379
 
380
- // backward compat old version
381
  if ( isset( $addon_form_settings['webhook_url'] ) ) {
382
- // convert to multi id type
383
  $new_id = $this->generate_multi_id();
384
  $addon_form_settings['name'] = $new_id;
385
  $this->save_form_settings_values( array( $new_id => $addon_form_settings ) );
@@ -419,7 +419,7 @@ class Forminator_Addon_Zapier_Form_Settings extends Forminator_Addon_Form_Settin
419
  foreach ( $this->get_form_settings_values() as $key => $value ) {
420
  $multi_ids[] = array(
421
  'id' => $key,
422
- // use name that was added by user on creating connection
423
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
424
  );
425
  }
@@ -435,7 +435,7 @@ class Forminator_Addon_Zapier_Form_Settings extends Forminator_Addon_Form_Settin
435
  * @param array $submitted_data
436
  */
437
  public function disconnect_form( $submitted_data ) {
438
- // only execute if multi_id provided on submitted data
439
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
440
  $addon_form_settings = $this->get_form_settings_values();
441
  unset( $addon_form_settings[ $submitted_data['multi_id'] ] );
50
  * @return array
51
  */
52
  public function form_settings_wizards() {
53
+ // numerical array steps.
54
  return array(
55
  // 0
56
  array(
224
  throw $current_input_exception;
225
  }
226
 
227
+ // must be this prefix.
228
  if ( stripos( $submitted_data['webhook_url'], 'https://hooks.zapier.com/' ) !== 0 ) {
229
  $current_input_exception->add_input_exception( __( 'Please put a valid Webhook URL.', 'forminator' ), 'webhook_url' );
230
  throw $current_input_exception;
231
  }
232
 
233
+ // must not be in silent mode.
234
  if ( stripos( $submitted_data['webhook_url'], 'silent' ) !== false ) {
235
  $current_input_exception->add_input_exception( __( 'Please disable Silent Mode on Webhook URL.', 'forminator' ), 'webhook_url' );
236
  throw $current_input_exception;
253
  * @since 1.1
254
  *
255
  * @param string $endpoint
256
+ * @param int $form_id current Form ID.
257
+ * @param array $connection_settings Submitted data by user, it contains `name` and `webhook_url`.
258
  */
259
  $endpoint = apply_filters(
260
  'forminator_addon_zapier_endpoint',
266
  forminator_addon_maybe_log( __METHOD__, $endpoint );
267
  $api = $this->addon->get_api( $endpoint );
268
 
269
+ // build form sample data.
270
  $sample_data = $this->build_form_sample_data();
271
  $sample_data['is_test'] = true;
272
 
280
  * @since 1.1
281
  *
282
  * @param array $sample_data
283
+ * @param int $form_id current Form ID.
284
+ * @param array $submitted_data Submitted data by user, it contains `name` and `webhook_url`.
285
  */
286
  $sample_data = apply_filters(
287
  'forminator_addon_zapier_sample_data',
329
  $sample_data['form-title'] = $this->form_settings['formName'];
330
  $sample_data['entry-time'] = current_time( 'Y-m-d H:i:s' );
331
 
332
+ // wrap in array as zapier best practices.
333
  return array( $sample_data );
334
  }
335
 
377
  public function find_one_active_connection() {
378
  $addon_form_settings = $this->get_form_settings_values();
379
 
380
+ // backward compat old version.
381
  if ( isset( $addon_form_settings['webhook_url'] ) ) {
382
+ // convert to multi id type.
383
  $new_id = $this->generate_multi_id();
384
  $addon_form_settings['name'] = $new_id;
385
  $this->save_form_settings_values( array( $new_id => $addon_form_settings ) );
419
  foreach ( $this->get_form_settings_values() as $key => $value ) {
420
  $multi_ids[] = array(
421
  'id' => $key,
422
+ // use name that was added by user on creating connection.
423
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
424
  );
425
  }
435
  * @param array $submitted_data
436
  */
437
  public function disconnect_form( $submitted_data ) {
438
+ // only execute if multi_id provided on submitted data.
439
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
440
  $addon_form_settings = $this->get_form_settings_values();
441
  unset( $addon_form_settings[ $submitted_data['multi_id'] ] );
addons/pro/zapier/class-forminator-addon-zapier-poll-hooks.php CHANGED
@@ -63,8 +63,8 @@ class Forminator_Addon_Zapier_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
63
  * @since 1.6.1
64
  *
65
  * @param array $submitted_data
66
- * @param int $poll_id current Form ID
67
- * @param Forminator_Addon_Zapier_Form_Settings $poll_settings_instance Zapier Addon Form Settings instance
68
  */
69
  $submitted_data = apply_filters(
70
  'forminator_addon_zapier_poll_submitted_data',
@@ -85,14 +85,14 @@ class Forminator_Addon_Zapier_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
85
  *
86
  * @since 1.6.1
87
  *
88
- * @param int $poll_id current Poll ID
89
  * @param array $submitted_data
90
- * @param Forminator_Addon_Zapier_Poll_Settings $poll_settings_instance Zapier Addon Poll Settings instance
91
  */
92
  do_action( 'forminator_addon_zapier_poll_before_post_to_webhook', $poll_id, $submitted_data, $poll_settings_instance );
93
 
94
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
95
- // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to zapier
96
  $data[] = array(
97
  'name' => 'status-' . $key,
98
  'value' => $this->get_status_on_send_data( $key, $submitted_data, $addon_setting_value, $poll_settings ),
@@ -106,9 +106,9 @@ class Forminator_Addon_Zapier_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
106
  * @since 1.6.1
107
  *
108
  * @param array $entry_fields
109
- * @param int $poll_id current Poll ID
110
  * @param array $submitted_data
111
- * @param Forminator_Addon_Zapier_Poll_Settings $poll_settings_instance Zapier Poll Settings instance
112
  */
113
  $data = apply_filters(
114
  'forminator_addon_zapier_poll_entry_fields',
@@ -135,7 +135,7 @@ class Forminator_Addon_Zapier_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
135
  * @return array `is_sent` true means its success send data to zapier, false otherwise
136
  */
137
  private function get_status_on_send_data( $connection_id, $submitted_data, $connection_settings, $poll_settings ) {
138
- // initialize as null
139
  $zapier_api = null;
140
 
141
  $poll_id = $this->poll_id;
@@ -154,8 +154,8 @@ class Forminator_Addon_Zapier_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
154
  * @since 1.6.1
155
  *
156
  * @param string $endpoint
157
- * @param int $poll_id current Form ID
158
- * @param array $connection_settings current connection setting, it contains `name` and `webhook_url`
159
  */
160
  $endpoint = apply_filters(
161
  'forminator_addon_zapier_poll_endpoint',
@@ -183,12 +183,12 @@ class Forminator_Addon_Zapier_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
183
  $fields_array = $this->poll->get_fields_as_array();
184
  $map_entries = Forminator_Form_Entry_Model::map_polls_entries( $this->poll_id, $fields_array );
185
 
186
- // append new answer
187
  if ( ! $this->poll->is_prevent_store() ) {
188
  $answer_data = isset( $submitted_data[ $this->poll_id ] ) ? $submitted_data[ $this->poll_id ] : '';
189
 
190
  $entries = 0;
191
- // exists on map entries
192
  if ( in_array( $answer_data, array_keys( $map_entries ), true ) ) {
193
  $entries = $map_entries[ $answer_data ];
194
  }
@@ -222,12 +222,12 @@ class Forminator_Addon_Zapier_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
222
  * @since 1.6.1
223
  *
224
  * @param array $args
225
- * @param int $poll_id Current Poll id
226
- * @param string $connection_id ID of current connection
227
  * @param array $submitted_data
228
- * @param array $connection_settings current connection setting, contains `name` and `webhook_url`
229
- * @param array $poll_settings Displayed Poll settings
230
- * @param Forminator_Addon_Zapier_Poll_Settings $poll_settings_instance Zapier Poll Settings instance
231
  */
232
  $args = apply_filters(
233
  'forminator_addon_zapier_poll_post_to_webhook_args',
@@ -288,9 +288,9 @@ class Forminator_Addon_Zapier_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
288
  *
289
  * @since 1.6.1
290
  *
291
- * @param array $export_headers headers to be displayed on export file
292
- * @param int $poll_id current Form ID
293
- * @param Forminator_Addon_Zapier_Poll_Settings $poll_settings_instance Zapier Poll Settings instance
294
  */
295
  $export_headers = apply_filters(
296
  'forminator_addon_zapier_poll_export_headers',
@@ -325,8 +325,8 @@ class Forminator_Addon_Zapier_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
325
  * @since 1.1
326
  *
327
  * @param array $addon_meta_data
328
- * @param int $poll_id current Poll ID
329
- * @param Forminator_Addon_Zapier_Poll_Settings $poll_settings_instance Zapier Poll Settings instance
330
  */
331
  $addon_meta_data = apply_filters(
332
  'forminator_addon_zapier_poll_metadata',
@@ -344,11 +344,11 @@ class Forminator_Addon_Zapier_Poll_Hooks extends Forminator_Addon_Poll_Hooks_Abs
344
  *
345
  * @since 1.6.1
346
  *
347
- * @param array $export_columns column to be exported
348
- * @param int $poll_id current Poll ID
349
- * @param Forminator_Form_Entry_Model $entry_model Form Entry Model
350
- * @param array $addon_meta_data meta data saved by addon on entry fields
351
- * @param Forminator_Addon_Zapier_Poll_Settings $poll_settings_instance Zapier Poll Settings instance
352
  */
353
  $export_columns = apply_filters(
354
  'forminator_addon_zapier_poll_export_columns',
63
  * @since 1.6.1
64
  *
65
  * @param array $submitted_data
66
+ * @param int $poll_id current Form ID.
67
+ * @param Forminator_Addon_Zapier_Form_Settings $poll_settings_instance Zapier Addon Form Settings instance.
68
  */
69
  $submitted_data = apply_filters(
70
  'forminator_addon_zapier_poll_submitted_data',
85
  *
86
  * @since 1.6.1
87
  *
88
+ * @param int $poll_id current Poll ID.
89
  * @param array $submitted_data
90
+ * @param Forminator_Addon_Zapier_Poll_Settings $poll_settings_instance Zapier Addon Poll Settings instance.
91
  */
92
  do_action( 'forminator_addon_zapier_poll_before_post_to_webhook', $poll_id, $submitted_data, $poll_settings_instance );
93
 
94
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
95
+ // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to zapier.
96
  $data[] = array(
97
  'name' => 'status-' . $key,
98
  'value' => $this->get_status_on_send_data( $key, $submitted_data, $addon_setting_value, $poll_settings ),
106
  * @since 1.6.1
107
  *
108
  * @param array $entry_fields
109
+ * @param int $poll_id current Poll ID.
110
  * @param array $submitted_data
111
+ * @param Forminator_Addon_Zapier_Poll_Settings $poll_settings_instance Zapier Poll Settings instance.
112
  */
113
  $data = apply_filters(
114
  'forminator_addon_zapier_poll_entry_fields',
135
  * @return array `is_sent` true means its success send data to zapier, false otherwise
136
  */
137
  private function get_status_on_send_data( $connection_id, $submitted_data, $connection_settings, $poll_settings ) {
138
+ // initialize as null.
139
  $zapier_api = null;
140
 
141
  $poll_id = $this->poll_id;
154
  * @since 1.6.1
155
  *
156
  * @param string $endpoint
157
+ * @param int $poll_id current Form ID.
158
+ * @param array $connection_settings current connection setting, it contains `name` and `webhook_url`.
159
  */
160
  $endpoint = apply_filters(
161
  'forminator_addon_zapier_poll_endpoint',
183
  $fields_array = $this->poll->get_fields_as_array();
184
  $map_entries = Forminator_Form_Entry_Model::map_polls_entries( $this->poll_id, $fields_array );
185
 
186
+ // append new answer.
187
  if ( ! $this->poll->is_prevent_store() ) {
188
  $answer_data = isset( $submitted_data[ $this->poll_id ] ) ? $submitted_data[ $this->poll_id ] : '';
189
 
190
  $entries = 0;
191
+ // exists on map entries.
192
  if ( in_array( $answer_data, array_keys( $map_entries ), true ) ) {
193
  $entries = $map_entries[ $answer_data ];
194
  }
222
  * @since 1.6.1
223
  *
224
  * @param array $args
225
+ * @param int $poll_id Current Poll id.
226
+ * @param string $connection_id ID of current connection.
227
  * @param array $submitted_data
228
+ * @param array $connection_settings current connection setting, contains `name` and `webhook_url`.
229
+ * @param array $poll_settings Displayed Poll settings.
230
+ * @param Forminator_Addon_Zapier_Poll_Settings $poll_settings_instance Zapier Poll Settings instance.
231
  */
232
  $args = apply_filters(
233
  'forminator_addon_zapier_poll_post_to_webhook_args',
288
  *
289
  * @since 1.6.1
290
  *
291
+ * @param array $export_headers headers to be displayed on export file.
292
+ * @param int $poll_id current Form ID.
293
+ * @param Forminator_Addon_Zapier_Poll_Settings $poll_settings_instance Zapier Poll Settings instance.
294
  */
295
  $export_headers = apply_filters(
296
  'forminator_addon_zapier_poll_export_headers',
325
  * @since 1.1
326
  *
327
  * @param array $addon_meta_data
328
+ * @param int $poll_id current Poll ID.
329
+ * @param Forminator_Addon_Zapier_Poll_Settings $poll_settings_instance Zapier Poll Settings instance.
330
  */
331
  $addon_meta_data = apply_filters(
332
  'forminator_addon_zapier_poll_metadata',
344
  *
345
  * @since 1.6.1
346
  *
347
+ * @param array $export_columns column to be exported.
348
+ * @param int $poll_id current Poll ID.
349
+ * @param Forminator_Form_Entry_Model $entry_model Form Entry Model.
350
+ * @param array $addon_meta_data meta data saved by addon on entry fields.
351
+ * @param Forminator_Addon_Zapier_Poll_Settings $poll_settings_instance Zapier Poll Settings instance.
352
  */
353
  $export_columns = apply_filters(
354
  'forminator_addon_zapier_poll_export_columns',
addons/pro/zapier/class-forminator-addon-zapier-poll-settings.php CHANGED
@@ -50,7 +50,7 @@ class Forminator_Addon_Zapier_Poll_Settings extends Forminator_Addon_Poll_Settin
50
  * @return array
51
  */
52
  public function poll_settings_wizards() {
53
- // numerical array steps
54
  return array(
55
  // 0
56
  array(
@@ -183,13 +183,13 @@ class Forminator_Addon_Zapier_Poll_Settings extends Forminator_Addon_Poll_Settin
183
  throw $current_input_exception;
184
  }
185
 
186
- // must be this prefix
187
  if ( stripos( $submitted_data['webhook_url'], 'https://hooks.zapier.com/' ) !== 0 ) {
188
  $current_input_exception->add_input_exception( __( 'Please put a valid Webhook URL.', 'forminator' ), 'webhook_url_error' );
189
  throw $current_input_exception;
190
  }
191
 
192
- // must not be in silent mode
193
  if ( stripos( $submitted_data['webhook_url'], 'silent' ) !== false ) {
194
  $current_input_exception->add_input_exception( __( 'Please disable Silent Mode on Webhook URL.', 'forminator' ), 'webhook_url_error' );
195
  throw $current_input_exception;
@@ -212,8 +212,8 @@ class Forminator_Addon_Zapier_Poll_Settings extends Forminator_Addon_Poll_Settin
212
  * @since 1.6.1
213
  *
214
  * @param string $endpoint
215
- * @param int $poll_id current Form ID
216
- * @param array $connection_settings Submitted data by user, it contains `name` and `webhook_url`
217
  */
218
  $endpoint = apply_filters(
219
  'forminator_addon_zapier_poll_endpoint',
@@ -225,7 +225,7 @@ class Forminator_Addon_Zapier_Poll_Settings extends Forminator_Addon_Poll_Settin
225
  forminator_addon_maybe_log( __METHOD__, $endpoint );
226
  $api = $this->addon->get_api( $endpoint );
227
 
228
- // build form sample data
229
  $sample_data = $this->build_form_sample_data();
230
  $sample_data['is_test'] = true;
231
 
@@ -239,8 +239,8 @@ class Forminator_Addon_Zapier_Poll_Settings extends Forminator_Addon_Poll_Settin
239
  * @since 1.6.1
240
  *
241
  * @param array $sample_data
242
- * @param int $poll_id current Form ID
243
- * @param array $submitted_data Submitted data by user, it contains `name` and `webhook_url`
244
  */
245
  $sample_data = apply_filters(
246
  'forminator_addon_zapier_poll_sample_data',
@@ -285,7 +285,7 @@ class Forminator_Addon_Zapier_Poll_Settings extends Forminator_Addon_Poll_Settin
285
  );
286
  }
287
 
288
- // wrap in array as zapier best practices
289
  return array( $sample );
290
  }
291
 
@@ -344,7 +344,7 @@ class Forminator_Addon_Zapier_Poll_Settings extends Forminator_Addon_Poll_Settin
344
  foreach ( $this->get_poll_settings_values() as $key => $value ) {
345
  $multi_ids[] = array(
346
  'id' => $key,
347
- // use name that was added by user on creating connection
348
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
349
  );
350
  }
@@ -360,7 +360,7 @@ class Forminator_Addon_Zapier_Poll_Settings extends Forminator_Addon_Poll_Settin
360
  * @param array $submitted_data
361
  */
362
  public function disconnect_form( $submitted_data ) {
363
- // only execute if multi_id provided on submitted data
364
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
365
  $addon_poll_settings = $this->get_poll_settings_values();
366
  unset( $addon_poll_settings[ $submitted_data['multi_id'] ] );
50
  * @return array
51
  */
52
  public function poll_settings_wizards() {
53
+ // numerical array steps.
54
  return array(
55
  // 0
56
  array(
183
  throw $current_input_exception;
184
  }
185
 
186
+ // must be this prefix.
187
  if ( stripos( $submitted_data['webhook_url'], 'https://hooks.zapier.com/' ) !== 0 ) {
188
  $current_input_exception->add_input_exception( __( 'Please put a valid Webhook URL.', 'forminator' ), 'webhook_url_error' );
189
  throw $current_input_exception;
190
  }
191
 
192
+ // must not be in silent mode.
193
  if ( stripos( $submitted_data['webhook_url'], 'silent' ) !== false ) {
194
  $current_input_exception->add_input_exception( __( 'Please disable Silent Mode on Webhook URL.', 'forminator' ), 'webhook_url_error' );
195
  throw $current_input_exception;
212
  * @since 1.6.1
213
  *
214
  * @param string $endpoint
215
+ * @param int $poll_id current Form ID.
216
+ * @param array $connection_settings Submitted data by user, it contains `name` and `webhook_url`.
217
  */
218
  $endpoint = apply_filters(
219
  'forminator_addon_zapier_poll_endpoint',
225
  forminator_addon_maybe_log( __METHOD__, $endpoint );
226
  $api = $this->addon->get_api( $endpoint );
227
 
228
+ // build form sample data.
229
  $sample_data = $this->build_form_sample_data();
230
  $sample_data['is_test'] = true;
231
 
239
  * @since 1.6.1
240
  *
241
  * @param array $sample_data
242
+ * @param int $poll_id current Form ID.
243
+ * @param array $submitted_data Submitted data by user, it contains `name` and `webhook_url`.
244
  */
245
  $sample_data = apply_filters(
246
  'forminator_addon_zapier_poll_sample_data',
285
  );
286
  }
287
 
288
+ // wrap in array as zapier best practices.
289
  return array( $sample );
290
  }
291
 
344
  foreach ( $this->get_poll_settings_values() as $key => $value ) {
345
  $multi_ids[] = array(
346
  'id' => $key,
347
+ // use name that was added by user on creating connection.
348
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
349
  );
350
  }
360
  * @param array $submitted_data
361
  */
362
  public function disconnect_form( $submitted_data ) {
363
+ // only execute if multi_id provided on submitted data.
364
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
365
  $addon_poll_settings = $this->get_poll_settings_values();
366
  unset( $addon_poll_settings[ $submitted_data['multi_id'] ] );
addons/pro/zapier/class-forminator-addon-zapier-quiz-hooks.php CHANGED
@@ -63,8 +63,8 @@ class Forminator_Addon_Zapier_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
63
  * @since 1.6.2
64
  *
65
  * @param array $submitted_data
66
- * @param int $quiz_id current Form ID
67
- * @param Forminator_Addon_Zapier_Quiz_Settings $quiz_settings_instance Zapier Addon Quiz Settings instance
68
  */
69
  $submitted_data = apply_filters(
70
  'forminator_addon_zapier_quiz_submitted_data',
@@ -85,14 +85,14 @@ class Forminator_Addon_Zapier_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
85
  *
86
  * @since 1.6.2
87
  *
88
- * @param int $quiz_id current Quiz ID
89
  * @param array $submitted_data
90
- * @param Forminator_Addon_Zapier_Quiz_Settings $quiz_settings_instance Zapier Addon Quiz Settings instance
91
  */
92
  do_action( 'forminator_addon_zapier_quiz_before_post_to_webhook', $quiz_id, $submitted_data, $quiz_settings_instance );
93
 
94
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
95
- // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to zapier
96
  $data[] = array(
97
  'name' => 'status-' . $key,
98
  'value' => $this->get_status_on_send_data( $key, $submitted_data, $addon_setting_value, $quiz_settings, $current_entry_fields ),
@@ -106,9 +106,9 @@ class Forminator_Addon_Zapier_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
106
  * @since 1.6.2
107
  *
108
  * @param array $entry_fields
109
- * @param int $quiz_id current Quiz ID
110
  * @param array $submitted_data
111
- * @param Forminator_Addon_Zapier_Quiz_Settings $quiz_settings_instance Zapier Quiz Settings instance
112
  */
113
  $data = apply_filters(
114
  'forminator_addon_zapier_quiz_entry_fields',
@@ -136,7 +136,7 @@ class Forminator_Addon_Zapier_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
136
  * @return array `is_sent` true means its success send data to zapier, false otherwise
137
  */
138
  private function get_status_on_send_data( $connection_id, $submitted_data, $connection_settings, $quiz_settings, $current_entry_fields ) {
139
- // initialize as null
140
  $zapier_api = null;
141
 
142
  $quiz_id = $this->quiz_id;
@@ -155,8 +155,8 @@ class Forminator_Addon_Zapier_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
155
  * @since 1.6.2
156
  *
157
  * @param string $endpoint
158
- * @param int $quiz_id current Form ID
159
- * @param array $connection_settings current connection setting, it contains `name` and `webhook_url`
160
  */
161
  $endpoint = apply_filters(
162
  'forminator_addon_zapier_quiz_endpoint',
@@ -175,12 +175,12 @@ class Forminator_Addon_Zapier_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
175
  * @since 1.6.2
176
  *
177
  * @param array $args
178
- * @param int $quiz_id Current Quiz id
179
- * @param string $connection_id ID of current connection
180
  * @param array $submitted_data
181
- * @param array $connection_settings current connection setting, contains `name` and `webhook_url`
182
- * @param array $quiz_settings Displayed Quiz settings
183
- * @param Forminator_Addon_Zapier_Quiz_Settings $quiz_settings_instance Zapier Quiz Settings instance
184
  */
185
  $args = apply_filters(
186
  'forminator_addon_zapier_quiz_post_to_webhook_args',
@@ -246,11 +246,11 @@ class Forminator_Addon_Zapier_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
246
  if ( isset( $quiz_entry['name'] ) && isset( $quiz_entry['value'] ) && 'entry' === $quiz_entry['name'] ) {
247
  if ( is_array( $quiz_entry['value'] ) ) {
248
 
249
- // KNOWLEDGE
250
  if ( 'knowledge' === $this->quiz->quiz_type ) {
251
  foreach ( $quiz_entry['value'] as $key => $data ) {
252
  $question_id = ( ( isset( $questions[ $key ] ) && isset( $questions[ $key ]['slug'] ) ) ? $questions[ $key ]['slug'] : uniqid() );
253
- // bit cleanup
254
  $question_id = str_replace( 'question-', '', $question_id );
255
 
256
  $question = isset( $data['question'] ) ? $data['question'] : '';
@@ -281,7 +281,7 @@ class Forminator_Addon_Zapier_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
281
 
282
  foreach ( $entry_questions as $key => $entry_question ) {
283
  $question_id = ( ( isset( $questions[ $key ] ) && isset( $questions[ $key ]['slug'] ) ) ? $questions[ $key ]['slug'] : uniqid() );
284
- // bit cleanup
285
  $question_id = str_replace( 'question-', '', $question_id );
286
 
287
  $question = isset( $entry_question['question'] ) ? $entry_question['question'] : '';
@@ -321,7 +321,7 @@ class Forminator_Addon_Zapier_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
321
  }
322
  }
323
 
324
- // wrap in array as zapier best practices
325
  return array( $sample );
326
  }
327
 
@@ -346,9 +346,9 @@ class Forminator_Addon_Zapier_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
346
  *
347
  * @since 1.6.2
348
  *
349
- * @param array $export_headers headers to be displayed on export file
350
- * @param int $quiz_id current Form ID
351
- * @param Forminator_Addon_Zapier_Quiz_Settings $quiz_settings_instance Zapier Quiz Settings instance
352
  */
353
  $export_headers = apply_filters(
354
  'forminator_addon_zapier_quiz_export_headers',
@@ -383,8 +383,8 @@ class Forminator_Addon_Zapier_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
383
  * @since 1.1
384
  *
385
  * @param array $addon_meta_data
386
- * @param int $quiz_id current Quiz ID
387
- * @param Forminator_Addon_Zapier_Quiz_Settings $quiz_settings_instance Zapier Quiz Settings instance
388
  */
389
  $addon_meta_data = apply_filters(
390
  'forminator_addon_zapier_quiz_metadata',
@@ -402,11 +402,11 @@ class Forminator_Addon_Zapier_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
402
  *
403
  * @since 1.6.2
404
  *
405
- * @param array $export_columns column to be exported
406
- * @param int $quiz_id current Quiz ID
407
- * @param Forminator_Form_Entry_Model $entry_model Form Entry Model
408
- * @param array $addon_meta_data meta data saved by addon on entry fields
409
- * @param Forminator_Addon_Zapier_Quiz_Settings $quiz_settings_instance Zapier Quiz Settings instance
410
  */
411
  $export_columns = apply_filters(
412
  'forminator_addon_zapier_quiz_export_columns',
@@ -443,8 +443,8 @@ class Forminator_Addon_Zapier_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
443
  * @since 1.6.2
444
  *
445
  * @param array $addon_meta_data
446
- * @param int $quiz_id current Quiz ID
447
- * @param Forminator_Addon_Zapier_Quiz_Settings $quiz_settings_instance Zapier Addon Quiz Settings instance
448
  */
449
  $addon_meta_data = apply_filters(
450
  'forminator_addon_quiz_zapier_metadata',
@@ -532,7 +532,7 @@ class Forminator_Addon_Zapier_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
532
  }
533
 
534
  if ( Forminator_Addon_Zapier::is_show_full_log() ) {
535
- // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_ZAPIER_SHOW_FULL_LOG', true)`
536
  if ( isset( $status['url_request'] ) ) {
537
  $sub_entries[] = array(
538
  'label' => __( 'API URL', 'forminator' ),
@@ -557,7 +557,7 @@ class Forminator_Addon_Zapier_Quiz_Hooks extends Forminator_Addon_Quiz_Hooks_Abs
557
 
558
  $additional_entry_item['sub_entries'] = $sub_entries;
559
 
560
- // return single array
561
  return $additional_entry_item;
562
  }
563
  }
63
  * @since 1.6.2
64
  *
65
  * @param array $submitted_data
66
+ * @param int $quiz_id current Form ID.
67
+ * @param Forminator_Addon_Zapier_Quiz_Settings $quiz_settings_instance Zapier Addon Quiz Settings instance.
68
  */
69
  $submitted_data = apply_filters(
70
  'forminator_addon_zapier_quiz_submitted_data',
85
  *
86
  * @since 1.6.2
87
  *
88
+ * @param int $quiz_id current Quiz ID.
89
  * @param array $submitted_data
90
+ * @param Forminator_Addon_Zapier_Quiz_Settings $quiz_settings_instance Zapier Addon Quiz Settings instance.
91
  */
92
  do_action( 'forminator_addon_zapier_quiz_before_post_to_webhook', $quiz_id, $submitted_data, $quiz_settings_instance );
93
 
94
  foreach ( $addon_setting_values as $key => $addon_setting_value ) {
95
+ // save it on entry field, with name `status-$MULTI_ID`, and value is the return result on sending data to zapier.
96
  $data[] = array(
97
  'name' => 'status-' . $key,
98
  'value' => $this->get_status_on_send_data( $key, $submitted_data, $addon_setting_value, $quiz_settings, $current_entry_fields ),
106
  * @since 1.6.2
107
  *
108
  * @param array $entry_fields
109
+ * @param int $quiz_id current Quiz ID.
110
  * @param array $submitted_data
111
+ * @param Forminator_Addon_Zapier_Quiz_Settings $quiz_settings_instance Zapier Quiz Settings instance.
112
  */
113
  $data = apply_filters(
114
  'forminator_addon_zapier_quiz_entry_fields',
136
  * @return array `is_sent` true means its success send data to zapier, false otherwise
137
  */
138
  private function get_status_on_send_data( $connection_id, $submitted_data, $connection_settings, $quiz_settings, $current_entry_fields ) {
139
+ // initialize as null.
140
  $zapier_api = null;
141
 
142
  $quiz_id = $this->quiz_id;
155
  * @since 1.6.2
156
  *
157
  * @param string $endpoint
158
+ * @param int $quiz_id current Form ID.
159
+ * @param array $connection_settings current connection setting, it contains `name` and `webhook_url`.
160
  */
161
  $endpoint = apply_filters(
162
  'forminator_addon_zapier_quiz_endpoint',
175
  * @since 1.6.2
176
  *
177
  * @param array $args
178
+ * @param int $quiz_id Current Quiz id.
179
+ * @param string $connection_id ID of current connection.
180
  * @param array $submitted_data
181
+ * @param array $connection_settings current connection setting, contains `name` and `webhook_url`.
182
+ * @param array $quiz_settings Displayed Quiz settings.
183
+ * @param Forminator_Addon_Zapier_Quiz_Settings $quiz_settings_instance Zapier Quiz Settings instance.
184
  */
185
  $args = apply_filters(
186
  'forminator_addon_zapier_quiz_post_to_webhook_args',
246
  if ( isset( $quiz_entry['name'] ) && isset( $quiz_entry['value'] ) && 'entry' === $quiz_entry['name'] ) {
247
  if ( is_array( $quiz_entry['value'] ) ) {
248
 
249
+ // KNOWLEDGE.
250
  if ( 'knowledge' === $this->quiz->quiz_type ) {
251
  foreach ( $quiz_entry['value'] as $key => $data ) {
252
  $question_id = ( ( isset( $questions[ $key ] ) && isset( $questions[ $key ]['slug'] ) ) ? $questions[ $key ]['slug'] : uniqid() );
253
+ // bit cleanup.
254
  $question_id = str_replace( 'question-', '', $question_id );
255
 
256
  $question = isset( $data['question'] ) ? $data['question'] : '';
281
 
282
  foreach ( $entry_questions as $key => $entry_question ) {
283
  $question_id = ( ( isset( $questions[ $key ] ) && isset( $questions[ $key ]['slug'] ) ) ? $questions[ $key ]['slug'] : uniqid() );
284
+ // bit cleanup.
285
  $question_id = str_replace( 'question-', '', $question_id );
286
 
287
  $question = isset( $entry_question['question'] ) ? $entry_question['question'] : '';
321
  }
322
  }
323
 
324
+ // wrap in array as zapier best practices.
325
  return array( $sample );
326
  }
327
 
346
  *
347
  * @since 1.6.2
348
  *
349
+ * @param array $export_headers headers to be displayed on export file.
350
+ * @param int $quiz_id current Form ID.
351
+ * @param Forminator_Addon_Zapier_Quiz_Settings $quiz_settings_instance Zapier Quiz Settings instance.
352
  */
353
  $export_headers = apply_filters(
354
  'forminator_addon_zapier_quiz_export_headers',
383
  * @since 1.1
384
  *
385
  * @param array $addon_meta_data
386
+ * @param int $quiz_id current Quiz ID.
387
+ * @param Forminator_Addon_Zapier_Quiz_Settings $quiz_settings_instance Zapier Quiz Settings instance.
388
  */
389
  $addon_meta_data = apply_filters(
390
  'forminator_addon_zapier_quiz_metadata',
402
  *
403
  * @since 1.6.2
404
  *
405
+ * @param array $export_columns column to be exported.
406
+ * @param int $quiz_id current Quiz ID.
407
+ * @param Forminator_Form_Entry_Model $entry_model Form Entry Model.
408
+ * @param array $addon_meta_data meta data saved by addon on entry fields.
409
+ * @param Forminator_Addon_Zapier_Quiz_Settings $quiz_settings_instance Zapier Quiz Settings instance.
410
  */
411
  $export_columns = apply_filters(
412
  'forminator_addon_zapier_quiz_export_columns',
443
  * @since 1.6.2
444
  *
445
  * @param array $addon_meta_data
446
+ * @param int $quiz_id current Quiz ID.
447
+ * @param Forminator_Addon_Zapier_Quiz_Settings $quiz_settings_instance Zapier Addon Quiz Settings instance.
448
  */
449
  $addon_meta_data = apply_filters(
450
  'forminator_addon_quiz_zapier_metadata',
532
  }
533
 
534
  if ( Forminator_Addon_Zapier::is_show_full_log() ) {
535
+ // too long to be added on entry data enable this with `define('FORMINATOR_ADDON_ZAPIER_SHOW_FULL_LOG', true)`.
536
  if ( isset( $status['url_request'] ) ) {
537
  $sub_entries[] = array(
538
  'label' => __( 'API URL', 'forminator' ),
557
 
558
  $additional_entry_item['sub_entries'] = $sub_entries;
559
 
560
+ // return single array.
561
  return $additional_entry_item;
562
  }
563
  }
addons/pro/zapier/class-forminator-addon-zapier-quiz-settings.php CHANGED
@@ -50,7 +50,7 @@ class Forminator_Addon_Zapier_Quiz_Settings extends Forminator_Addon_Quiz_Settin
50
  * @return array
51
  */
52
  public function quiz_settings_wizards() {
53
- // numerical array steps
54
  return array(
55
  // 0
56
  array(
@@ -183,13 +183,13 @@ class Forminator_Addon_Zapier_Quiz_Settings extends Forminator_Addon_Quiz_Settin
183
  throw $current_input_exception;
184
  }
185
 
186
- // must be this prefix
187
  if ( stripos( $submitted_data['webhook_url'], 'https://hooks.zapier.com/' ) !== 0 ) {
188
  $current_input_exception->add_input_exception( __( 'Please put a valid Webhook URL.', 'forminator' ), 'webhook_url_error' );
189
  throw $current_input_exception;
190
  }
191
 
192
- // must not be in silent mode
193
  if ( stripos( $submitted_data['webhook_url'], 'silent' ) !== false ) {
194
  $current_input_exception->add_input_exception( __( 'Please disable Silent Mode on Webhook URL.', 'forminator' ), 'webhook_url_error' );
195
  throw $current_input_exception;
@@ -212,8 +212,8 @@ class Forminator_Addon_Zapier_Quiz_Settings extends Forminator_Addon_Quiz_Settin
212
  * @since 1.6.2
213
  *
214
  * @param string $endpoint
215
- * @param int $quiz_id current Form ID
216
- * @param array $connection_settings Submitted data by user, it contains `name` and `webhook_url`
217
  */
218
  $endpoint = apply_filters(
219
  'forminator_addon_zapier_quiz_endpoint',
@@ -225,7 +225,7 @@ class Forminator_Addon_Zapier_Quiz_Settings extends Forminator_Addon_Quiz_Settin
225
  forminator_addon_maybe_log( __METHOD__, $endpoint );
226
  $api = $this->addon->get_api( $endpoint );
227
 
228
- // build form sample data
229
  $sample_data = $this->build_form_sample_data();
230
  $sample_data['is_test'] = true;
231
 
@@ -239,8 +239,8 @@ class Forminator_Addon_Zapier_Quiz_Settings extends Forminator_Addon_Quiz_Settin
239
  * @since 1.6.2
240
  *
241
  * @param array $sample_data
242
- * @param int $quiz_id current Form ID
243
- * @param array $submitted_data Submitted data by user, it contains `name` and `webhook_url`
244
  */
245
  $sample_data = apply_filters(
246
  'forminator_addon_zapier_quiz_sample_data',
@@ -273,7 +273,7 @@ class Forminator_Addon_Zapier_Quiz_Settings extends Forminator_Addon_Quiz_Settin
273
  $question_title = isset( $question['title'] ) ? $question['title'] : '';
274
  $question_id = isset( $question['slug'] ) ? $question['slug'] : uniqid();
275
 
276
- // bit cleanup
277
  $question_id = str_replace( 'question-', '', $question_id );
278
  $answer_title = 'Sample Answer';
279
 
@@ -333,7 +333,7 @@ class Forminator_Addon_Zapier_Quiz_Settings extends Forminator_Addon_Quiz_Settin
333
  }
334
  }
335
 
336
- // wrap in array as zapier best practices
337
  return array( $sample );
338
  }
339
 
@@ -392,7 +392,7 @@ class Forminator_Addon_Zapier_Quiz_Settings extends Forminator_Addon_Quiz_Settin
392
  foreach ( $this->get_quiz_settings_values() as $key => $value ) {
393
  $multi_ids[] = array(
394
  'id' => $key,
395
- // use name that was added by user on creating connection
396
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
397
  );
398
  }
@@ -408,7 +408,7 @@ class Forminator_Addon_Zapier_Quiz_Settings extends Forminator_Addon_Quiz_Settin
408
  * @param array $submitted_data
409
  */
410
  public function disconnect_form( $submitted_data ) {
411
- // only execute if multi_id provided on submitted data
412
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
413
  $addon_quiz_settings = $this->get_quiz_settings_values();
414
  unset( $addon_quiz_settings[ $submitted_data['multi_id'] ] );
50
  * @return array
51
  */
52
  public function quiz_settings_wizards() {
53
+ // numerical array steps.
54
  return array(
55
  // 0
56
  array(
183
  throw $current_input_exception;
184
  }
185
 
186
+ // must be this prefix.
187
  if ( stripos( $submitted_data['webhook_url'], 'https://hooks.zapier.com/' ) !== 0 ) {
188
  $current_input_exception->add_input_exception( __( 'Please put a valid Webhook URL.', 'forminator' ), 'webhook_url_error' );
189
  throw $current_input_exception;
190
  }
191
 
192
+ // must not be in silent mode.
193
  if ( stripos( $submitted_data['webhook_url'], 'silent' ) !== false ) {
194
  $current_input_exception->add_input_exception( __( 'Please disable Silent Mode on Webhook URL.', 'forminator' ), 'webhook_url_error' );
195
  throw $current_input_exception;
212
  * @since 1.6.2
213
  *
214
  * @param string $endpoint
215
+ * @param int $quiz_id current Form ID.
216
+ * @param array $connection_settings Submitted data by user, it contains `name` and `webhook_url`.
217
  */
218
  $endpoint = apply_filters(
219
  'forminator_addon_zapier_quiz_endpoint',
225
  forminator_addon_maybe_log( __METHOD__, $endpoint );
226
  $api = $this->addon->get_api( $endpoint );
227
 
228
+ // build form sample data.
229
  $sample_data = $this->build_form_sample_data();
230
  $sample_data['is_test'] = true;
231
 
239
  * @since 1.6.2
240
  *
241
  * @param array $sample_data
242
+ * @param int $quiz_id current Form ID.
243
+ * @param array $submitted_data Submitted data by user, it contains `name` and `webhook_url`.
244
  */
245
  $sample_data = apply_filters(
246
  'forminator_addon_zapier_quiz_sample_data',
273
  $question_title = isset( $question['title'] ) ? $question['title'] : '';
274
  $question_id = isset( $question['slug'] ) ? $question['slug'] : uniqid();
275
 
276
+ // bit cleanup.
277
  $question_id = str_replace( 'question-', '', $question_id );
278
  $answer_title = 'Sample Answer';
279
 
333
  }
334
  }
335
 
336
+ // wrap in array as zapier best practices.
337
  return array( $sample );
338
  }
339
 
392
  foreach ( $this->get_quiz_settings_values() as $key => $value ) {
393
  $multi_ids[] = array(
394
  'id' => $key,
395
+ // use name that was added by user on creating connection.
396
  'label' => isset( $value['name'] ) ? $value['name'] : $key,
397
  );
398
  }
408
  * @param array $submitted_data
409
  */
410
  public function disconnect_form( $submitted_data ) {
411
+ // only execute if multi_id provided on submitted data.
412
  if ( isset( $submitted_data['multi_id'] ) && ! empty( $submitted_data['multi_id'] ) ) {
413
  $addon_quiz_settings = $this->get_quiz_settings_values();
414
  unset( $addon_quiz_settings[ $submitted_data['multi_id'] ] );
addons/pro/zapier/class-forminator-addon-zapier.php CHANGED
@@ -41,7 +41,7 @@ final class Forminator_Addon_Zapier extends Forminator_Addon_Abstract {
41
  * @since 1.0 Zapier Addon
42
  */
43
  public function __construct() {
44
- // late init to allow translation
45
  $this->_description = __( 'Make your form Zap-able', 'forminator' );
46
  $doc_description = forminator_is_show_addons_documentation_link() ?
47
  sprintf(
@@ -150,7 +150,7 @@ final class Forminator_Addon_Zapier extends Forminator_Addon_Abstract {
150
  throw new Forminator_Addon_Zapier_Exception( Forminator_Addon_Loader::get_instance()->get_last_error_message() );
151
  }
152
  }
153
- // no form_id its on global settings
154
  if ( empty( $form_id ) ) {
155
  $show_success = true;
156
  }
@@ -200,7 +200,7 @@ final class Forminator_Addon_Zapier extends Forminator_Addon_Abstract {
200
  */
201
  public function is_connected() {
202
  try {
203
- // check if its active
204
  if ( ! $this->is_active() ) {
205
  throw new Forminator_Addon_Zapier_Exception( __( 'Zapier is not active', 'forminator' ) );
206
  }
@@ -242,7 +242,7 @@ final class Forminator_Addon_Zapier extends Forminator_Addon_Abstract {
242
  throw new Forminator_Addon_Zapier_Exception( __( 'Invalid Form Settings of Zapier', 'forminator' ) );
243
  }
244
 
245
- // Mark as active when there is at least one active connection
246
  if ( false === $form_settings_instance->find_one_active_connection() ) {
247
  throw new Forminator_Addon_Zapier_Exception( __( 'No active Zapier connection found in this form', 'forminator' ) );
248
  }
@@ -260,8 +260,8 @@ final class Forminator_Addon_Zapier extends Forminator_Addon_Abstract {
260
  * @since 1.1
261
  *
262
  * @param bool $is_form_connected
263
- * @param int $form_id Current Form ID
264
- * @param Forminator_Addon_Zapier_Form_Settings|null $form_settings_instance Instance of form settings, or null when unavailable
265
  *
266
  */
267
  $is_form_connected = apply_filters( 'forminator_addon_zapier_is_form_connected', $is_form_connected, $form_id, $form_settings_instance );
@@ -330,7 +330,7 @@ final class Forminator_Addon_Zapier extends Forminator_Addon_Abstract {
330
  throw new Forminator_Addon_Zapier_Exception( 'Zapier Poll Settings of Trello' );
331
  }
332
 
333
- // Mark as active when there is at least one active connection
334
  if ( false === $poll_settings_instance->find_one_active_connection() ) {
335
  throw new Forminator_Addon_Zapier_Exception( 'No active Poll connection found in this poll' );
336
  }
@@ -348,8 +348,8 @@ final class Forminator_Addon_Zapier extends Forminator_Addon_Abstract {
348
  * @since 1.6.1
349
  *
350
  * @param bool $is_poll_connected
351
- * @param int $poll_id Current Poll ID
352
- * @param Forminator_Addon_Trello_Poll_Settings|null $poll_settings_instance Instance of poll settings, or null when unavailable
353
  *
354
  */
355
  $is_poll_connected = apply_filters( 'forminator_addon_zapier_is_poll_connected', $is_poll_connected, $poll_id, $poll_settings_instance );
@@ -390,7 +390,7 @@ final class Forminator_Addon_Zapier extends Forminator_Addon_Abstract {
390
  throw new Forminator_Addon_Zapier_Exception( 'Zapier Quiz Settings of Trello' );
391
  }
392
 
393
- // Mark as active when there is at least one active connection
394
  if ( false === $quiz_settings_instance->find_one_active_connection() ) {
395
  throw new Forminator_Addon_Zapier_Exception( 'No active Zapier connection found in this quiz' );
396
  }
@@ -408,8 +408,8 @@ final class Forminator_Addon_Zapier extends Forminator_Addon_Abstract {
408
  * @since 1.6.2
409
  *
410
  * @param bool $is_quiz_connected
411
- * @param int $quiz_id Current Quiz ID
412
- * @param Forminator_Addon_Trello_Quiz_Settings|null $quiz_settings_instance Instance of quiz settings, or null when unavailable
413
  *
414
  */
415
  $is_quiz_connected = apply_filters( 'forminator_addon_zapier_is_quiz_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
41
  * @since 1.0 Zapier Addon
42
  */
43
  public function __construct() {
44
+ // late init to allow translation.
45
  $this->_description = __( 'Make your form Zap-able', 'forminator' );
46
  $doc_description = forminator_is_show_addons_documentation_link() ?
47
  sprintf(
150
  throw new Forminator_Addon_Zapier_Exception( Forminator_Addon_Loader::get_instance()->get_last_error_message() );
151
  }
152
  }
153
+ // no form_id its on global settings.
154
  if ( empty( $form_id ) ) {
155
  $show_success = true;
156
  }
200
  */
201
  public function is_connected() {
202
  try {
203
+ // check if its active.
204
  if ( ! $this->is_active() ) {
205
  throw new Forminator_Addon_Zapier_Exception( __( 'Zapier is not active', 'forminator' ) );
206
  }
242
  throw new Forminator_Addon_Zapier_Exception( __( 'Invalid Form Settings of Zapier', 'forminator' ) );
243
  }
244
 
245
+ // Mark as active when there is at least one active connection.
246
  if ( false === $form_settings_instance->find_one_active_connection() ) {
247
  throw new Forminator_Addon_Zapier_Exception( __( 'No active Zapier connection found in this form', 'forminator' ) );
248
  }
260
  * @since 1.1
261
  *
262
  * @param bool $is_form_connected
263
+ * @param int $form_id Current Form ID.
264
+ * @param Forminator_Addon_Zapier_Form_Settings|null $form_settings_instance Instance of form settings, or null when unavailable.
265
  *
266
  */
267
  $is_form_connected = apply_filters( 'forminator_addon_zapier_is_form_connected', $is_form_connected, $form_id, $form_settings_instance );
330
  throw new Forminator_Addon_Zapier_Exception( 'Zapier Poll Settings of Trello' );
331
  }
332
 
333
+ // Mark as active when there is at least one active connection.
334
  if ( false === $poll_settings_instance->find_one_active_connection() ) {
335
  throw new Forminator_Addon_Zapier_Exception( 'No active Poll connection found in this poll' );
336
  }
348
  * @since 1.6.1
349
  *
350
  * @param bool $is_poll_connected
351
+ * @param int $poll_id Current Poll ID.
352
+ * @param Forminator_Addon_Trello_Poll_Settings|null $poll_settings_instance Instance of poll settings, or null when unavailable.
353
  *
354
  */
355
  $is_poll_connected = apply_filters( 'forminator_addon_zapier_is_poll_connected', $is_poll_connected, $poll_id, $poll_settings_instance );
390
  throw new Forminator_Addon_Zapier_Exception( 'Zapier Quiz Settings of Trello' );
391
  }
392
 
393
+ // Mark as active when there is at least one active connection.
394
  if ( false === $quiz_settings_instance->find_one_active_connection() ) {
395
  throw new Forminator_Addon_Zapier_Exception( 'No active Zapier connection found in this quiz' );
396
  }
408
  * @since 1.6.2
409
  *
410
  * @param bool $is_quiz_connected
411
+ * @param int $quiz_id Current Quiz ID.
412
+ * @param Forminator_Addon_Trello_Quiz_Settings|null $quiz_settings_instance Instance of quiz settings, or null when unavailable.
413
  *
414
  */
415
  $is_quiz_connected = apply_filters( 'forminator_addon_zapier_is_quiz_connected', $is_quiz_connected, $quiz_id, $quiz_settings_instance );
addons/pro/zapier/lib/class-forminator-addon-zapier-wp-api.php CHANGED
@@ -102,7 +102,7 @@ class Forminator_Addon_Zapier_Wp_Api {
102
  *
103
  * @since 1.1
104
  *
105
- * @param string $user_agent current user agent
106
  */
107
  $user_agent = apply_filters( 'forminator_addon_zapier_api_user_agent', $user_agent );
108
 
@@ -123,7 +123,7 @@ class Forminator_Addon_Zapier_Wp_Api {
123
  * @throws Forminator_Addon_Zapier_Wp_Api_Not_Found_Exception
124
  */
125
  private function request( $verb, $path, $args = array() ) {
126
- // Adding extra user agent for wp remote request
127
  add_filter( 'http_headers_useragent', array( $this, 'filter_user_agent' ) );
128
 
129
  $url = trailingslashit( $this->_endpoint ) . $path;
@@ -134,10 +134,10 @@ class Forminator_Addon_Zapier_Wp_Api {
134
  *
135
  * @since 1.1
136
  *
137
- * @param string $url full url with scheme
138
- * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`
139
- * @param string $path requested path resource
140
- * @param array $args argument sent to this function
141
  */
142
  $url = apply_filters( 'forminator_addon_zapier_api_url', $url, $verb, $path, $args );
143
 
@@ -154,9 +154,9 @@ class Forminator_Addon_Zapier_Wp_Api {
154
  * @since 1.1
155
  *
156
  * @param array $headers
157
- * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`
158
- * @param string $path requested path resource
159
- * @param array $args argument sent to this function
160
  */
161
  $headers = apply_filters( 'forminator_addon_zapier_api_request_headers', $headers, $verb, $path, $args );
162
 
@@ -165,13 +165,13 @@ class Forminator_Addon_Zapier_Wp_Api {
165
  'headers' => $headers,
166
  );
167
 
168
- // X-Hook-Test handler
169
  if ( isset( $args['is_test'] ) ) {
170
  if ( true === $args['is_test'] ) {
171
- // Add `X-Hook-Test` header to avoid execute task on zapier
172
  $_args['headers']['X-Hook-Test'] = 'true';
173
  }
174
- // always unset when exist
175
  unset( $args['is_test'] );
176
  }
177
 
@@ -181,9 +181,9 @@ class Forminator_Addon_Zapier_Wp_Api {
181
  *
182
  * @since 1.1
183
  *
184
- * @param array $request_data it will be `http_build_query`-ed when `GET` or `wp_json_encode`-ed otherwise
185
- * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`
186
- * @param string $path requested path resource
187
  */
188
  $args = apply_filters( 'forminator_addon_zapier_api_request_data', $request_data, $verb, $path );
189
 
@@ -226,7 +226,7 @@ class Forminator_Addon_Zapier_Wp_Api {
226
 
227
  $body = wp_remote_retrieve_body( $res );
228
 
229
- // probably silent mode
230
  if ( ! empty( $body ) ) {
231
  $res = json_decode( $body );
232
  }
@@ -237,9 +237,9 @@ class Forminator_Addon_Zapier_Wp_Api {
237
  *
238
  * @since 1.1
239
  *
240
- * @param mixed $response original wp remote request response or decoded body if available
241
- * @param string $body original content of http response's body
242
- * @param array|WP_Error $wp_response original wp remote request response
243
  */
244
  $res = apply_filters( 'forminator_addon_zapier_api_response', $response, $body, $wp_response );
245
 
102
  *
103
  * @since 1.1
104
  *
105
+ * @param string $user_agent current user agent.
106
  */
107
  $user_agent = apply_filters( 'forminator_addon_zapier_api_user_agent', $user_agent );
108
 
123
  * @throws Forminator_Addon_Zapier_Wp_Api_Not_Found_Exception
124
  */
125
  private function request( $verb, $path, $args = array() ) {
126
+ // Adding extra user agent for wp remote request.
127
  add_filter( 'http_headers_useragent', array( $this, 'filter_user_agent' ) );
128
 
129
  $url = trailingslashit( $this->_endpoint ) . $path;
134
  *
135
  * @since 1.1
136
  *
137
+ * @param string $url full url with scheme.
138
+ * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`.
139
+ * @param string $path requested path resource.
140
+ * @param array $args argument sent to this function.
141
  */
142
  $url = apply_filters( 'forminator_addon_zapier_api_url', $url, $verb, $path, $args );
143
 
154
  * @since 1.1
155
  *
156
  * @param array $headers
157
+ * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`.
158
+ * @param string $path requested path resource.
159
+ * @param array $args argument sent to this function.
160
  */
161
  $headers = apply_filters( 'forminator_addon_zapier_api_request_headers', $headers, $verb, $path, $args );
162
 
165
  'headers' => $headers,
166
  );
167
 
168
+ // X-Hook-Test handler.
169
  if ( isset( $args['is_test'] ) ) {
170
  if ( true === $args['is_test'] ) {
171
+ // Add `X-Hook-Test` header to avoid execute task on zapier.
172
  $_args['headers']['X-Hook-Test'] = 'true';
173
  }
174
+ // always unset when exist.
175
  unset( $args['is_test'] );
176
  }
177
 
181
  *
182
  * @since 1.1
183
  *
184
+ * @param array $request_data it will be `http_build_query`-ed when `GET` or `wp_json_encode`-ed otherwise.
185
+ * @param string $verb `GET` `POST` `PUT` `DELETE` `PATCH`.
186
+ * @param string $path requested path resource.
187
  */
188
  $args = apply_filters( 'forminator_addon_zapier_api_request_data', $request_data, $verb, $path );
189
 
226
 
227
  $body = wp_remote_retrieve_body( $res );
228
 
229
+ // probably silent mode.
230
  if ( ! empty( $body ) ) {
231
  $res = json_decode( $body );
232
  }
237
  *
238
  * @since 1.1
239
  *
240
+ * @param mixed $response original wp remote request response or decoded body if available.
241
+ * @param string $body original content of http response's body.
242
+ * @param array|WP_Error $wp_response original wp remote request response.
243
  */
244
  $res = apply_filters( 'forminator_addon_zapier_api_response', $response, $body, $wp_response );
245
 
addons/pro/zapier/views/poll-settings/setup-webhook.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
addons/pro/zapier/views/quiz-settings/setup-webhook.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'name' => '',
addons/pro/zapier/views/settings/setup-connect.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // Defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'is_connected' => false,
1
  <?php
2
+ // Defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'is_connected' => false,
admin/abstracts/class-admin-import-mediator.php CHANGED
@@ -46,10 +46,13 @@ abstract class Forminator_Import_Mediator {
46
  public function replace_invalid_tags( $mayhavetags, $tags = array() ) {
47
 
48
  if ( ! empty( $tags ) ) {
49
- $tags = array_merge( $tags, array(
50
- '{all_fields_table}' => '{all_fields}',
51
- '{referer}' => '{referer_url}'
52
- ) );
 
 
 
53
  }
54
 
55
  $mayhavetags = strtr( $mayhavetags, $tags );
@@ -69,19 +72,19 @@ abstract class Forminator_Import_Mediator {
69
  if ( ! empty( $tags ) ) {
70
  switch ( $tags ) {
71
  case 'user_login':
72
- $value = "wp_user.login";
73
  break;
74
  case 'user_email':
75
- $value = "wp_user.email";
76
  break;
77
  case 'user_first_name':
78
- $value = "wp_user.first_name";
79
  break;
80
  case 'user_last_name':
81
- $value = "wp_user.last_name";
82
  break;
83
  case 'user_display_name':
84
- $value = "wp_user.display_name";
85
  break;
86
  default:
87
  break;
@@ -94,13 +97,12 @@ abstract class Forminator_Import_Mediator {
94
  /**
95
  * Default form fields
96
  *
97
- *
98
  * @since 1.7
99
  *
100
  * @return array
101
  */
102
  public static function default_fields() {
103
- //todo: check if defaults are available
104
  $fields = array(
105
  'name',
106
  'email',
@@ -129,7 +131,7 @@ abstract class Forminator_Import_Mediator {
129
  'gdprcheckbox',
130
  'honeypot',
131
  'captcha',
132
- 'submit'
133
  );
134
 
135
  return apply_filters( 'forminator_default_fields', $fields );
@@ -138,13 +140,12 @@ abstract class Forminator_Import_Mediator {
138
  /**
139
  * Return random number
140
  *
141
- *
142
  * @since 1.7
143
  * @return int random number
144
  */
145
  public function random_wrapper_int() {
146
- //get all forms
147
- $int = intval( (float)rand()/(float)getrandmax() * 9999 );
148
 
149
  return absint( $int );
150
  }
@@ -243,7 +244,6 @@ abstract class Forminator_Import_Mediator {
243
 
244
  $model = Forminator_Form_Model::create_from_import_data( $import_data );
245
 
246
-
247
  if ( is_wp_error( $model ) ) {
248
  throw new Exception( $model->get_error_message() );
249
  }
@@ -257,13 +257,13 @@ abstract class Forminator_Import_Mediator {
257
  return array(
258
  'id' => $model->id,
259
  'url' => $return_url,
260
- 'type' => 'success'
261
  );
262
 
263
  } catch ( Exception $e ) {
264
  return array(
265
  'message' => $e->getMessage(),
266
- 'type' => 'fail'
267
  );
268
  }
269
  }
46
  public function replace_invalid_tags( $mayhavetags, $tags = array() ) {
47
 
48
  if ( ! empty( $tags ) ) {
49
+ $tags = array_merge(
50
+ $tags,
51
+ array(
52
+ '{all_fields_table}' => '{all_fields}',
53
+ '{referer}' => '{referer_url}',
54
+ )
55
+ );
56
  }
57
 
58
  $mayhavetags = strtr( $mayhavetags, $tags );
72
  if ( ! empty( $tags ) ) {
73
  switch ( $tags ) {
74
  case 'user_login':
75
+ $value = 'wp_user.login';
76
  break;
77
  case 'user_email':
78
+ $value = 'wp_user.email';
79
  break;
80
  case 'user_first_name':
81
+ $value = 'wp_user.first_name';
82
  break;
83
  case 'user_last_name':
84
+ $value = 'wp_user.last_name';
85
  break;
86
  case 'user_display_name':
87
+ $value = 'wp_user.display_name';
88
  break;
89
  default:
90
  break;
97
  /**
98
  * Default form fields
99
  *
 
100
  * @since 1.7
101
  *
102
  * @return array
103
  */
104
  public static function default_fields() {
105
+ // todo: check if defaults are available.
106
  $fields = array(
107
  'name',
108
  'email',
131
  'gdprcheckbox',
132
  'honeypot',
133
  'captcha',
134
+ 'submit',
135
  );
136
 
137
  return apply_filters( 'forminator_default_fields', $fields );
140
  /**
141
  * Return random number
142
  *
 
143
  * @since 1.7
144
  * @return int random number
145
  */
146
  public function random_wrapper_int() {
147
+ // get all forms.
148
+ $int = intval( (float) rand() / (float) getrandmax() * 9999 );
149
 
150
  return absint( $int );
151
  }
244
 
245
  $model = Forminator_Form_Model::create_from_import_data( $import_data );
246
 
 
247
  if ( is_wp_error( $model ) ) {
248
  throw new Exception( $model->get_error_message() );
249
  }
257
  return array(
258
  'id' => $model->id,
259
  'url' => $return_url,
260
+ 'type' => 'success',
261
  );
262
 
263
  } catch ( Exception $e ) {
264
  return array(
265
  'message' => $e->getMessage(),
266
+ 'type' => 'fail',
267
  );
268
  }
269
  }
admin/abstracts/class-admin-module-edit-page.php CHANGED
@@ -23,7 +23,7 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
23
  * @since 1.0
24
  */
25
  public function init() {
26
- $pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0; // WPCS: CSRF OK
27
  self::$page_number = max( 1, $pagenum );
28
  $this->processRequest();
29
  }
@@ -32,7 +32,7 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
32
  * Trigger before render
33
  */
34
  public function before_render() {
35
- wp_enqueue_script( 'forminator-chart', forminator_plugin_url() . 'assets/js/library/Chart.bundle.min.js', array( 'jquery' ), '2.7.2', false );
36
  }
37
 
38
  /**
@@ -56,7 +56,7 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
56
  public function getModules() {
57
  $modules = array();
58
  $limit = null;
59
- $const = 'FORMINATOR_' . strtoupper( static::$module_slug ) . '_LIST_LIMIT';
60
  if ( defined( $const ) && constant( $const ) ) {
61
  $limit = constant( $const );
62
  }
@@ -64,20 +64,20 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
64
  $data = self::get_models( $limit );
65
  $form_view = Forminator_Form_Views_Model::get_instance();
66
 
67
- // Fallback
68
  if ( ! isset( $data['models'] ) || empty( $data['models'] ) ) {
69
  return $modules;
70
  }
71
 
72
  foreach ( $data['models'] as $model ) {
73
  $modules[] = static::module_array(
74
- $model->id,
75
- $model->settings['formName'],
76
- $form_view->count_views( $model->id ),
77
- date( get_option( 'date_format' ), strtotime( $model->raw->post_date ) ),
78
- $model->status,
79
- $model
80
- );
81
  }
82
 
83
  return $modules;
@@ -91,19 +91,19 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
91
  */
92
  public static function get_searched_modules( $search_keyword = null ) {
93
  $modules = array();
94
- $data = self::get_models( -1 );
95
 
96
- // Fallback
97
  if ( ! isset( $data['models'] ) || empty( $data['models'] ) ) {
98
  return $modules;
99
  }
100
 
101
- // Search
102
  if ( ! is_null( $search_keyword ) ) {
103
 
104
- $search_keyword = explode( " ", $search_keyword );
105
- $form_view = Forminator_Form_Views_Model::get_instance();
106
- $module_slug = self::get_slug_ajax( true );
107
 
108
  $class_name = 'Forminator_' . $module_slug . '_Page';
109
 
@@ -111,18 +111,18 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
111
 
112
  foreach ( $search_keyword as $keyword ) {
113
 
114
- // If found
115
  if ( false !== stripos( $model->settings['formName'], $keyword ) ) {
116
 
117
  $modules[] = $class_name::module_array(
118
- $model->id,
119
- $model->settings['formName'],
120
- $form_view->count_views( $model->id ),
121
- date( get_option( 'date_format' ), strtotime( $model->raw->post_date ) ),
122
- $model->status,
123
- $model
124
- );
125
- // prevent duplicates
126
  break;
127
  }
128
  }
@@ -139,12 +139,12 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
139
  * @return array
140
  */
141
  public static function get_slug_ajax( $class = false ) {
142
-
143
- if ( ! $page = filter_input( INPUT_POST, 'page', FILTER_SANITIZE_STRING ) ) {
144
  return '';
145
  }
146
 
147
- switch( $page ) {
148
  case 'forminator-poll':
149
  $module_slug = $class ? 'Poll' : 'poll';
150
  break;
@@ -172,7 +172,7 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
172
  *
173
  * @return array
174
  */
175
- //protected static function module_array( $id, $title, $views, $date, $status, $model ) {}
176
 
177
  /**
178
  * Show the modules
@@ -206,7 +206,8 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
206
  $edit_url = admin_url( 'admin.php?page=forminator-' . ( 'nowrong' === $module['type'] ? $module['type'] : 'knowledge' ) . '-wizard&id=' . $module['id'] );
207
  }
208
 
209
- if( isset( $_GET['view-stats'] ) && intval( $_GET['view-stats'] ) === intval( $module['id'] ) ) { // phpcs:ignore
 
210
  $opened_class = ' sui-accordion-item--open forminator-scroll-to';
211
  $opened_chart = ' sui-chartjs-loaded';
212
  }
@@ -224,7 +225,7 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
224
  <span class="sui-screen-reader-text"><?php esc_html_e( 'Select this module', 'forminator' ); ?></span>
225
  </label>
226
 
227
- <span class="sui-trim-text"><?php echo htmlspecialchars( forminator_get_form_name( $module['id'] ) ); // phpcs:ignore ?></span>
228
 
229
  <?php
230
  if ( 'publish' === $module['status'] ) {
@@ -267,7 +268,7 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
267
  <li><a href="#"
268
  class="wpmudev-open-modal"
269
  data-modal="<?php echo esc_attr( $preview_dialog ); ?>"
270
- data-modal-title="<?php printf( '%s - %s', esc_html( $preview_title ), htmlspecialchars( htmlspecialchars( forminator_get_form_name( $module['id'] ) ) ) ); // phpcs:ignore ?>"
271
  data-form-id="<?php echo esc_attr( $module['id'] ); ?>"
272
  data-has-leads="<?php echo esc_attr( $has_leads ); ?>"
273
  data-leads-id="<?php echo esc_attr( $leads_id ); ?>"
@@ -296,7 +297,7 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
296
  $update_status_nonce = esc_attr( 'forminator-nonce-update-status-' . $module['id'] );
297
  wp_nonce_field( $update_status_nonce, $update_status_nonce, false );
298
  ?>
299
- <input type="hidden" name="_wp_http_referer" value="<?php echo admin_url( 'admin.php?page=forminator-' . $page ); ?>">
300
  <button type="submit">
301
 
302
  <?php if ( 'publish' === $module['status'] ) : ?>
@@ -309,7 +310,7 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
309
  </form>
310
  </li>
311
 
312
- <li><a href="<?php echo admin_url( 'admin.php?page=forminator-entries&form_type=' . $post_type . '&form_id=' . $module['id'] ); // phpcs:ignore ?>">
313
  <i class="sui-icon-community-people" aria-hidden="true"></i> <?php esc_html_e( 'View Submissions', 'forminator' ); ?>
314
  </a></li>
315
 
@@ -321,13 +322,13 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
321
  $clone_nonce = esc_attr( 'forminator-nonce-clone-' . $module['id'] );
322
  wp_nonce_field( $clone_nonce, 'forminatorNonce' );
323
  ?>
324
- <?php if ( $has_leads ): ?>
325
  <button type="submit" disabled="disabled" class="fui-button-with-tag sui-tooltip sui-tooltip-left sui-constrained" data-tooltip="<?php esc_html_e( 'Duplicate isn\'t supported at the moment for the quizzes with lead capturing enabled.', 'forminator' ); ?>">
326
  <span class="sui-icon-page-multiple" aria-hidden="true"></span>
327
  <span class="fui-button-label"><?php esc_html_e( 'Duplicate', 'forminator' ); ?></span>
328
  <span class="sui-tag sui-tag-blue sui-tag-sm"><?php echo esc_html__( 'Coming soon', 'forminator' ); ?></span>
329
  </button>
330
- <?php else: ?>
331
  <button type="submit">
332
  <i class="sui-icon-page-multiple" aria-hidden="true"></i> <?php esc_html_e( 'Duplicate', 'forminator' ); ?>
333
  </button>
@@ -339,7 +340,7 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
339
  class="wpmudev-open-modal"
340
  data-modal="delete-module"
341
  data-modal-title="<?php esc_attr_e( 'Reset Tracking Data', 'forminator' ); ?>"
342
- data-modal-content="<?php printf( esc_attr__( 'This action will reset the views and conversions data for this %s. Are you sure you want to proceed?', 'forminator' ), $module_slug ); ?>"
343
  data-button-text="<?php esc_attr_e( 'Reset', 'forminator' ); ?>"
344
  data-form-id="<?php echo esc_attr( $module['id'] ); ?>"
345
  data-action="reset-views"
@@ -350,14 +351,14 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
350
  </li>
351
 
352
  <?php if ( Forminator::is_import_export_feature_enabled() ) : ?>
353
- <?php if ( $has_leads ): ?>
354
  <li aria-hidden="true"><a href="#" class="fui-button-with-tag sui-tooltip sui-tooltip-left"
355
  data-tooltip="<?php esc_html_e( 'Export isn\'t supported at the moment for the quizzes with lead capturing enabled.', 'forminator' ); ?>">
356
  <span class="sui-icon-cloud-migration" aria-hidden="true"></span>
357
  <span class="fui-button-label"><?php esc_html_e( 'Export', 'forminator' ); ?></span>
358
  <span class="sui-tag sui-tag-blue sui-tag-sm"><?php echo esc_html__( 'Coming soon', 'forminator' ); ?></span>
359
  </a></li>
360
- <?php else: ?>
361
  <li><a href="#"
362
  class="wpmudev-open-modal"
363
  data-modal="<?php echo esc_attr( $export_dialog ); ?>"
@@ -374,8 +375,8 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
374
  <button
375
  class="sui-option-red wpmudev-open-modal"
376
  data-modal="delete-module"
377
- data-modal-title="<?php printf( esc_attr__( 'Delete %s', 'forminator' ), forminator_get_prefix( $module_slug, '', true ) ); ?>"
378
- data-modal-content="<?php printf( esc_attr__( 'Are you sure you wish to permanently delete this %s?', 'forminator' ), $module_slug ); ?>"
379
  data-form-id="<?php echo esc_attr( $module['id'] ); ?>"
380
  data-nonce="<?php echo esc_attr( wp_create_nonce( 'forminator_' . $module_slug . '_request' ) ); ?>"
381
  >
@@ -409,22 +410,22 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
409
 
410
  <li>
411
  <?php if ( $has_leads ) : ?>
412
- <strong class="forminator-leads-leads" style="display:none;"><?php esc_html_e( 'Leads Collected', 'forminator' ); ?></strong>
413
- <a href="<?php echo admin_url( 'admin.php?page=forminator-quiz-view&form_id=' . $module['id'] ); // phpcs:ignore ?>" class="forminator-leads-leads" style="display:none;"><?php echo esc_html( $module['leads'] ); ?></a>
414
  <?php endif; ?>
415
  <strong class="forminator-leads-submissions"><?php esc_html_e( 'Submissions', 'forminator' ); ?></strong>
416
- <a href="<?php echo admin_url( 'admin.php?page=forminator-entries&form_type=' . $post_type . '&form_id=' . $module['id'] ); // phpcs:ignore ?>" class="forminator-leads-submissions"><?php echo esc_html( $module['entries'] ); ?></a>
417
  </li>
418
 
419
  <li>
420
  <strong><?php esc_html_e( 'Conversion Rate', 'forminator' ); ?></strong>
421
  <span class="forminator-submission-rate"><?php echo esc_html( self::getRate( $module ) ); ?>%</span>
422
- <?php if ( $has_leads ): ?>
423
- <span class="forminator-leads-rate" style="display:none;"><?php echo Forminator_Quiz_Page::getLeadsRate( $module ); // phpcs:ignore ?>%</span>
424
  <?php endif; ?>
425
  </li>
426
 
427
- <?php if ( $has_leads ): ?>
428
  <li class="fui-conversion-select" data-col="selector">
429
  <label class="fui-selector-label"><?php esc_html_e( 'View data for', 'forminator' ); ?></label>
430
  <select class="sui-select-sm fui-selector-button fui-select-listing-data">
@@ -442,9 +443,9 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
442
  unset( $message );
443
  if ( 0 === $module['entries'] ) {
444
  $message = sprintf( esc_html__( "Your %s doesn't have any submission yet. Try again in a moment.", 'forminator' ), $module_slug );
445
- } else if ( 'draft' === $module['status'] ) {
446
  $message = sprintf( esc_html__( "This %s is in draft state, so we've paused collecting data until you publish it live.", 'forminator' ), $module_slug );
447
- } else if ( 0 === $module_entries_from_last_month ) {
448
  $message = sprintf( esc_html__( "Your %s didn't collect submissions the past 30 days.", 'forminator' ), $module_slug );
449
  }
450
  ?>
@@ -459,7 +460,7 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
459
  <div class="sui-chartjs-canvas">
460
 
461
  <?php if ( ( 0 !== $module['entries'] ) || ( 0 !== $module_entries_from_last_month ) ) { ?>
462
- <canvas id="forminator-module-<?php echo $module['id']; // phpcs:ignore ?>-stats"></canvas>
463
  <?php } ?>
464
 
465
  </div>
@@ -494,7 +495,8 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
494
 
495
  </div>
496
 
497
- <?php }
 
498
  }
499
 
500
  /**
@@ -508,7 +510,7 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
508
  */
509
  public static function getRate( $module ) {
510
  if ( $module['views'] > 0 ) {
511
- $rate = round( ( $module["entries"] * 100 ) / $module["views"], 1 );
512
  } else {
513
  $rate = 0;
514
  }
@@ -564,9 +566,9 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
564
  * @return string
565
  */
566
  public static function get_slug_for_search() {
567
- $page = filter_input( INPUT_POST, 'page', FILTER_SANITIZE_STRING );
568
 
569
- switch( $page ) {
570
  case 'forminator-poll':
571
  $module_slug = 'poll';
572
  break;
@@ -589,20 +591,20 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
589
  * @param $id
590
  */
591
  public function clone_module( $id ) {
592
- //check if this id is valid and the record is exists
593
  $model = Forminator_Base_Form_Model::get_model( $id );
594
 
595
  if ( is_object( $model ) ) {
596
- //create one
597
- //reset id
598
  $model->id = null;
599
 
600
- //update title
601
  if ( isset( $model->settings['formName'] ) ) {
602
- $model->settings['formName'] = sprintf( __( "Copy of %s", 'forminator' ), $model->settings['formName'] );
603
  }
604
 
605
- //save it to create new record
606
  $new_id = $model->save( true );
607
 
608
  /**
@@ -610,9 +612,8 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
610
  *
611
  * @since 1.11
612
  *
613
- * @param int $id - module id
614
- * @param object $model - module model
615
- *
616
  */
617
  do_action( 'forminator_' . static::$module_slug . '_action_clone', $new_id, $model );
618
 
@@ -621,7 +622,7 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
621
  $function( $id, $new_id );
622
  }
623
 
624
- // Purge count forms cache
625
  $cache_prefix = 'forminator_' . static::$module_slug . '_total_entries';
626
  wp_cache_delete( $cache_prefix, $cache_prefix );
627
  wp_cache_delete( $cache_prefix . '_publish', $cache_prefix . '_publish' );
@@ -637,7 +638,7 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
637
  * @param $id
638
  */
639
  public static function delete_module( $id ) {
640
- //check if this id is valid and the record is exists
641
  $model = Forminator_Base_Form_Model::get_model( $id );
642
  if ( is_object( $model ) ) {
643
  // For Quizzes with Leads.
@@ -660,7 +661,7 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
660
  }
661
  wp_delete_post( $id );
662
 
663
- // Purge count forms cache
664
  $cache_prefix = 'forminator_' . $model::$module_slug . '_total_entries';
665
  wp_cache_delete( $cache_prefix, $cache_prefix );
666
  wp_cache_delete( $cache_prefix . '_publish', $cache_prefix . '_publish' );
@@ -671,8 +672,7 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
671
  *
672
  * @since 1.11
673
  *
674
- * @param int $id - module id
675
- *
676
  */
677
  do_action( 'forminator_' . $model::$module_slug . '_action_delete', $id );
678
  }
@@ -686,7 +686,7 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
686
  * @param $id
687
  */
688
  public function delete_module_entries( $id ) {
689
- //check if this id is valid and the record is exists
690
  $model = Forminator_Base_Form_Model::get_model( $id );
691
  if ( is_object( $model ) ) {
692
  Forminator_Form_Entry_Model::delete_by_form( $id );
@@ -722,7 +722,7 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
722
  header( 'Cache-Control: must-revalidate' );
723
  header( 'Content-Length: ' . strlen( $encoded ) );
724
 
725
- // make php send the generated csv lines to the browser
726
  fpassthru( $fp );
727
  }
728
 
@@ -746,25 +746,27 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
746
  * @since 1.0
747
  */
748
  public function processRequest() {
749
- if ( ! isset( $_POST['forminator_action'] ) ) {
 
750
  return;
751
  }
752
- // Check if the page is not the relevant module type page and not forminator dashboard page.
753
- if ( ! isset( $_REQUEST['page'] ) || ( 'forminator-' . forminator_get_prefix( static::$module_slug, 'c' ) !== $_REQUEST['page'] && 'forminator' !== $_REQUEST['page'] ) ) {
 
754
  return;
755
  }
756
- // In forminator dashboard, check if form type is not the relevant module type.
757
- if ( 'forminator' === $_REQUEST['page'] && isset( $_REQUEST['form_type'] ) && forminator_get_prefix( static::$module_slug, 'custom-' ) !== $_REQUEST['form_type'] ) {
 
758
  return;
759
  }
760
 
761
- $action = isset( $_POST['forminator_action'] ) ? $_POST['forminator_action'] : '';
762
- $id = isset( $_POST['id'] ) ? intval( $_POST['id'] ) : 0;
763
- // Set nonce names first for verification.
764
  switch ( $action ) {
765
  case 'clone':
766
  $nonce_name = 'forminatorNonce';
767
- $nonce_action = 'forminator-nonce-clone-' . $id;
768
  break;
769
 
770
  case 'reset-views':
@@ -772,25 +774,27 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
772
  $nonce_action = 'forminator-nonce-reset-views-' . $id;
773
  break;
774
 
775
- case 'update-status' :
776
- $nonce_name = 'forminator-nonce-update-status-' . $id;
777
- $nonce_action = $nonce_name;
778
  break;
779
 
780
  default:
781
- $nonce_name = 'forminatorNonce';
782
- $nonce_action = 'forminator_' . static::$module_slug . '_request';
783
  break;
784
  }
785
 
786
- // Verify nonce.
787
- if ( ! isset( $_POST[ $nonce_name ] ) || ! wp_verify_nonce( $_POST[ $nonce_name ], $nonce_action ) ) {
788
- return;
789
- }
 
790
 
791
  $plural_slug = forminator_get_prefix( static::$module_slug, '', false, true );
792
  $is_redirect = true;
793
- $ids = isset( $_POST['ids'] ) ? $_POST['ids'] : '';
 
794
  switch ( $action ) {
795
  case 'delete':
796
  if ( ! empty( $id ) ) {
@@ -806,15 +810,15 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
806
  }
807
  break;
808
 
809
- case 'reset-views' :
810
  if ( ! empty( $id ) ) {
811
  self::reset_module_views( $id );
812
  $notice = static::$module_slug . '_reset';
813
  }
814
  break;
815
 
816
- case 'delete-votes' :
817
- case 'delete-entries' :
818
  if ( ! empty( $id ) ) {
819
  $this->delete_module_entries( $id );
820
  }
@@ -827,56 +831,36 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
827
  $is_redirect = false;
828
  break;
829
 
830
- case 'delete-' . $plural_slug :
831
- if ( ! empty( $ids ) ) {
832
- $module_ids = explode( ',', $ids );
833
- if ( is_array( $module_ids ) && count( $module_ids ) > 0 ) {
834
- foreach ( $module_ids as $id ) {
835
- static::delete_module( $id );
836
- }
837
- }
838
  }
839
  break;
840
 
841
- case 'delete-votes-polls' :
842
- case 'delete-entries-' . $plural_slug :
843
- if ( ! empty( $ids ) ) {
844
- $form_ids = explode( ',', $ids );
845
- if ( is_array( $form_ids ) && count( $form_ids ) > 0 ) {
846
- foreach ( $form_ids as $id ) {
847
- $this->delete_module_entries( $id );
848
- }
849
- }
850
  }
851
  break;
852
 
853
- case 'clone-' . $plural_slug :
854
- if ( ! empty( $ids ) ) {
855
- $module_ids = explode( ',', $ids );
856
- if ( is_array( $module_ids ) && count( $module_ids ) > 0 ) {
857
- foreach ( $module_ids as $id ) {
858
- $this->clone_module( $id );
859
- }
860
- }
861
  }
862
  break;
863
 
864
- case 'reset-views-' . $plural_slug :
865
- if ( ! empty( $ids ) ) {
866
- $form_ids = explode( ',', $ids );
867
- if ( is_array( $form_ids ) && count( $form_ids ) > 0 ) {
868
- foreach ( $form_ids as $id ) {
869
- self::reset_module_views( $id );
870
- }
871
- }
872
  }
873
  break;
874
 
875
- case 'update-status' :
876
- $status = isset( $_POST['status'] ) ? sanitize_text_field( $_POST['status'] ) : '';
877
 
878
  if ( ! empty( $id ) && ! empty( $status ) ) {
879
- // only publish and draft status avail
880
  if ( in_array( $status, array( 'publish', 'draft' ), true ) ) {
881
  $model = Forminator_Base_Form_Model::get_model( $id );
882
  if ( $model instanceof Forminator_Base_Form_Model ) {
@@ -886,45 +870,30 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
886
  }
887
  }
888
  break;
889
- case 'update-statuses' :
890
- $status = isset( $_POST['status'] ) ? sanitize_text_field( $_POST['status'] ) : '';
891
 
892
- if ( ! empty( $ids ) && ! empty( $status ) ) {
893
- // only publish and draft status avail
894
- if ( in_array( $status, array( 'publish', 'draft' ), true ) ) {
895
- $form_ids = explode( ',', $ids );
896
- if ( is_array( $form_ids ) && count( $form_ids ) > 0 ) {
897
- foreach ( $form_ids as $id ) {
898
- $model = Forminator_Base_Form_Model::get_model( $id );
899
- if ( $model instanceof Forminator_Base_Form_Model ) {
900
- $model->status = $status;
901
- $model->save();
902
- }
903
- }
904
  }
905
  }
906
  }
907
  break;
908
 
909
- case 'draft-forms' :
910
- if ( ! empty( $ids ) ) {
911
- $form_ids = explode( ',', $ids );
912
- if ( is_array( $form_ids ) && count( $form_ids ) > 0 ) {
913
- foreach ( $form_ids as $form_id ) {
914
- $this->update_module_status( $form_id, 'draft' );
915
- }
916
- }
917
  }
918
  break;
919
 
920
- case 'publish-forms' :
921
- if ( ! empty( $ids ) ) {
922
- $form_ids = explode( ',', $ids );
923
- if ( is_array( $form_ids ) && count( $form_ids ) > 0 ) {
924
- foreach ( $form_ids as $form_id ) {
925
- $this->update_module_status( $form_id, 'publish' );
926
- }
927
- }
928
  }
929
  break;
930
 
@@ -935,16 +904,17 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
935
  if ( $is_redirect ) {
936
  $to_referer = true;
937
 
938
- if ( isset( $_POST['forminatorRedirect' ] ) && "false" === $_POST['forminatorRedirect' ] ) {
939
  $to_referer = false;
940
  }
941
 
942
- $args = array(
943
  'page' => $this->get_admin_page(),
944
  );
945
- if ( $search = filter_input( INPUT_POST, 'msearch', FILTER_SANITIZE_STRING ) ) {
 
946
  $args['module-search'] = $search;
947
- $to_referer = false;
948
  }
949
  if ( ! empty( $notice ) ) {
950
  $args['forminator_notice'] = $notice;
@@ -971,7 +941,7 @@ abstract class Forminator_Admin_Module_Edit_Page extends Forminator_Admin_Page {
971
  * @param $status
972
  */
973
  public function update_module_status( $id, $status ) {
974
- // only publish and draft status avail
975
  if ( in_array( $status, array( 'publish', 'draft' ), true ) ) {
976
  $model = Forminator_Base_Form_Model::get_model( $id );
977
  if ( $model instanceof Forminator_Base_Form_Model ) {
23
  * @since 1.0
24
  */
25
  public function init() {
26
+ $pagenum = absint( Forminator_Core::sanitize_text_field( 'paged' ) );
27
  self::$page_number = max( 1, $pagenum );
28
  $this->processRequest();
29
  }
32
  * Trigger before render
33
  */
34
  public function before_render() {
35
+ wp_enqueue_script( 'forminator-chart', forminator_plugin_url() . 'assets/js/library/Chart.bundle.min.js', array( 'jquery' ), '2.9.4', false );
36
  }
37
 
38
  /**
56
  public function getModules() {
57
  $modules = array();
58
  $limit = null;
59
+ $const = 'FORMINATOR_' . strtoupper( static::$module_slug ) . '_LIST_LIMIT';
60
  if ( defined( $const ) && constant( $const ) ) {
61
  $limit = constant( $const );
62
  }
64
  $data = self::get_models( $limit );
65
  $form_view = Forminator_Form_Views_Model::get_instance();
66
 
67
+ // Fallback.
68
  if ( ! isset( $data['models'] ) || empty( $data['models'] ) ) {
69
  return $modules;
70
  }
71
 
72
  foreach ( $data['models'] as $model ) {
73
  $modules[] = static::module_array(
74
+ $model->id,
75
+ $model->settings['formName'],
76
+ $form_view->count_views( $model->id ),
77
+ date( get_option( 'date_format' ), strtotime( $model->raw->post_date ) ),
78
+ $model->status,
79
+ $model
80
+ );
81
  }
82
 
83
  return $modules;
91
  */
92
  public static function get_searched_modules( $search_keyword = null ) {
93
  $modules = array();
94
+ $data = self::get_models( -1 );
95
 
96
+ // Fallback.
97
  if ( ! isset( $data['models'] ) || empty( $data['models'] ) ) {
98
  return $modules;
99
  }
100
 
101
+ // Search.
102
  if ( ! is_null( $search_keyword ) ) {
103
 
104
+ $search_keyword = explode( ' ', $search_keyword );
105
+ $form_view = Forminator_Form_Views_Model::get_instance();
106
+ $module_slug = self::get_slug_ajax( true );
107
 
108
  $class_name = 'Forminator_' . $module_slug . '_Page';
109
 
111
 
112
  foreach ( $search_keyword as $keyword ) {
113
 
114
+ // If found.
115
  if ( false !== stripos( $model->settings['formName'], $keyword ) ) {
116
 
117
  $modules[] = $class_name::module_array(
118
+ $model->id,
119
+ $model->settings['formName'],
120
+ $form_view->count_views( $model->id ),
121
+ date( get_option( 'date_format' ), strtotime( $model->raw->post_date ) ),
122
+ $model->status,
123
+ $model
124
+ );
125
+ // prevent duplicates.
126
  break;
127
  }
128
  }
139
  * @return array
140
  */
141
  public static function get_slug_ajax( $class = false ) {
142
+ $page = filter_input( INPUT_POST, 'page' );
143
+ if ( ! $page ) {
144
  return '';
145
  }
146
 
147
+ switch ( $page ) {
148
  case 'forminator-poll':
149
  $module_slug = $class ? 'Poll' : 'poll';
150
  break;
172
  *
173
  * @return array
174
  */
175
+ // protected static function module_array( $id, $title, $views, $date, $status, $model ) {}.
176
 
177
  /**
178
  * Show the modules
206
  $edit_url = admin_url( 'admin.php?page=forminator-' . ( 'nowrong' === $module['type'] ? $module['type'] : 'knowledge' ) . '-wizard&id=' . $module['id'] );
207
  }
208
 
209
+ $view_stats = filter_input( INPUT_GET, 'view-stats', FILTER_VALIDATE_INT );
210
+ if ( $view_stats && intval( $module['id'] ) === $view_stats ) {
211
  $opened_class = ' sui-accordion-item--open forminator-scroll-to';
212
  $opened_chart = ' sui-chartjs-loaded';
213
  }
225
  <span class="sui-screen-reader-text"><?php esc_html_e( 'Select this module', 'forminator' ); ?></span>
226
  </label>
227
 
228
+ <span class="sui-trim-text"><?php echo esc_html( htmlspecialchars( forminator_get_form_name( $module['id'] ) ) ); ?></span>
229
 
230
  <?php
231
  if ( 'publish' === $module['status'] ) {
268
  <li><a href="#"
269
  class="wpmudev-open-modal"
270
  data-modal="<?php echo esc_attr( $preview_dialog ); ?>"
271
+ data-modal-title="<?php printf( '%s - %s', esc_html( $preview_title ), esc_attr( htmlspecialchars( htmlspecialchars( forminator_get_form_name( $module['id'] ) ) ) ) ); ?>"
272
  data-form-id="<?php echo esc_attr( $module['id'] ); ?>"
273
  data-has-leads="<?php echo esc_attr( $has_leads ); ?>"
274
  data-leads-id="<?php echo esc_attr( $leads_id ); ?>"
297
  $update_status_nonce = esc_attr( 'forminator-nonce-update-status-' . $module['id'] );
298
  wp_nonce_field( $update_status_nonce, $update_status_nonce, false );
299
  ?>
300
+ <input type="hidden" name="_wp_http_referer" value="<?php echo esc_url( admin_url( 'admin.php?page=forminator-' . $page ) ); ?>">
301
  <button type="submit">
302
 
303
  <?php if ( 'publish' === $module['status'] ) : ?>
310
  </form>
311
  </li>
312
 
313
+ <li><a href="<?php echo esc_url( admin_url( 'admin.php?page=forminator-entries&form_type=' . $post_type . '&form_id=' . $module['id'] ) ); ?>">
314
  <i class="sui-icon-community-people" aria-hidden="true"></i> <?php esc_html_e( 'View Submissions', 'forminator' ); ?>
315
  </a></li>
316
 
322
  $clone_nonce = esc_attr( 'forminator-nonce-clone-' . $module['id'] );
323
  wp_nonce_field( $clone_nonce, 'forminatorNonce' );
324
  ?>
325
+ <?php if ( $has_leads ) : ?>
326
  <button type="submit" disabled="disabled" class="fui-button-with-tag sui-tooltip sui-tooltip-left sui-constrained" data-tooltip="<?php esc_html_e( 'Duplicate isn\'t supported at the moment for the quizzes with lead capturing enabled.', 'forminator' ); ?>">
327
  <span class="sui-icon-page-multiple" aria-hidden="true"></span>
328
  <span class="fui-button-label"><?php esc_html_e( 'Duplicate', 'forminator' ); ?></span>
329
  <span class="sui-tag sui-tag-blue sui-tag-sm"><?php echo esc_html__( 'Coming soon', 'forminator' ); ?></span>
330
  </button>
331
+ <?php else : ?>
332
  <button type="submit">
333
  <i class="sui-icon-page-multiple" aria-hidden="true"></i> <?php esc_html_e( 'Duplicate', 'forminator' ); ?>
334
  </button>
340
  class="wpmudev-open-modal"
341
  data-modal="delete-module"
342
  data-modal-title="<?php esc_attr_e( 'Reset Tracking Data', 'forminator' ); ?>"
343
+ data-modal-content="<?php echo esc_attr( sprintf( __( 'This action will reset the views and conversions data for this %s. Are you sure you want to proceed?', 'forminator' ), $module_slug ) ); ?>"
344
  data-button-text="<?php esc_attr_e( 'Reset', 'forminator' ); ?>"
345
  data-form-id="<?php echo esc_attr( $module['id'] ); ?>"
346
  data-action="reset-views"
351
  </li>
352
 
353
  <?php if ( Forminator::is_import_export_feature_enabled() ) : ?>
354
+ <?php if ( $has_leads ) : ?>
355
  <li aria-hidden="true"><a href="#" class="fui-button-with-tag sui-tooltip sui-tooltip-left"
356
  data-tooltip="<?php esc_html_e( 'Export isn\'t supported at the moment for the quizzes with lead capturing enabled.', 'forminator' ); ?>">
357
  <span class="sui-icon-cloud-migration" aria-hidden="true"></span>
358
  <span class="fui-button-label"><?php esc_html_e( 'Export', 'forminator' ); ?></span>
359
  <span class="sui-tag sui-tag-blue sui-tag-sm"><?php echo esc_html__( 'Coming soon', 'forminator' ); ?></span>
360
  </a></li>
361
+ <?php else : ?>
362
  <li><a href="#"
363
  class="wpmudev-open-modal"
364
  data-modal="<?php echo esc_attr( $export_dialog ); ?>"
375
  <button
376
  class="sui-option-red wpmudev-open-modal"
377
  data-modal="delete-module"
378
+ data-modal-title="<?php echo esc_attr( sprintf( __( 'Delete %s', 'forminator' ), forminator_get_prefix( $module_slug, '', true ) ) ); ?>"
379
+ data-modal-content="<?php echo esc_attr( sprintf( __( 'Are you sure you wish to permanently delete this %s?', 'forminator' ), $module_slug ) ); ?>"
380
  data-form-id="<?php echo esc_attr( $module['id'] ); ?>"
381
  data-nonce="<?php echo esc_attr( wp_create_nonce( 'forminator_' . $module_slug . '_request' ) ); ?>"
382
  >
410
 
411
  <li>
412
  <?php if ( $has_leads ) : ?>
413
+ <strong class="forminator-leads-leads" style="display:none;"><?php esc_html_e( 'Leads Collected', 'forminator' ); ?></strong>
414
+ <a href="<?php echo esc_url( admin_url( 'admin.php?page=forminator-quiz-view&form_id=' . $module['id'] ) ); ?>" class="forminator-leads-leads" style="display:none;"><?php echo esc_html( $module['leads'] ); ?></a>
415
  <?php endif; ?>
416
  <strong class="forminator-leads-submissions"><?php esc_html_e( 'Submissions', 'forminator' ); ?></strong>
417
+ <a href="<?php echo esc_url( admin_url( 'admin.php?page=forminator-entries&form_type=' . $post_type . '&form_id=' . $module['id'] ) ); ?>" class="forminator-leads-submissions"><?php echo esc_html( $module['entries'] ); ?></a>
418
  </li>
419
 
420
  <li>
421
  <strong><?php esc_html_e( 'Conversion Rate', 'forminator' ); ?></strong>
422
  <span class="forminator-submission-rate"><?php echo esc_html( self::getRate( $module ) ); ?>%</span>
423
+ <?php if ( $has_leads ) : ?>
424
+ <span class="forminator-leads-rate" style="display:none;"><?php echo esc_html( Forminator_Quiz_Page::getLeadsRate( $module ) ); ?>%</span>
425
  <?php endif; ?>
426
  </li>
427
 
428
+ <?php if ( $has_leads ) : ?>
429
  <li class="fui-conversion-select" data-col="selector">
430
  <label class="fui-selector-label"><?php esc_html_e( 'View data for', 'forminator' ); ?></label>
431
  <select class="sui-select-sm fui-selector-button fui-select-listing-data">
443
  unset( $message );
444
  if ( 0 === $module['entries'] ) {
445
  $message = sprintf( esc_html__( "Your %s doesn't have any submission yet. Try again in a moment.", 'forminator' ), $module_slug );
446
+ } elseif ( 'draft' === $module['status'] ) {
447
  $message = sprintf( esc_html__( "This %s is in draft state, so we've paused collecting data until you publish it live.", 'forminator' ), $module_slug );
448
+ } elseif ( 0 === $module_entries_from_last_month ) {
449
  $message = sprintf( esc_html__( "Your %s didn't collect submissions the past 30 days.", 'forminator' ), $module_slug );
450
  }
451
  ?>
460
  <div class="sui-chartjs-canvas">
461
 
462
  <?php if ( ( 0 !== $module['entries'] ) || ( 0 !== $module_entries_from_last_month ) ) { ?>
463
+ <canvas id="forminator-module-<?php echo esc_attr( $module['id'] ); ?>-stats"></canvas>
464
  <?php } ?>
465
 
466
  </div>
495
 
496
  </div>
497
 
498
+ <?php
499
+ }
500
  }
501
 
502
  /**
510
  */
511
  public static function getRate( $module ) {
512
  if ( $module['views'] > 0 ) {
513
+ $rate = round( ( $module['entries'] * 100 ) / $module['views'], 1 );
514
  } else {
515
  $rate = 0;
516
  }
566
  * @return string
567
  */
568
  public static function get_slug_for_search() {
569
+ $page = filter_input( INPUT_POST, 'page' );
570
 
571
+ switch ( $page ) {
572
  case 'forminator-poll':
573
  $module_slug = 'poll';
574
  break;
591
  * @param $id
592
  */
593
  public function clone_module( $id ) {
594
+ // check if this id is valid and the record is exists.
595
  $model = Forminator_Base_Form_Model::get_model( $id );
596
 
597
  if ( is_object( $model ) ) {
598
+ // create one.
599
+ // reset id.
600
  $model->id = null;
601
 
602
+ // update title.
603
  if ( isset( $model->settings['formName'] ) ) {
604
+ $model->settings['formName'] = sprintf( __( 'Copy of %s', 'forminator' ), $model->settings['formName'] );
605
  }
606
 
607
+ // save it to create new record.
608
  $new_id = $model->save( true );
609
 
610
  /**
612
  *
613
  * @since 1.11
614
  *
615
+ * @param int $id - module id.
616
+ * @param object $model - module model.
 
617
  */
618
  do_action( 'forminator_' . static::$module_slug . '_action_clone', $new_id, $model );
619
 
622
  $function( $id, $new_id );
623
  }
624
 
625
+ // Purge count forms cache.
626
  $cache_prefix = 'forminator_' . static::$module_slug . '_total_entries';
627
  wp_cache_delete( $cache_prefix, $cache_prefix );
628
  wp_cache_delete( $cache_prefix . '_publish', $cache_prefix . '_publish' );
638
  * @param $id
639
  */
640
  public static function delete_module( $id ) {
641
+ // check if this id is valid and the record is exists.
642
  $model = Forminator_Base_Form_Model::get_model( $id );
643
  if ( is_object( $model ) ) {
644
  // For Quizzes with Leads.
661
  }
662
  wp_delete_post( $id );
663
 
664
+ // Purge count forms cache.
665
  $cache_prefix = 'forminator_' . $model::$module_slug . '_total_entries';
666
  wp_cache_delete( $cache_prefix, $cache_prefix );
667
  wp_cache_delete( $cache_prefix . '_publish', $cache_prefix . '_publish' );
672
  *
673
  * @since 1.11
674
  *
675
+ * @param int $id - module id.
 
676
  */
677
  do_action( 'forminator_' . $model::$module_slug . '_action_delete', $id );
678
  }
686
  * @param $id
687
  */
688
  public function delete_module_entries( $id ) {
689
+ // check if this id is valid and the record is exists.
690
  $model = Forminator_Base_Form_Model::get_model( $id );
691
  if ( is_object( $model ) ) {
692
  Forminator_Form_Entry_Model::delete_by_form( $id );
722
  header( 'Cache-Control: must-revalidate' );
723
  header( 'Content-Length: ' . strlen( $encoded ) );
724
 
725
+ // make php send the generated csv lines to the browser.
726
  fpassthru( $fp );
727
  }
728
 
746
  * @since 1.0
747
  */
748
  public function processRequest() {
749
+ $action = Forminator_Core::sanitize_text_field( 'forminator_action' );
750
+ if ( ! $action ) {
751
  return;
752
  }
753
+ $page = Forminator_Core::sanitize_text_field( 'page' );
754
+ // Check if the page is not the relevant module type page and not forminator dashboard page.
755
+ if ( 'forminator-' . forminator_get_prefix( static::$module_slug, 'c' ) !== $page && 'forminator' !== $page ) {
756
  return;
757
  }
758
+ $form_type = Forminator_Core::sanitize_text_field( 'form_type' );
759
+ // In forminator dashboard, check if form type is not the relevant module type.
760
+ if ( 'forminator' === $page && $form_type && forminator_get_prefix( static::$module_slug, 'custom-' ) !== $form_type ) {
761
  return;
762
  }
763
 
764
+ $id = filter_input( INPUT_POST, 'id', FILTER_VALIDATE_INT );
765
+ // Set nonce names first for verification.
 
766
  switch ( $action ) {
767
  case 'clone':
768
  $nonce_name = 'forminatorNonce';
769
+ $nonce_action = 'forminator-nonce-clone-' . $id;
770
  break;
771
 
772
  case 'reset-views':
774
  $nonce_action = 'forminator-nonce-reset-views-' . $id;
775
  break;
776
 
777
+ case 'update-status':
778
+ $nonce_name = 'forminator-nonce-update-status-' . $id;
779
+ $nonce_action = $nonce_name;
780
  break;
781
 
782
  default:
783
+ $nonce_name = 'forminatorNonce';
784
+ $nonce_action = 'forminator_' . static::$module_slug . '_request';
785
  break;
786
  }
787
 
788
+ // Verify nonce.
789
+ $nonce = filter_input( INPUT_POST, $nonce_name );
790
+ if ( ! $nonce || ! wp_verify_nonce( $nonce, $nonce_action ) ) {
791
+ return;
792
+ }
793
 
794
  $plural_slug = forminator_get_prefix( static::$module_slug, '', false, true );
795
  $is_redirect = true;
796
+ $ids = Forminator_Core::sanitize_text_field( 'ids' );
797
+ $module_ids = ! empty( $ids ) ? explode( ',', $ids ) : array();
798
  switch ( $action ) {
799
  case 'delete':
800
  if ( ! empty( $id ) ) {
810
  }
811
  break;
812
 
813
+ case 'reset-views':
814
  if ( ! empty( $id ) ) {
815
  self::reset_module_views( $id );
816
  $notice = static::$module_slug . '_reset';
817
  }
818
  break;
819
 
820
+ case 'delete-votes':
821
+ case 'delete-entries':
822
  if ( ! empty( $id ) ) {
823
  $this->delete_module_entries( $id );
824
  }
831
  $is_redirect = false;
832
  break;
833
 
834
+ case 'delete-' . $plural_slug:
835
+ foreach ( $module_ids as $id ) {
836
+ static::delete_module( $id );
 
 
 
 
 
837
  }
838
  break;
839
 
840
+ case 'delete-votes-polls':
841
+ case 'delete-entries-' . $plural_slug:
842
+ foreach ( $module_ids as $id ) {
843
+ $this->delete_module_entries( $id );
 
 
 
 
 
844
  }
845
  break;
846
 
847
+ case 'clone-' . $plural_slug:
848
+ foreach ( $module_ids as $id ) {
849
+ $this->clone_module( $id );
 
 
 
 
 
850
  }
851
  break;
852
 
853
+ case 'reset-views-' . $plural_slug:
854
+ foreach ( $module_ids as $id ) {
855
+ self::reset_module_views( $id );
 
 
 
 
 
856
  }
857
  break;
858
 
859
+ case 'update-status':
860
+ $status = Forminator_Core::sanitize_text_field( 'status' );
861
 
862
  if ( ! empty( $id ) && ! empty( $status ) ) {
863
+ // only publish and draft status avail.
864
  if ( in_array( $status, array( 'publish', 'draft' ), true ) ) {
865
  $model = Forminator_Base_Form_Model::get_model( $id );
866
  if ( $model instanceof Forminator_Base_Form_Model ) {
870
  }
871
  }
872
  break;
873
+ case 'update-statuses':
874
+ $status = Forminator_Core::sanitize_text_field( 'status' );
875
 
876
+ // only publish and draft status avail.
877
+ if ( ! empty( $status ) && in_array( $status, array( 'publish', 'draft' ), true ) ) {
878
+ foreach ( $module_ids as $id ) {
879
+ $model = Forminator_Base_Form_Model::get_model( $id );
880
+ if ( $model instanceof Forminator_Base_Form_Model ) {
881
+ $model->status = $status;
882
+ $model->save();
 
 
 
 
 
883
  }
884
  }
885
  }
886
  break;
887
 
888
+ case 'draft-forms':
889
+ foreach ( $module_ids as $form_id ) {
890
+ $this->update_module_status( $form_id, 'draft' );
 
 
 
 
 
891
  }
892
  break;
893
 
894
+ case 'publish-forms':
895
+ foreach ( $module_ids as $form_id ) {
896
+ $this->update_module_status( $form_id, 'publish' );
 
 
 
 
 
897
  }
898
  break;
899
 
904
  if ( $is_redirect ) {
905
  $to_referer = true;
906
 
907
+ if ( 'false' === filter_input( INPUT_POST, 'forminatorRedirect' ) ) {
908
  $to_referer = false;
909
  }
910
 
911
+ $args = array(
912
  'page' => $this->get_admin_page(),
913
  );
914
+ $search = Forminator_Core::sanitize_text_field( 'msearch' );
915
+ if ( $search ) {
916
  $args['module-search'] = $search;
917
+ $to_referer = false;
918
  }
919
  if ( ! empty( $notice ) ) {
920
  $args['forminator_notice'] = $notice;
941
  * @param $status
942
  */
943
  public function update_module_status( $id, $status ) {
944
+ // only publish and draft status avail.
945
  if ( in_array( $status, array( 'publish', 'draft' ), true ) ) {
946
  $model = Forminator_Base_Form_Model::get_model( $id );
947
  if ( $model instanceof Forminator_Base_Form_Model ) {
admin/abstracts/class-admin-module.php CHANGED
@@ -51,7 +51,7 @@ abstract class Forminator_Admin_Module {
51
 
52
  add_action( 'wp_loaded', array( $this, 'create_module' ) );
53
 
54
- // admin-menu-editor compat
55
  add_action( 'admin_menu_editor-menu_replaced', array( $this, 'hide_menu_pages' ) );
56
 
57
  add_filter( 'forminator_data', array( $this, 'add_js_defaults' ) );
@@ -65,7 +65,7 @@ abstract class Forminator_Admin_Module {
65
  * @since 1.0
66
  */
67
  public function init() {
68
- // Call init instead of __construct in modules
69
  }
70
 
71
  /**
@@ -128,7 +128,7 @@ abstract class Forminator_Admin_Module {
128
  * @return mixed
129
  */
130
  public static function is_edit() {
131
- return (bool) filter_input( INPUT_GET, 'id', FILTER_VALIDATE_INT );
132
  }
133
 
134
  /**
@@ -152,9 +152,10 @@ abstract class Forminator_Admin_Module {
152
  public function is_admin_wizard() {
153
  global $plugin_page;
154
 
155
- // $plugin_page may not be set if we call the function too early, retrieve the page slug from $_GET
156
- if ( ( ! isset( $plugin_page ) || empty( $plugin_page ) ) && isset( $_GET[ 'page' ] ) ) {
157
- $plugin_page = sanitize_text_field( $_GET[ 'page' ] );
 
158
  }
159
 
160
  return $this->page_edit === $plugin_page;
51
 
52
  add_action( 'wp_loaded', array( $this, 'create_module' ) );
53
 
54
+ // admin-menu-editor compat.
55
  add_action( 'admin_menu_editor-menu_replaced', array( $this, 'hide_menu_pages' ) );
56
 
57
  add_filter( 'forminator_data', array( $this, 'add_js_defaults' ) );
65
  * @since 1.0
66
  */
67
  public function init() {
68
+ // Call init instead of __construct in modules.
69
  }
70
 
71
  /**
128
  * @return mixed
129
  */
130
  public static function is_edit() {
131
+ return filter_input( INPUT_GET, 'id', FILTER_VALIDATE_INT ) || filter_input( INPUT_POST, 'id', FILTER_VALIDATE_INT );
132
  }
133
 
134
  /**
152
  public function is_admin_wizard() {
153
  global $plugin_page;
154
 
155
+ // $plugin_page may not be set if we call the function too early, retrieve the page slug from GET.
156
+ $page = filter_input( INPUT_GET, 'page' );
157
+ if ( empty( $plugin_page ) && $page ) {
158
+ $plugin_page = sanitize_text_field( $page );
159
  }
160
 
161
  return $this->page_edit === $plugin_page;
admin/abstracts/class-admin-page.php CHANGED
@@ -60,7 +60,7 @@ abstract class Forminator_Admin_Page {
60
  $page_slug,
61
  $render ? array( $this, 'render' ) : null,
62
  'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzNDAiIGhlaWdodD0iMzAyIj48ZyBmaWxsPSIjODg4IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yMjkuMjc4IDI0Ljg3OGwtMjAuMjEtMjAuMjE3di0uMDAzYy0zLjM1Ni0zLjMzOC04Ljc3OC0zLjMzNS0xMi4xMS4wMDNMNjQuNTIzIDEzNy4xMDFhOC41MDcgOC41MDcgMCAwIDAtMi41MDggNi4wNTJjMCAyLjI4OC44OTIgNC40NCAyLjUwOCA2LjA1MmwyMC4yMTEgMjAuMjE3YTguNTQgOC41NCAwIDAgMCA2LjA1MiAyLjUwNCA4LjU0IDguNTQgMCAwIDAgNi4wNTctMi41MDRsMTMyLjQzNS0xMzIuNDRjMy4zMzgtMy4zMzkgMy4zMzgtOC43NjYgMC0xMi4xMDRtMTA4LjIyMyAyMS43OTRsLTIwLjIxNy0yMC4yMTRjLTMuMzMyLTMuMzM4LTguNzcxLTMuMzM4LTEyLjEwMyAwTDEyOS41MjYgMjAyLjEwN2MtMy4zMzggMy4zMzgtMy4zMzggOC43NjggMCAxMi4xMDZsMjAuMjE3IDIwLjIxNGE4LjUyOCA4LjUyOCAwIDAgMCA2LjA1MiAyLjUwMmMyLjE5IDAgNC4zODUtLjgzMyA2LjA1LTIuNTAyTDMzNy41MDIgNTguNzc1YzMuMzMyLTMuMzM1IDMuMzMyLTguNzYyIDAtMTIuMTAzTTUxLjEyIDIxMC44NTZjLTEuNDQyLTEuNDM4LTMuNDY1LTIuMDM0LTUuNDc3LTEuNTQ0YTUuNzkgNS43OSAwIDAgMC00LjE4NSAzLjg1OWwtMTcuODkzIDU0Ljg2NGE1Ljc5NiA1Ljc5NiAwIDAgMCAxLjQxNiA1LjkyOSA1LjggNS44IDAgMCAwIDUuOTI5IDEuNDJsNTQuODcyLTE3Ljg5NXYtLjAwM2E1Ljc4NCA1Ljc4NCAwIDAgMCAzLjg1Ni00LjE4MiA1Ljc5MSA1Ljc5MSAwIDAgMC0xLjU1LTUuNDc1bC0zNi45NjctMzYuOTczem0yNDguNzIxLTc2Ljc4M2wtMzMuMTA2IDMzLjEwNmE4LjMxMSA4LjMxMSAwIDAgMC0yLjMzNSA0LjUxNmMtOS43OTYgNTUuNDA0LTU3LjczIDk1LjYxOC0xMTMuOTc5IDk1LjYxOC01LjYwNSAwLTExLjMwNi0uNDYzLTE3LjQxOS0xLjQxMy0yLjY1OC0uNDIzLTUuNDU1LjQ2Ni03LjM3MiAyLjM4M2wtMTQuODc5IDE0Ljg3OGMtMi4yMTggMi4yMjEtMy4wMzcgNS4zNTItMi4xOSA4LjM4MS44NDcgMy4wMzQgMy4xODIgNS4yOTEgNi4yNDEgNi4wMzhhMTUwLjY3NCAxNTAuNjc0IDAgMCAwIDM1LjYyIDQuMjcxYzgyLjk0NSAwIDE1MC40MjgtNjcuNDggMTUwLjQyOC0xNTAuNDI1IDAtMy40MzYtLjI0Ni02LjgxMy0uNDktMTAuMTg3bC0uNTE5LTcuMTY2ek0xNjIuNDU1IDEuNWwtMzUuNjQyIDM1LjYxNGMtMS4yNDQgMS4yMS0zLjAwNCAxLjY5OS00LjcxNyAyLjEwNC00Ni4zNjcgMTAuOTY4LTg2LjM4IDUzLjk3LTg3LjQ2NyAxMDcuOTUtLjExMiA1LjYwNC0uMDk0IDExLjE1My43NDkgMTcuMjgyLjM3NiAyLjY2NS0uNTYxIDUuNDQ2LTIuNTExIDcuMzNMMTcuNzMgMTg2LjM5NWMtMi4yNiAyLjE4LTQuOTE1IDMuMDQ4LTguNDE4IDIuMDQ0LTMuNTAzLTEuMDA0LTUuNC0zLjM3Mi02LjA5My02LjQ0My0yLjYzLTExLjY3OC0zLjU5My0yMy43MDItMy4xLTM1Ljg5M0MzLjQ3NiA2My4yMzUgNzAuMDY1IDIuNjcgMTQ3LjAyMyAxLjAwOGMzLjQzNi0uMDc0IDMuODU1LS4xMzQgNy4yMjUuMTdsOC4yMDguMzIyeiIvPjwvZz48L3N2Zz4='
63
- //'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMDAiIGhlaWdodD0iMzAwIj48cGF0aCBmaWxsPSIjODg4IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNDkuNDQ2IDI2Ny42MmExMTcuNzYgMTE3Ljc2IDAgMCAxLTI3Ljg1LTMuMzQgNi42NDMgNi42NDMgMCAwIDEtNC44ODEtNC43MmMtLjY2MS0yLjM2OS0uMDIxLTQuODE4IDEuNzEzLTYuNTU0bDExLjYzNC0xMS42MzRjMS40OTgtMS40OTkgMy42ODYtMi4xOTMgNS43NjUtMS44NjMgNC43NzkuNzQzIDkuMjM1IDEuMTA1IDEzLjYxOSAxLjEwNSA0My45ODIgMCA4MS40NjItMzEuNDQ0IDg5LjEyMy03NC43NjVhNi40OTIgNi40OTIgMCAwIDEgMS44MjUtMy41M2wyNS44ODUtMjUuODg3LjQwNiA1LjYwM2MuMTkzIDIuNjQuMzg0IDUuMjguMzg0IDcuOTY1IDAgNjQuODU3LTUyLjc2NiAxMTcuNjItMTE3LjYyMyAxMTcuNjJtLTQ2LjYzLTEwMS41OWE2LjY4NCA2LjY4NCAwIDAgMS00LjczMi0xLjk1OGwtMTUuODAyLTE1LjgwOGE2LjY0IDYuNjQgMCAwIDEtMS45NjItNC43MzJjMC0xLjc4Ny42OTctMy40NjggMS45NjItNC43MzJsMTAzLjU1LTEwMy41NTdjMi42MDctMi42MSA2Ljg0Ny0yLjYxMiA5LjQ3LS4wMDJ2LjAwMmwxNS44MDMgMTUuODA3YTYuNyA2LjcgMCAwIDEgMCA5LjQ2NUwxMDcuNTUzIDE2NC4wNzJhNi42ODYgNi42ODYgMCAwIDEtNC43MzcgMS45NThtLS44OTcgNjMuNjNhNC41MjQgNC41MjQgMCAwIDEtMy4wMTUgMy4yN3YuMDAybC00Mi45MDUgMTMuOTkzYTQuNTI4IDQuNTI4IDAgMCAxLTQuNjM2LTEuMTExIDQuNTI4IDQuNTI4IDAgMCAxLTEuMTA3LTQuNjM2bDEzLjk5LTQyLjg5OWE0LjUyMiA0LjUyMiAwIDAgMSAzLjI3My0zLjAxNmMxLjU3Mi0uMzg0IDMuMTU0LjA4MiA0LjI4MiAxLjIwNmwyOC45MDcgMjguOTFhNC41MjggNC41MjggMCAwIDEgMS4yMSA0LjI4MW0tNjEtNTAuNDM0YTYuNzk1IDYuNzk1IDAgMCAxLTEuOTIxLS4yNzljLTIuMzg4LS43MS00LjEyMy0yLjU4Ni00LjYzNi01LjAxNS0xLjY3OC03LjkzOS0yLjUzMi0xNS45OS0yLjUzMi0yMy45MzIgMC02NC44NTcgNTIuNzYtMTE3LjYyIDExNy42MTctMTE3LjYyLjg5NCAwIDEuNzc0LjA2IDIuNjUuMTIuNTQ5LjAzNyAxLjA5OC4wNzYgMS42NS4wOTZsNS4xMjYuMTgxLTI3LjQyIDI3LjQyYTYuNTk3IDYuNTk3IDAgMCAxLTMuMTE2IDEuNzM2aC0uMDA1Qzg3LjQxNCA3MS43MSA1OC44MzQgMTA3LjkyNSA1OC44MzQgMTUwYzAgMy4wNTUuMjA2IDYuMjgzLjYyNCA5Ljg3MWE2LjY1OCA2LjY1OCAwIDAgMS0xLjkwNCA1LjUwM2wtMTEuODg3IDExLjg4N2E2LjcxNSA2LjcxNSAwIDAgMS00Ljc1IDEuOTY1bTI0NS4yNTgtOTIuMTJMMTU4LjM3OSAyMTQuOWE2LjY2OCA2LjY2OCAwIDAgMS00LjczMSAxLjk1NiA2LjY2OCA2LjY2OCAwIDAgMS00LjczMy0xLjk1NmwtMTUuODA4LTE1LjgwNWE2LjcgNi43IDAgMCAxIDAtOS40NjZMMjY2LjgwNiA1NS45MzNDMjM5LjMxIDIxLjgzNCAxOTcuMjE1IDAgMTUwIDAgNjcuMTU3IDAgMCA2Ny4xNTcgMCAxNTBjMCA4Mi44NDIgNjcuMTU3IDE1MCAxNTAgMTUwczE1MC02Ny4xNTggMTUwLTE1MGMwLTIyLjQ2Ny00Ljk3My00My43NjItMTMuODI1LTYyLjg5NCIvPjwvc3ZnPg=='
64
  );
65
  } else {
66
  $this->page_id = add_submenu_page(
@@ -139,7 +139,7 @@ abstract class Forminator_Admin_Page {
139
  * @since 1.0
140
  */
141
  public function add_page_hooks() {
142
- add_filter( 'user_can_richedit', '__return_true' ); //Confirms wp editor script is loaded on Forminator admin pages.
143
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
144
  add_filter( 'admin_body_class', array( $this, 'admin_body_classes' ) );
145
  add_action( 'init', array( $this, 'init_scripts' ) );
@@ -166,7 +166,7 @@ abstract class Forminator_Admin_Page {
166
  * @param $hook
167
  */
168
  public function enqueue_scripts( $hook ) {
169
- // Load admin scripts
170
  wp_register_script(
171
  'forminator-admin',
172
  forminator_plugin_url() . 'build/main.js',
@@ -190,7 +190,7 @@ abstract class Forminator_Admin_Page {
190
  * @param $hook
191
  */
192
  public function init_scripts( $hook ) {
193
- // Init jquery ui
194
  forminator_admin_jquery_ui_init();
195
  }
196
 
@@ -221,7 +221,7 @@ abstract class Forminator_Admin_Page {
221
  protected function render_footer() {
222
  $hide_footer = false;
223
  $footer_text = sprintf(/* translators: ... */
224
- __( 'Made with %s by WPMU DEV', 'wpmudev' ),
225
  ' <i class="sui-icon-heart"></i>'
226
  );
227
 
@@ -232,7 +232,7 @@ abstract class Forminator_Admin_Page {
232
  $this->template( $this->folder . '/footer' );
233
  }
234
  ?>
235
- <div class="sui-footer"><?php echo $footer_text; // phpcs:ignore ?></div>
236
 
237
  <?php if ( FORMINATOR_PRO ) { ?>
238
 
@@ -292,11 +292,14 @@ abstract class Forminator_Admin_Page {
292
  */
293
  public function render() {
294
 
295
- $accessibility_enabled = get_option( 'forminator_enable_accessibility', false ); ?>
 
296
 
297
  <main class="sui-wrap <?php echo $accessibility_enabled ? 'sui-color-accessible' : ''; ?> <?php echo esc_attr( 'wpmudev-forminator-' . $this->page_slug ); ?>">
298
 
299
  <?php
 
 
300
  $this->render_header();
301
 
302
  $this->render_page_content();
@@ -351,7 +354,7 @@ abstract class Forminator_Admin_Page {
351
  }
352
 
353
  if ( $echo ) {
354
- echo $content;// phpcs:ignore
355
  }
356
 
357
  return $content;
@@ -400,7 +403,7 @@ abstract class Forminator_Admin_Page {
400
 
401
  $classes = '';
402
 
403
- // Do nothing if not a forminator page
404
  if ( strpos( $screen->base, '_page_forminator' ) === false ) {
405
  return $classes;
406
  }
@@ -418,7 +421,7 @@ abstract class Forminator_Admin_Page {
418
  * @return string
419
  */
420
  protected function get_admin_page() {
421
- return ( isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : '' );
422
  }
423
 
424
  /**
@@ -426,7 +429,7 @@ abstract class Forminator_Admin_Page {
426
  *
427
  * @since 1.6
428
  *
429
- * @param string $fallback_redirect url if referer not found
430
  */
431
  protected function maybe_redirect_to_referer( $fallback_redirect = '', $to_referer = true ) {
432
  $referer = wp_get_referer();
@@ -510,12 +513,12 @@ abstract class Forminator_Admin_Page {
510
  * @since 1.15.1
511
  */
512
  public function show_css_warning() {
513
- $home_url = parse_url( home_url() );
514
- $site_url_option = parse_url( get_option( 'siteurl' ) ); // WordPress Address (URL)
515
 
516
  if (
517
- ( 'https' === $home_url[ 'scheme' ] && 'https' === $site_url_option[ 'scheme' ] ) ||
518
- ( 'http' === $home_url[ 'scheme' ] && 'http' === $site_url_option[ 'scheme' ] )
519
  ) {
520
  return;
521
  }
@@ -537,9 +540,53 @@ abstract class Forminator_Admin_Page {
537
  ?>
538
  <div class="sui-notice sui-notice-warning">
539
  <p><?php esc_html_e( 'Forminator\'s CSS style cannot be loaded because your website\'s address is configured in WordPress to use HTTP instead of HTTPS. This may cause some web content, including Forminator forms, to display incorrectly.', 'forminator' ); ?></p>
540
- <p><?php echo $fix_notice; ?></p>
541
  </div>
542
  <?php
543
  }
544
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
545
  }
60
  $page_slug,
61
  $render ? array( $this, 'render' ) : null,
62
  'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzNDAiIGhlaWdodD0iMzAyIj48ZyBmaWxsPSIjODg4IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yMjkuMjc4IDI0Ljg3OGwtMjAuMjEtMjAuMjE3di0uMDAzYy0zLjM1Ni0zLjMzOC04Ljc3OC0zLjMzNS0xMi4xMS4wMDNMNjQuNTIzIDEzNy4xMDFhOC41MDcgOC41MDcgMCAwIDAtMi41MDggNi4wNTJjMCAyLjI4OC44OTIgNC40NCAyLjUwOCA2LjA1MmwyMC4yMTEgMjAuMjE3YTguNTQgOC41NCAwIDAgMCA2LjA1MiAyLjUwNCA4LjU0IDguNTQgMCAwIDAgNi4wNTctMi41MDRsMTMyLjQzNS0xMzIuNDRjMy4zMzgtMy4zMzkgMy4zMzgtOC43NjYgMC0xMi4xMDRtMTA4LjIyMyAyMS43OTRsLTIwLjIxNy0yMC4yMTRjLTMuMzMyLTMuMzM4LTguNzcxLTMuMzM4LTEyLjEwMyAwTDEyOS41MjYgMjAyLjEwN2MtMy4zMzggMy4zMzgtMy4zMzggOC43NjggMCAxMi4xMDZsMjAuMjE3IDIwLjIxNGE4LjUyOCA4LjUyOCAwIDAgMCA2LjA1MiAyLjUwMmMyLjE5IDAgNC4zODUtLjgzMyA2LjA1LTIuNTAyTDMzNy41MDIgNTguNzc1YzMuMzMyLTMuMzM1IDMuMzMyLTguNzYyIDAtMTIuMTAzTTUxLjEyIDIxMC44NTZjLTEuNDQyLTEuNDM4LTMuNDY1LTIuMDM0LTUuNDc3LTEuNTQ0YTUuNzkgNS43OSAwIDAgMC00LjE4NSAzLjg1OWwtMTcuODkzIDU0Ljg2NGE1Ljc5NiA1Ljc5NiAwIDAgMCAxLjQxNiA1LjkyOSA1LjggNS44IDAgMCAwIDUuOTI5IDEuNDJsNTQuODcyLTE3Ljg5NXYtLjAwM2E1Ljc4NCA1Ljc4NCAwIDAgMCAzLjg1Ni00LjE4MiA1Ljc5MSA1Ljc5MSAwIDAgMC0xLjU1LTUuNDc1bC0zNi45NjctMzYuOTczem0yNDguNzIxLTc2Ljc4M2wtMzMuMTA2IDMzLjEwNmE4LjMxMSA4LjMxMSAwIDAgMC0yLjMzNSA0LjUxNmMtOS43OTYgNTUuNDA0LTU3LjczIDk1LjYxOC0xMTMuOTc5IDk1LjYxOC01LjYwNSAwLTExLjMwNi0uNDYzLTE3LjQxOS0xLjQxMy0yLjY1OC0uNDIzLTUuNDU1LjQ2Ni03LjM3MiAyLjM4M2wtMTQuODc5IDE0Ljg3OGMtMi4yMTggMi4yMjEtMy4wMzcgNS4zNTItMi4xOSA4LjM4MS44NDcgMy4wMzQgMy4xODIgNS4yOTEgNi4yNDEgNi4wMzhhMTUwLjY3NCAxNTAuNjc0IDAgMCAwIDM1LjYyIDQuMjcxYzgyLjk0NSAwIDE1MC40MjgtNjcuNDggMTUwLjQyOC0xNTAuNDI1IDAtMy40MzYtLjI0Ni02LjgxMy0uNDktMTAuMTg3bC0uNTE5LTcuMTY2ek0xNjIuNDU1IDEuNWwtMzUuNjQyIDM1LjYxNGMtMS4yNDQgMS4yMS0zLjAwNCAxLjY5OS00LjcxNyAyLjEwNC00Ni4zNjcgMTAuOTY4LTg2LjM4IDUzLjk3LTg3LjQ2NyAxMDcuOTUtLjExMiA1LjYwNC0uMDk0IDExLjE1My43NDkgMTcuMjgyLjM3NiAyLjY2NS0uNTYxIDUuNDQ2LTIuNTExIDcuMzNMMTcuNzMgMTg2LjM5NWMtMi4yNiAyLjE4LTQuOTE1IDMuMDQ4LTguNDE4IDIuMDQ0LTMuNTAzLTEuMDA0LTUuNC0zLjM3Mi02LjA5My02LjQ0My0yLjYzLTExLjY3OC0zLjU5My0yMy43MDItMy4xLTM1Ljg5M0MzLjQ3NiA2My4yMzUgNzAuMDY1IDIuNjcgMTQ3LjAyMyAxLjAwOGMzLjQzNi0uMDc0IDMuODU1LS4xMzQgNy4yMjUuMTdsOC4yMDguMzIyeiIvPjwvZz48L3N2Zz4='
63
+ // 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMDAiIGhlaWdodD0iMzAwIj48cGF0aCBmaWxsPSIjODg4IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNDkuNDQ2IDI2Ny42MmExMTcuNzYgMTE3Ljc2IDAgMCAxLTI3Ljg1LTMuMzQgNi42NDMgNi42NDMgMCAwIDEtNC44ODEtNC43MmMtLjY2MS0yLjM2OS0uMDIxLTQuODE4IDEuNzEzLTYuNTU0bDExLjYzNC0xMS42MzRjMS40OTgtMS40OTkgMy42ODYtMi4xOTMgNS43NjUtMS44NjMgNC43NzkuNzQzIDkuMjM1IDEuMTA1IDEzLjYxOSAxLjEwNSA0My45ODIgMCA4MS40NjItMzEuNDQ0IDg5LjEyMy03NC43NjVhNi40OTIgNi40OTIgMCAwIDEgMS44MjUtMy41M2wyNS44ODUtMjUuODg3LjQwNiA1LjYwM2MuMTkzIDIuNjQuMzg0IDUuMjguMzg0IDcuOTY1IDAgNjQuODU3LTUyLjc2NiAxMTcuNjItMTE3LjYyMyAxMTcuNjJtLTQ2LjYzLTEwMS41OWE2LjY4NCA2LjY4NCAwIDAgMS00LjczMi0xLjk1OGwtMTUuODAyLTE1LjgwOGE2LjY0IDYuNjQgMCAwIDEtMS45NjItNC43MzJjMC0xLjc4Ny42OTctMy40NjggMS45NjItNC43MzJsMTAzLjU1LTEwMy41NTdjMi42MDctMi42MSA2Ljg0Ny0yLjYxMiA5LjQ3LS4wMDJ2LjAwMmwxNS44MDMgMTUuODA3YTYuNyA2LjcgMCAwIDEgMCA5LjQ2NUwxMDcuNTUzIDE2NC4wNzJhNi42ODYgNi42ODYgMCAwIDEtNC43MzcgMS45NThtLS44OTcgNjMuNjNhNC41MjQgNC41MjQgMCAwIDEtMy4wMTUgMy4yN3YuMDAybC00Mi45MDUgMTMuOTkzYTQuNTI4IDQuNTI4IDAgMCAxLTQuNjM2LTEuMTExIDQuNTI4IDQuNTI4IDAgMCAxLTEuMTA3LTQuNjM2bDEzLjk5LTQyLjg5OWE0LjUyMiA0LjUyMiAwIDAgMSAzLjI3My0zLjAxNmMxLjU3Mi0uMzg0IDMuMTU0LjA4MiA0LjI4MiAxLjIwNmwyOC45MDcgMjguOTFhNC41MjggNC41MjggMCAwIDEgMS4yMSA0LjI4MW0tNjEtNTAuNDM0YTYuNzk1IDYuNzk1IDAgMCAxLTEuOTIxLS4yNzljLTIuMzg4LS43MS00LjEyMy0yLjU4Ni00LjYzNi01LjAxNS0xLjY3OC03LjkzOS0yLjUzMi0xNS45OS0yLjUzMi0yMy45MzIgMC02NC44NTcgNTIuNzYtMTE3LjYyIDExNy42MTctMTE3LjYyLjg5NCAwIDEuNzc0LjA2IDIuNjUuMTIuNTQ5LjAzNyAxLjA5OC4wNzYgMS42NS4wOTZsNS4xMjYuMTgxLTI3LjQyIDI3LjQyYTYuNTk3IDYuNTk3IDAgMCAxLTMuMTE2IDEuNzM2aC0uMDA1Qzg3LjQxNCA3MS43MSA1OC44MzQgMTA3LjkyNSA1OC44MzQgMTUwYzAgMy4wNTUuMjA2IDYuMjgzLjYyNCA5Ljg3MWE2LjY1OCA2LjY1OCAwIDAgMS0xLjkwNCA1LjUwM2wtMTEuODg3IDExLjg4N2E2LjcxNSA2LjcxNSAwIDAgMS00Ljc1IDEuOTY1bTI0NS4yNTgtOTIuMTJMMTU4LjM3OSAyMTQuOWE2LjY2OCA2LjY2OCAwIDAgMS00LjczMSAxLjk1NiA2LjY2OCA2LjY2OCAwIDAgMS00LjczMy0xLjk1NmwtMTUuODA4LTE1LjgwNWE2LjcgNi43IDAgMCAxIDAtOS40NjZMMjY2LjgwNiA1NS45MzNDMjM5LjMxIDIxLjgzNCAxOTcuMjE1IDAgMTUwIDAgNjcuMTU3IDAgMCA2Ny4xNTcgMCAxNTBjMCA4Mi44NDIgNjcuMTU3IDE1MCAxNTAgMTUwczE1MC02Ny4xNTggMTUwLTE1MGMwLTIyLjQ2Ny00Ljk3My00My43NjItMTMuODI1LTYyLjg5NCIvPjwvc3ZnPg=='.
64
  );
65
  } else {
66
  $this->page_id = add_submenu_page(
139
  * @since 1.0
140
  */
141
  public function add_page_hooks() {
142
+ add_filter( 'user_can_richedit', '__return_true' ); // Confirms wp editor script is loaded on Forminator admin pages.
143
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
144
  add_filter( 'admin_body_class', array( $this, 'admin_body_classes' ) );
145
  add_action( 'init', array( $this, 'init_scripts' ) );
166
  * @param $hook
167
  */
168
  public function enqueue_scripts( $hook ) {
169
+ // Load admin scripts.
170
  wp_register_script(
171
  'forminator-admin',
172
  forminator_plugin_url() . 'build/main.js',
190
  * @param $hook
191
  */
192
  public function init_scripts( $hook ) {
193
+ // Init jquery ui.
194
  forminator_admin_jquery_ui_init();
195
  }
196
 
221
  protected function render_footer() {
222
  $hide_footer = false;
223
  $footer_text = sprintf(/* translators: ... */
224
+ __( 'Made with %s by WPMU DEV', 'wpmudev' ),
225
  ' <i class="sui-icon-heart"></i>'
226
  );
227
 
232
  $this->template( $this->folder . '/footer' );
233
  }
234
  ?>
235
+ <div class="sui-footer"><?php echo wp_kses_post( $footer_text ); ?></div>
236
 
237
  <?php if ( FORMINATOR_PRO ) { ?>
238
 
292
  */
293
  public function render() {
294
 
295
+ $accessibility_enabled = get_option( 'forminator_enable_accessibility', false );
296
+ ?>
297
 
298
  <main class="sui-wrap <?php echo $accessibility_enabled ? 'sui-color-accessible' : ''; ?> <?php echo esc_attr( 'wpmudev-forminator-' . $this->page_slug ); ?>">
299
 
300
  <?php
301
+ //$this->black_friday_notice();
302
+
303
  $this->render_header();
304
 
305
  $this->render_page_content();
354
  }
355
 
356
  if ( $echo ) {
357
+ echo $content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
358
  }
359
 
360
  return $content;
403
 
404
  $classes = '';
405
 
406
+ // Do nothing if not a forminator page.
407
  if ( strpos( $screen->base, '_page_forminator' ) === false ) {
408
  return $classes;
409
  }
421
  * @return string
422
  */
423
  protected function get_admin_page() {
424
+ return Forminator_Core::sanitize_text_field( 'page' );
425
  }
426
 
427
  /**
429
  *
430
  * @since 1.6
431
  *
432
+ * @param string $fallback_redirect url if referer not found.
433
  */
434
  protected function maybe_redirect_to_referer( $fallback_redirect = '', $to_referer = true ) {
435
  $referer = wp_get_referer();
513
  * @since 1.15.1
514
  */
515
  public function show_css_warning() {
516
+ $home_url = parse_url( home_url() );
517
+ $site_url_option = parse_url( get_option( 'siteurl' ) ); // WordPress Address (URL).
518
 
519
  if (
520
+ ( 'https' === $home_url['scheme'] && 'https' === $site_url_option['scheme'] ) ||
521
+ ( 'http' === $home_url['scheme'] && 'http' === $site_url_option['scheme'] )
522
  ) {
523
  return;
524
  }
540
  ?>
541
  <div class="sui-notice sui-notice-warning">
542
  <p><?php esc_html_e( 'Forminator\'s CSS style cannot be loaded because your website\'s address is configured in WordPress to use HTTP instead of HTTPS. This may cause some web content, including Forminator forms, to display incorrectly.', 'forminator' ); ?></p>
543
+ <p><?php echo wp_kses_post( $fix_notice ); ?></p>
544
  </div>
545
  <?php
546
  }
547
 
548
+ /**
549
+ * Show black friday notice.
550
+ */
551
+ // private function black_friday_notice() {
552
+ // if ( get_site_option( 'forminator_dismiss_black_friday' ) ) {
553
+ // return;
554
+ // }
555
+ //
556
+ // // Before 01 November.
557
+ // if ( date_create( date_i18n( 'd-m-Y' ) ) < date_create( date_i18n( '01-11-Y' ) ) ) {
558
+ // return;
559
+ // }
560
+ //
561
+ // if ( ! is_main_site() || ! forminator_is_show_branding() || ! is_wpmu_dev_admin() ) {
562
+ // return;
563
+ // }
564
+ //
565
+ // // After 6 December.
566
+ // if ( date_create( date_i18n( 'd-m-Y' ) ) >= date_create( date_i18n( '06-12-Y' ) ) ) {
567
+ // update_site_option( 'forminator_dismiss_black_friday', true );
568
+ // return;
569
+ // }
570
+ //
571
+ // wp_enqueue_script(
572
+ // 'forminator-black-friday',
573
+ // forminator_plugin_url() . 'assets/js/black-friday.js',
574
+ // array(
575
+ // 'jquery',
576
+ // 'react',
577
+ // 'react-dom',
578
+ // ),
579
+ // FORMINATOR_VERSION,
580
+ // true
581
+ // );
582
+ //
583
+ // $strings = array(
584
+ // 'link' => 'https://wpmudev.com/black-friday/?coupon=BFP-2021&utm_source=forminator_' . ( FORMINATOR_PRO ? 'pro' : 'free' ) . '&utm_medium=referral&utm_campaign=bf2021',
585
+ // );
586
+ //
587
+ // wp_localize_script( 'forminator-black-friday', 'forminator_bf', $strings );
588
+ //
589
+ // echo '<div id="forminator-black-friday"></div>';
590
+ // }
591
+
592
  }
admin/abstracts/class-admin-view-page.php CHANGED
@@ -10,10 +10,10 @@ if ( ! defined( 'ABSPATH' ) ) {
10
  */
11
  abstract class Forminator_Admin_View_Page extends Forminator_Admin_Page {
12
  /**
13
- * Current model
14
- *
15
- * @var object|bool
16
- */
17
  protected $model = false;
18
 
19
  /**
@@ -174,7 +174,7 @@ abstract class Forminator_Admin_View_Page extends Forminator_Admin_Page {
174
  *
175
  * @since 1.0
176
  *
177
- * @param string $slug - the field slug
178
  *
179
  * @return string
180
  */
@@ -303,14 +303,14 @@ abstract class Forminator_Admin_View_Page extends Forminator_Admin_Page {
303
  <select name="<?php echo ( 'top' === $position ) ? 'entries-action' : 'entries-action-bottom'; ?>"
304
  class="sui-select-sm sui-select-inline"
305
  style="min-width: 200px;">
306
- <option value=""><?php esc_html_e( "Bulk Actions", 'forminator' ); ?></option>
307
  <?php if ( $is_registration ) { ?>
308
  <option value="approve-users"><?php esc_html_e( 'Approve Users', 'forminator' ); ?></option>
309
  <?php } ?>
310
- <option value="delete-all"><?php esc_html_e( "Delete Entries", 'forminator' ); ?></option>
311
  </select>
312
 
313
- <button class="sui-button"><?php esc_html_e( "Apply", 'forminator' ); ?></button>
314
 
315
  <?php
316
  }
@@ -363,7 +363,7 @@ abstract class Forminator_Admin_View_Page extends Forminator_Admin_Page {
363
  $this->model = false;
364
  }
365
 
366
- $this->pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0; // WPCS: CSRF OK
367
 
368
  $this->parse_filters();
369
  $this->parse_order();
@@ -375,17 +375,16 @@ abstract class Forminator_Admin_View_Page extends Forminator_Admin_Page {
375
  }
376
 
377
  /**
378
- * Parsing filters from $_REQUEST
379
  *
380
  * @since 1.5.4
381
  */
382
  protected function parse_filters() {
383
- $request_data = $_REQUEST;// WPCS CSRF ok.
384
- $data_range = isset( $request_data['date_range'] ) ? sanitize_text_field( $request_data['date_range'] ) : '';
385
- $user_status = ! empty( $request_data['user_status'] ) ? sanitize_text_field( $request_data['user_status'] ) : '';
386
- $search = isset( $request_data['search'] ) ? sanitize_text_field( $request_data['search'] ) : '';
387
- $min_id = isset( $request_data['min_id'] ) ? sanitize_text_field( $request_data['min_id'] ) : '';
388
- $max_id = isset( $request_data['max_id'] ) ? sanitize_text_field( $request_data['max_id'] ) : '';
389
 
390
  $filters = array();
391
  if ( ! empty( $data_range ) ) {
@@ -423,7 +422,7 @@ abstract class Forminator_Admin_View_Page extends Forminator_Admin_Page {
423
  }
424
 
425
  /**
426
- * Parsing order from $_REQUEST
427
  *
428
  * @since 1.5.4
429
  */
@@ -437,51 +436,19 @@ abstract class Forminator_Admin_View_Page extends Forminator_Admin_Page {
437
  'DESC',
438
  'ASC',
439
  );
440
- $request_data = $_REQUEST;// WPCS CSRF ok.
441
- $order_by = 'entries.date_created';
442
- if ( isset( $request_data['order_by' ] ) ) {
443
- switch ( $request_data['order_by' ] ) {
444
- case 'entries.entry_id':
445
- $order_by = 'entries.entry_id';
446
- break;
447
- case 'entries.date_created':
448
- $order_by = 'entries.date_created';
449
- break;
450
- default:
451
- break;
452
- }
453
- }
454
 
455
- $order = 'DESC';
456
- if ( isset( $request_data['order'] ) ) {
457
- switch ( $request_data['order' ] ) {
458
- case 'DESC':
459
- $order = 'DESC';
460
- break;
461
- case 'ASC':
462
- $order = 'ASC';
463
- break;
464
- default:
465
- break;
466
- }
467
  }
 
468
 
469
- if ( ! empty( $order_by ) ) {
470
- if ( ! in_array( $order, $valid_order_bys, true ) ) {
471
- $order_by = 'entries.date_created';
472
- }
473
-
474
- $this->order['order_by'] = $order_by;
475
  }
476
 
477
- if ( ! empty( $order ) ) {
478
- $order = strtoupper( $order );
479
- if ( ! in_array( $order, $valid_orders, true ) ) {
480
- $order = 'DESC';
481
- }
482
-
483
- $this->order['order'] = $order;
484
- }
485
  }
486
 
487
  /**
@@ -496,7 +463,7 @@ abstract class Forminator_Admin_View_Page extends Forminator_Admin_Page {
496
  */
497
  protected function attach_addon_on_render_entry( Forminator_Form_Entry_Model $entry_model ) {
498
  $additional_items = array();
499
- //find all registered addons, so history can be shown even for deactivated addons
500
  $registered_addons = $this->get_registered_addons();
501
 
502
  $method = 'get_addon_' . static::$module_slug . '_hooks';
@@ -571,13 +538,15 @@ abstract class Forminator_Admin_View_Page extends Forminator_Admin_Page {
571
  */
572
  public function process_request() {
573
 
574
- if ( isset( $_GET['err_msg'] ) ) {
575
- $this->error_message = wp_kses_post( $_GET['err_msg'] );
 
576
  }
577
 
578
  // it should be before nonce check cus we use filter on Submissions page without nonce :facepalm:.
579
- if ( isset( $_REQUEST['field'] ) ) {
580
- $this->visible_fields = $_REQUEST['field']; // wpcs XSRF ok, via GET
 
581
  $this->checked_fields = count( $this->visible_fields );
582
  $this->fields_is_filtered = true;
583
  }
@@ -585,49 +554,38 @@ abstract class Forminator_Admin_View_Page extends Forminator_Admin_Page {
585
  /**
586
  * Start modifying data
587
  */
588
- if ( ! isset( $_REQUEST['forminatorEntryNonce'] ) ) {
 
589
  return;
590
  }
591
 
592
- $nonce = $_REQUEST['forminatorEntryNonce']; // WPCS: CSRF OK
593
- if ( ! wp_verify_nonce( $nonce, 'forminator' . forminator_get_prefix( static::$module_slug, '', true ) . 'Entries' ) ) {
594
- return;
595
  }
596
-
597
- if ( isset( $_REQUEST['entries-action'] ) || isset( $_REQUEST['entries-action-bottom'] ) ) {
598
- $action = '';
599
- if ( ! empty( $_REQUEST['entries-action'] ) ) {
600
- $action = sanitize_text_field( $_REQUEST['entries-action'] );
601
- } elseif ( isset( $_REQUEST['entries-action-bottom'] ) ) {
602
- $action = sanitize_text_field( $_REQUEST['entries-action-bottom'] );
603
- }
604
-
605
- switch ( $action ) {
606
- case 'approve-users':
607
- $this->approve_users();
608
- break;
609
- case 'delete-all' :
610
- $this->delete_all_action();
611
- break;
612
- default:
613
- break;
614
- }
615
  }
616
 
617
- if ( isset( $_POST['forminator_action'] ) ) {
618
- switch ( $_POST['forminator_action'] ) {
619
- case 'delete':
620
- if ( isset( $_POST['id'] ) ) {
621
- $id = $_POST['id'];
622
-
623
- $this->delete_action( $id );
624
- $this->maybe_redirect_to_referer();
625
- exit;
626
- }
627
- break;
628
- default:
629
- break;
630
- }
631
  }
632
  }
633
 
@@ -647,8 +605,9 @@ abstract class Forminator_Admin_View_Page extends Forminator_Admin_Page {
647
  if ( 'forminator-' . forminator_get_prefix( static::$module_slug, 'c' ) . '-view' === $this->page_slug ) {
648
  $form_type = forminator_get_prefix( static::$module_slug, 'post_type' );
649
  $url = '?page=forminator-entries&form_type=' . $form_type;
650
- if ( isset( $_REQUEST['form_id'] ) ) { // WPCS: CSRF OK
651
- $url .= '&form_id=' . intval( $_REQUEST['form_id'] ); // WPCS: CSRF OK
 
652
  }
653
  if ( wp_safe_redirect( $url ) ) {
654
  exit;
10
  */
11
  abstract class Forminator_Admin_View_Page extends Forminator_Admin_Page {
12
  /**
13
+ * Current model
14
+ *
15
+ * @var object|bool
16
+ */
17
  protected $model = false;
18
 
19
  /**
174
  *
175
  * @since 1.0
176
  *
177
+ * @param string $slug - the field slug.
178
  *
179
  * @return string
180
  */
303
  <select name="<?php echo ( 'top' === $position ) ? 'entries-action' : 'entries-action-bottom'; ?>"
304
  class="sui-select-sm sui-select-inline"
305
  style="min-width: 200px;">
306
+ <option value=""><?php esc_html_e( 'Bulk Actions', 'forminator' ); ?></option>
307
  <?php if ( $is_registration ) { ?>
308
  <option value="approve-users"><?php esc_html_e( 'Approve Users', 'forminator' ); ?></option>
309
  <?php } ?>
310
+ <option value="delete-all"><?php esc_html_e( 'Delete Entries', 'forminator' ); ?></option>
311
  </select>
312
 
313
+ <button class="sui-button"><?php esc_html_e( 'Apply', 'forminator' ); ?></button>
314
 
315
  <?php
316
  }
363
  $this->model = false;
364
  }
365
 
366
+ $this->pagenum = absint( Forminator_Core::sanitize_text_field( 'paged' ) );
367
 
368
  $this->parse_filters();
369
  $this->parse_order();
375
  }
376
 
377
  /**
378
+ * Parsing filters
379
  *
380
  * @since 1.5.4
381
  */
382
  protected function parse_filters() {
383
+ $data_range = Forminator_Core::sanitize_text_field( 'date_range' );
384
+ $user_status = Forminator_Core::sanitize_text_field( 'user_status' );
385
+ $search = Forminator_Core::sanitize_text_field( 'search' );
386
+ $min_id = Forminator_Core::sanitize_text_field( 'min_id' );
387
+ $max_id = Forminator_Core::sanitize_text_field( 'max_id' );
 
388
 
389
  $filters = array();
390
  if ( ! empty( $data_range ) ) {
422
  }
423
 
424
  /**
425
+ * Parsing order
426
  *
427
  * @since 1.5.4
428
  */
436
  'DESC',
437
  'ASC',
438
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
439
 
440
+ $order_by = Forminator_Core::sanitize_text_field( 'order_by' );
441
+ if ( ! in_array( $order_by, $valid_order_bys, true ) ) {
442
+ $order_by = 'entries.date_created';
 
 
 
 
 
 
 
 
 
443
  }
444
+ $this->order['order_by'] = $order_by;
445
 
446
+ $order = strtoupper( Forminator_Core::sanitize_text_field( 'order' ) );
447
+ if ( ! in_array( $order, $valid_orders, true ) ) {
448
+ $order = 'DESC';
 
 
 
449
  }
450
 
451
+ $this->order['order'] = $order;
 
 
 
 
 
 
 
452
  }
453
 
454
  /**
463
  */
464
  protected function attach_addon_on_render_entry( Forminator_Form_Entry_Model $entry_model ) {
465
  $additional_items = array();
466
+ // find all registered addons, so history can be shown even for deactivated addons.
467
  $registered_addons = $this->get_registered_addons();
468
 
469
  $method = 'get_addon_' . static::$module_slug . '_hooks';
538
  */
539
  public function process_request() {
540
 
541
+ $err_msg = filter_input( INPUT_GET, 'err_msg' );
542
+ if ( $err_msg ) {
543
+ $this->error_message = wp_kses_post( $err_msg );
544
  }
545
 
546
  // it should be before nonce check cus we use filter on Submissions page without nonce :facepalm:.
547
+ $field = filter_input( INPUT_GET, 'field', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
548
+ if ( $field ) {
549
+ $this->visible_fields = $field;
550
  $this->checked_fields = count( $this->visible_fields );
551
  $this->fields_is_filtered = true;
552
  }
554
  /**
555
  * Start modifying data
556
  */
557
+ $nonce = filter_input( INPUT_GET, 'forminatorEntryNonce' );
558
+ if ( ! $nonce || ! wp_verify_nonce( $nonce, 'forminator' . forminator_get_prefix( static::$module_slug, '', true ) . 'Entries' ) ) {
559
  return;
560
  }
561
 
562
+ $action = Forminator_Core::sanitize_text_field( 'entries-action' );
563
+ if ( ! $action ) {
564
+ $action = Forminator_Core::sanitize_text_field( 'entries-action-bottom' );
565
  }
566
+ switch ( $action ) {
567
+ case 'approve-users':
568
+ $this->approve_users();
569
+ break;
570
+ case 'delete-all':
571
+ $this->delete_all_action();
572
+ break;
573
+ default:
574
+ break;
 
 
 
 
 
 
 
 
 
 
575
  }
576
 
577
+ $forminator_action = filter_input( INPUT_GET, 'forminator_action' );
578
+ switch ( $forminator_action ) {
579
+ case 'delete':
580
+ $id = filter_input( INPUT_GET, 'id', FILTER_VALIDATE_INT );
581
+ if ( $id ) {
582
+ $this->delete_action( $id );
583
+ $this->maybe_redirect_to_referer();
584
+ exit;
585
+ }
586
+ break;
587
+ default:
588
+ break;
 
 
589
  }
590
  }
591
 
605
  if ( 'forminator-' . forminator_get_prefix( static::$module_slug, 'c' ) . '-view' === $this->page_slug ) {
606
  $form_type = forminator_get_prefix( static::$module_slug, 'post_type' );
607
  $url = '?page=forminator-entries&form_type=' . $form_type;
608
+ $form_id = (int) Forminator_Core::sanitize_text_field( 'form_id' );
609
+ if ( $form_id ) {
610
+ $url .= '&form_id=' . $form_id;
611
  }
612
  if ( wp_safe_redirect( $url ) ) {
613
  exit;
admin/classes/class-addons-page.php CHANGED
@@ -12,6 +12,7 @@ class Forminator_Admin_Addons_page {
12
 
13
  /**
14
  * Plugin instance
 
15
  * @since 1.11
16
  * @access private
17
  * @var null
@@ -37,15 +38,8 @@ class Forminator_Admin_Addons_page {
37
  * @param $action
38
  */
39
  public function addons_action_ajax( $action ) {
40
- $pid = 0;
41
- $is_network = false;
42
-
43
- if ( isset( $_REQUEST['pid'] ) ) {
44
- $pid = intval( $_REQUEST['pid'] );
45
- }
46
- if ( isset( $_REQUEST['is_network'] ) ) {
47
- $is_network = ( 1 == intval( $_REQUEST['is_network'] ) );
48
- }
49
 
50
  switch ( $action ) {
51
  case 'addons-install':
@@ -56,18 +50,22 @@ class Forminator_Admin_Addons_page {
56
  $success = WPMUDEV_Dashboard::$upgrader->install( $pid );
57
  if ( $success ) {
58
  $html_addons = $this->addons_html( $pid );
59
- wp_send_json_success( array(
60
- 'message' => sprintf( __( '%s add-on was successfully installed', 'forminator' ), $this->get_addon_value( $pid, 'name' ) ),
61
- 'html' => $html_addons,
62
- ) );
 
 
63
  }
64
  }
65
  }
66
  }
67
  $err = WPMUDEV_Dashboard::$upgrader->get_error();
68
- wp_send_json_error( array(
69
- 'error' => $err,
70
- ) );
 
 
71
  break;
72
  case 'addons-activate':
73
  if ( $pid ) {
@@ -84,16 +82,18 @@ class Forminator_Admin_Addons_page {
84
  $errors['error'] = array(
85
  'file' => $pid,
86
  'code' => $result->get_error_code(),
87
- 'message' => $result->get_error_message()
88
  );
89
  wp_send_json_error( $errors );
90
  } else {
91
  WPMUDEV_Dashboard::$site->schedule_shutdown_refresh();
92
  $html_addons = $this->addons_html( $pid );
93
- wp_send_json_success( array(
94
- 'message' => sprintf( __( '%s add-on was successfully activated', 'forminator' ), $this->get_addon_value( $pid, 'name' ) ),
95
- 'html' => $html_addons,
96
- ) );
 
 
97
  }
98
  }
99
  break;
@@ -107,35 +107,39 @@ class Forminator_Admin_Addons_page {
107
  wp_send_json_error( $errors );
108
  }
109
 
110
- //Check that it's a valid plugin
111
  $valid = validate_plugin( $local['filename'] );
112
  if ( is_wp_error( $valid ) ) {
113
  $errors['error'] = array(
114
  'file' => $pid,
115
  'code' => $valid->get_error_code(),
116
- 'message' => $valid->get_error_message()
117
  );
118
  wp_send_json_error( $errors );
119
  }
120
 
121
  deactivate_plugins( $local['filename'], false, $is_network );
122
- //there is no return so we always call it a success
123
  WPMUDEV_Dashboard::$site->schedule_shutdown_refresh();
124
  $html_addons = $this->addons_html( $pid );
125
- wp_send_json_success( array(
126
- 'message' => sprintf( __( '%s add-on was successfully deactivated', 'forminator' ), $this->get_addon_value( $pid, 'name' ) ),
127
- 'html' => $html_addons,
128
- ) );
 
 
129
  }
130
  break;
131
  case 'addons-delete':
132
  if ( $pid ) {
133
  if ( WPMUDEV_Dashboard::$upgrader->delete_plugin( $pid ) ) {
134
  $html_addons = $this->addons_html( $pid );
135
- wp_send_json_success( array(
136
- 'message' => sprintf( __( '%s add-on was successfully deleted', 'forminator' ), $this->get_addon_value( $pid, 'name' ) ),
137
- 'html' => $html_addons,
138
- ) );
 
 
139
  } else {
140
  $err = WPMUDEV_Dashboard::$upgrader->get_error();
141
  wp_send_json_error( $err );
@@ -147,7 +151,7 @@ class Forminator_Admin_Addons_page {
147
  $success = WPMUDEV_Dashboard::$upgrader->upgrade( $pid );
148
 
149
  if ( ! $success ) {
150
- $error = WPMUDEV_Dashboard::$upgrader->get_error();
151
  $errors['error'] = array(
152
  'message' => $error['message'],
153
  );
@@ -155,10 +159,12 @@ class Forminator_Admin_Addons_page {
155
  }
156
 
157
  $html_addons = $this->addons_html( $pid );
158
- wp_send_json_success( array(
159
- 'message' => sprintf( __( '%s add-on was successfully updated', 'forminator' ), $this->get_addon_value( $pid, 'name' ) ),
160
- 'html' => $html_addons,
161
- ) );
 
 
162
  }
163
  break;
164
  default:
@@ -289,7 +295,7 @@ class Forminator_Admin_Addons_page {
289
  public function render_template( $file, $params = array(), $return = false ) {
290
 
291
  // Assign $file to a variable which is unlikely to be used by users of the method.
292
- extract( $params, EXTR_OVERWRITE ); // phpcs:ignore
293
 
294
  if ( $return ) {
295
  ob_start();
@@ -356,7 +362,7 @@ class Forminator_Admin_Addons_page {
356
  esc_html__( 'Offer users a trial period for your product before they start paying.', 'forminator' ),
357
  esc_html__( 'Use conditional logic to process payments based on form input field values.', 'forminator' ),
358
  );
359
- $stripe_addon->url = ( object ) array(
360
  'thumbnail' => 'https://wpmudev.com/wp-content/uploads/2021/08/forminator-stripe-logo.png',
361
  );
362
  $stripe_addon->changelog = array(
@@ -364,7 +370,7 @@ class Forminator_Admin_Addons_page {
364
  'time' => '1628782583',
365
  'version' => '1.0',
366
  'log' => '<p>- First public release</p>',
367
- )
368
  );
369
 
370
  return array( $stripe_addon );
12
 
13
  /**
14
  * Plugin instance
15
+ *
16
  * @since 1.11
17
  * @access private
18
  * @var null
38
  * @param $action
39
  */
40
  public function addons_action_ajax( $action ) {
41
+ $pid = intval( Forminator_Core::sanitize_text_field( 'pid' ) );
42
+ $is_network = 1 === intval( Forminator_Core::sanitize_text_field( 'is_network' ) );
 
 
 
 
 
 
 
43
 
44
  switch ( $action ) {
45
  case 'addons-install':
50
  $success = WPMUDEV_Dashboard::$upgrader->install( $pid );
51
  if ( $success ) {
52
  $html_addons = $this->addons_html( $pid );
53
+ wp_send_json_success(
54
+ array(
55
+ 'message' => sprintf( __( '%s add-on was successfully installed', 'forminator' ), $this->get_addon_value( $pid, 'name' ) ),
56
+ 'html' => $html_addons,
57
+ )
58
+ );
59
  }
60
  }
61
  }
62
  }
63
  $err = WPMUDEV_Dashboard::$upgrader->get_error();
64
+ wp_send_json_error(
65
+ array(
66
+ 'error' => $err,
67
+ )
68
+ );
69
  break;
70
  case 'addons-activate':
71
  if ( $pid ) {
82
  $errors['error'] = array(
83
  'file' => $pid,
84
  'code' => $result->get_error_code(),
85
+ 'message' => $result->get_error_message(),
86
  );
87
  wp_send_json_error( $errors );
88
  } else {
89
  WPMUDEV_Dashboard::$site->schedule_shutdown_refresh();
90
  $html_addons = $this->addons_html( $pid );
91
+ wp_send_json_success(
92
+ array(
93
+ 'message' => sprintf( __( '%s add-on was successfully activated', 'forminator' ), $this->get_addon_value( $pid, 'name' ) ),
94
+ 'html' => $html_addons,
95
+ )
96
+ );
97
  }
98
  }
99
  break;
107
  wp_send_json_error( $errors );
108
  }
109
 
110
+ // Check that it's a valid plugin.
111
  $valid = validate_plugin( $local['filename'] );
112
  if ( is_wp_error( $valid ) ) {
113
  $errors['error'] = array(
114
  'file' => $pid,
115
  'code' => $valid->get_error_code(),
116
+ 'message' => $valid->get_error_message(),
117
  );
118
  wp_send_json_error( $errors );
119
  }
120
 
121
  deactivate_plugins( $local['filename'], false, $is_network );
122
+ // there is no return so we always call it a success.
123
  WPMUDEV_Dashboard::$site->schedule_shutdown_refresh();
124
  $html_addons = $this->addons_html( $pid );
125
+ wp_send_json_success(
126
+ array(
127
+ 'message' => sprintf( __( '%s add-on was successfully deactivated', 'forminator' ), $this->get_addon_value( $pid, 'name' ) ),
128
+ 'html' => $html_addons,
129
+ )
130
+ );
131
  }
132
  break;
133
  case 'addons-delete':
134
  if ( $pid ) {
135
  if ( WPMUDEV_Dashboard::$upgrader->delete_plugin( $pid ) ) {
136
  $html_addons = $this->addons_html( $pid );
137
+ wp_send_json_success(
138
+ array(
139
+ 'message' => sprintf( __( '%s add-on was successfully deleted', 'forminator' ), $this->get_addon_value( $pid, 'name' ) ),
140
+ 'html' => $html_addons,
141
+ )
142
+ );
143
  } else {
144
  $err = WPMUDEV_Dashboard::$upgrader->get_error();
145
  wp_send_json_error( $err );
151
  $success = WPMUDEV_Dashboard::$upgrader->upgrade( $pid );
152
 
153
  if ( ! $success ) {
154
+ $error = WPMUDEV_Dashboard::$upgrader->get_error();
155
  $errors['error'] = array(
156
  'message' => $error['message'],
157
  );
159
  }
160
 
161
  $html_addons = $this->addons_html( $pid );
162
+ wp_send_json_success(
163
+ array(
164
+ 'message' => sprintf( __( '%s add-on was successfully updated', 'forminator' ), $this->get_addon_value( $pid, 'name' ) ),
165
+ 'html' => $html_addons,
166
+ )
167
+ );
168
  }
169
  break;
170
  default:
295
  public function render_template( $file, $params = array(), $return = false ) {
296
 
297
  // Assign $file to a variable which is unlikely to be used by users of the method.
298
+ extract( $params, EXTR_OVERWRITE ); // phpcs:ignore WordPress.PHP.DontExtract.extract_extract
299
 
300
  if ( $return ) {
301
  ob_start();
362
  esc_html__( 'Offer users a trial period for your product before they start paying.', 'forminator' ),
363
  esc_html__( 'Use conditional logic to process payments based on form input field values.', 'forminator' ),
364
  );
365
+ $stripe_addon->url = (object) array(
366
  'thumbnail' => 'https://wpmudev.com/wp-content/uploads/2021/08/forminator-stripe-logo.png',
367
  );
368
  $stripe_addon->changelog = array(
370
  'time' => '1628782583',
371
  'version' => '1.0',
372
  'log' => '<p>- First public release</p>',
373
+ ),
374
  );
375
 
376
  return array( $stripe_addon );
admin/classes/class-admin-ajax.php CHANGED
@@ -16,17 +16,17 @@ class Forminator_Admin_AJAX {
16
  * @since 1.0
17
  */
18
  public function __construct() {
19
- // Handle close welcome box
20
  add_action( 'wp_ajax_forminator_dismiss_welcome', array( $this, 'dismiss_welcome' ) );
21
  add_action( 'wp_ajax_nopriv_forminator_dismiss_welcome', array( $this, 'dismiss_welcome' ) );
22
 
23
- // Handle load google fonts
24
  add_action( 'wp_ajax_forminator_load_google_fonts', array( $this, 'load_google_fonts' ) );
25
 
26
- // Handle load reCaptcha preview
27
  add_action( 'wp_ajax_forminator_load_recaptcha_preview', array( $this, 'load_recaptcha_preview' ) );
28
 
29
- // Handle save settings
30
  add_action( 'wp_ajax_forminator_save_builder', array( $this, 'save_builder' ) );
31
  add_action( 'wp_ajax_forminator_save_poll', array( $this, 'save_poll_form' ) );
32
  add_action( 'wp_ajax_forminator_save_quiz_nowrong', array( $this, 'save_quiz' ) );
@@ -34,7 +34,7 @@ class Forminator_Admin_AJAX {
34
  add_action( 'wp_ajax_forminator_save_login', array( $this, 'save_login' ) );
35
  add_action( 'wp_ajax_forminator_save_register', array( $this, 'save_register' ) );
36
 
37
- // Handle settings popups
38
  add_action( 'wp_ajax_forminator_load_captcha_popup', array( $this, 'load_captcha' ) );
39
  add_action( 'wp_ajax_forminator_save_captcha_popup', array( $this, 'save_captcha' ) );
40
 
@@ -56,11 +56,11 @@ class Forminator_Admin_AJAX {
56
  add_action( 'wp_ajax_forminator_load_preview_polls_popup', array( $this, 'preview_module' ) );
57
  add_action( 'wp_ajax_forminator_load_preview_quizzes_popup', array( $this, 'preview_module' ) );
58
 
59
- // Handle exports popup
60
  add_action( 'wp_ajax_forminator_load_exports_popup', array( $this, 'load_exports' ) );
61
  add_action( 'wp_ajax_forminator_clear_exports_popup', array( $this, 'clear_exports' ) );
62
 
63
- // Handle search user email
64
  add_action( 'wp_ajax_forminator_builder_search_emails', array( $this, 'search_emails' ) );
65
 
66
  add_action( 'wp_ajax_forminator_load_privacy_settings_popup', array( $this, 'load_privacy_settings' ) );
@@ -70,14 +70,14 @@ class Forminator_Admin_AJAX {
70
  add_action( 'wp_ajax_forminator_load_import_custom_form_popup', array( $this, 'load_import' ) );
71
  add_action( 'wp_ajax_forminator_save_import_custom_form_popup', array( $this, 'save_import' ) );
72
 
73
- add_action( "wp_ajax_forminator_load_import_custom_form_cf7_popup", array( $this, "load_import_custom_form_cf7" ) );
74
- add_action( "wp_ajax_forminator_save_import_custom_form_cf7_popup", array( $this, "save_import_custom_form_cf7" ) );
75
 
76
- add_action( "wp_ajax_forminator_load_import_custom_form_ninja_popup", array( $this, "load_import_custom_form_ninja" ) );
77
- add_action( "wp_ajax_forminator_save_import_custom_form_ninja_popup", array( $this, "save_import_custom_form_ninja" ) );
78
 
79
- add_action( "wp_ajax_forminator_load_import_custom_form_gravity_popup", array( $this, "load_import_custom_form_gravity" ) );
80
- add_action( "wp_ajax_forminator_save_import_custom_form_gravity_popup", array( $this, "save_import_custom_form_gravity" ) );
81
 
82
  add_action( 'wp_ajax_forminator_load_export_poll_popup', array( $this, 'load_export' ) );
83
  add_action( 'wp_ajax_forminator_load_import_poll_popup', array( $this, 'load_import' ) );
@@ -115,6 +115,8 @@ class Forminator_Admin_AJAX {
115
  add_action( 'wp_ajax_forminator_module_search', array( $this, 'module_search' ) );
116
  add_action( 'wp_ajax_forminator_load_addons_page_details_popup', array( $this, 'addons_page_details' ) );
117
 
 
 
118
  // Process ajax actions.
119
  $ajax_actions = array(
120
  'forminator_addons-install',
@@ -132,7 +134,7 @@ class Forminator_Admin_AJAX {
132
  * Save quizzes
133
  *
134
  * @since 1.0
135
- * @since 1.1 change $_POST to `get_post_data`
136
  */
137
  public function save_quiz() {
138
  if ( ! forminator_is_user_allowed() ) {
@@ -144,25 +146,24 @@ class Forminator_Admin_AJAX {
144
  $submitted_data = $this->get_post_data();
145
 
146
  $quiz_data = array();
147
- if ( isset( $submitted_data['data'] ) ) {
148
- $quiz_data = $submitted_data['data'];
149
- $quiz_data = json_decode( stripslashes( $quiz_data ), true );
150
  }
151
 
152
- $id = isset( $submitted_data['form_id'] ) ? intval( $submitted_data['form_id'] ) : 0;
153
- $settings = isset( $quiz_data['settings'] ) ? $quiz_data['settings'] : array();
154
- $title = isset( $submitted_data['quiz_title'] ) ? sanitize_text_field( $submitted_data['quiz_title'] ) : sanitize_text_field( $submitted_data['formName'] );
155
- $status = isset( $submitted_data['status'] ) ? sanitize_text_field( $submitted_data['status'] ) : '';
156
- $version = isset( $submitted_data['version'] ) ? sanitize_text_field( $submitted_data['version'] ) : '1.0';
157
- $template = new stdClass();
158
 
159
  $template->type = isset( $submitted_data['action'] ) ? $submitted_data['action'] : '';
160
- // Check if results exist
161
  if ( isset( $quiz_data['results'] ) && is_array( $quiz_data['results'] ) ) {
162
  $template->results = $quiz_data['results'];
163
  }
164
 
165
- // Check if answers exist
166
  if ( isset( $quiz_data['questions'] ) ) {
167
  $template->questions = $quiz_data['questions'];
168
  }
@@ -189,7 +190,7 @@ class Forminator_Admin_AJAX {
189
  * Save poll
190
  *
191
  * @since 1.0
192
- * @since 1.1 change $_POST to `get_post_data`
193
  */
194
  public function save_poll_form() {
195
  if ( ! forminator_is_user_allowed() ) {
@@ -200,16 +201,15 @@ class Forminator_Admin_AJAX {
200
 
201
  $submitted_data = $this->get_post_data();
202
  $poll_data = array();
203
- if ( isset( $submitted_data['data'] ) ) {
204
- $poll_data = $submitted_data['data'];
205
- $poll_data = json_decode( stripslashes( $poll_data ), true );
206
  }
207
 
208
  $settings = isset( $poll_data['settings'] ) ? $poll_data['settings'] : array();
209
  $id = isset( $submitted_data['form_id'] ) ? intval( $submitted_data['form_id'] ) : 0;
210
- $title = sanitize_text_field( $submitted_data['formName'] );
211
- $status = isset( $submitted_data['status'] ) ? sanitize_text_field( $submitted_data['status'] ) : '';
212
- $version = isset( $submitted_data['version'] ) ? sanitize_text_field( $submitted_data['version'] ) : '1.0';
213
  $template = new stdClass();
214
 
215
  if ( isset( $poll_data['answers'] ) ) {
@@ -240,15 +240,18 @@ class Forminator_Admin_AJAX {
240
  forminator_validate_ajax( 'forminator_save_builder_fields' );
241
 
242
  $submitted_data = $this->get_post_data();
243
- $form_data = $submitted_data['data'];
244
- $form_data = json_decode( stripslashes( $form_data ), true );
245
  $fields = array();
246
  $id = isset( $submitted_data['form_id'] ) ? intval( $submitted_data['form_id'] ) : 0;
247
- $title = sanitize_text_field( $submitted_data['formName'] );
248
- $status = isset( $submitted_data['status'] ) ? sanitize_text_field( $submitted_data['status'] ) : '';
249
- $version = isset( $submitted_data['version'] ) ? sanitize_text_field( $submitted_data['version'] ) : '1.0';
250
  $template = new stdClass();
251
- $action = false;
 
 
 
 
252
 
253
  if ( is_null( $id ) || $id <= 0 ) {
254
  $form_model = new Forminator_Form_Model();
@@ -269,7 +272,7 @@ class Forminator_Admin_AJAX {
269
  $status = $form_model->status;
270
  }
271
 
272
- //we need to empty fields cause we will send new data
273
  $form_model->clear_fields();
274
  }
275
 
@@ -284,7 +287,7 @@ class Forminator_Admin_AJAX {
284
  $template->notifications = $form_data['notifications'];
285
  }
286
 
287
- // Sanitize settings
288
  $settings = $form_data['settings'];
289
  $settings['version'] = $version;
290
  $template->settings = $settings;
@@ -311,12 +314,10 @@ class Forminator_Admin_AJAX {
311
  forminator_validate_ajax( 'forminator_save_builder_fields' );
312
 
313
  $submitted_data = $this->get_post_data();
314
- $fields = array();
315
- $id = isset( $submitted_data['form_id'] ) ? $submitted_data['form_id'] : null;
316
- $id = intval( $id );
317
- $title = sanitize_text_field( $submitted_data['formName'] );
318
- $status = isset( $submitted_data['status'] ) ? sanitize_text_field( $submitted_data['status'] ) : '';
319
- $version = isset( $submitted_data['version'] ) ? sanitize_text_field( $submitted_data['version'] ) : '1.0';
320
 
321
  if ( is_null( $id ) || $id <= 0 ) {
322
  $form_model = new Forminator_Form_Model();
@@ -324,7 +325,6 @@ class Forminator_Admin_AJAX {
324
  if ( empty( $status ) ) {
325
  $status = Forminator_Form_Model::STATUS_PUBLISH;
326
  }
327
-
328
  } else {
329
  $form_model = Forminator_Form_Model::model()->load( $id );
330
 
@@ -337,40 +337,19 @@ class Forminator_Admin_AJAX {
337
  }
338
  $form_model->set_var_in_array( 'name', 'formName', $submitted_data, 'forminator_sanitize_field' );
339
 
340
- // Sanitize settings
341
- $settings = forminator_sanitize_field( $submitted_data['data'] );
342
-
343
- // Sanitize custom css
344
- if ( isset( $submitted_data['data']['custom_css'] ) ) {
345
- $settings['custom_css'] = sanitize_textarea_field( $submitted_data['data']['custom_css'] );
346
- }
347
-
348
- // Sanitize thank you message
349
- if ( isset( $submitted_data['data']['thankyou-message'] ) ) {
350
- $settings['thankyou-message'] = $submitted_data['data']['thankyou-message'];
351
- }
352
-
353
- // Sanitize user email message
354
- if ( isset( $submitted_data['data']['user-email-editor'] ) ) {
355
- $settings['user-email-editor'] = $submitted_data['data']['user-email-editor'];
356
- }
357
-
358
- // Sanitize admin email message
359
- if ( isset( $submitted_data['data']['admin-email-editor'] ) ) {
360
- $settings['admin-email-editor'] = $submitted_data['data']['admin-email-editor'];
361
- }
362
 
363
  $settings['formName'] = $title;
364
  $settings['version'] = $version;
365
  $form_model->settings = $settings;
366
 
367
- // status
368
  $form_model->status = $status;
369
 
370
- // Save data
371
  $id = $form_model->save();
372
 
373
- // add privacy settings to global option
374
  $override_privacy = false;
375
  if ( isset( $settings['enable-submissions-retention'] ) ) {
376
  $override_privacy = filter_var( $settings['enable-submissions-retention'], FILTER_VALIDATE_BOOLEAN );
@@ -396,8 +375,8 @@ class Forminator_Admin_AJAX {
396
  /**
397
  * Load existing custom field keys
398
  *
399
- * @since 1.0
400
  * @return string JSON
 
401
  */
402
  public function load_existing_cfields() {
403
 
@@ -444,7 +423,7 @@ class Forminator_Admin_AJAX {
444
  public function load_google_fonts() {
445
  forminator_validate_ajax( 'forminator_load_google_fonts' );
446
 
447
- $is_object = isset( $_POST['data']['isObject'] ) ? sanitize_text_field( $_POST['data']['isObject'] ) : false;// phpcs:ignore -- by forminator_validate_ajax
448
 
449
  $fonts = forminator_get_font_families( $is_object );
450
  wp_send_json_success( $fonts );
@@ -456,7 +435,7 @@ class Forminator_Admin_AJAX {
456
  * @since 1.0
457
  */
458
  public function load_captcha() {
459
- // Validate nonce
460
  forminator_validate_ajax( 'forminator_popup_captcha' );
461
 
462
  $html = forminator_template( 'settings/popup/edit-captcha-content' );
@@ -470,19 +449,19 @@ class Forminator_Admin_AJAX {
470
  * @since 1.0
471
  */
472
  public function save_captcha() {
473
- // Validate nonce
474
  forminator_validate_ajax( 'forminator_save_popup_captcha' );
475
 
476
- update_option( "forminator_captcha_key", sanitize_text_field( $_POST['v2_captcha_key'] ) );
477
- update_option( "forminator_captcha_secret", sanitize_text_field( $_POST['v2_captcha_secret'] ) );
478
 
479
- update_option( "forminator_v2_invisible_captcha_key", sanitize_text_field( $_POST['v2_invisible_captcha_key'] ) );
480
- update_option( "forminator_v2_invisible_captcha_secret", sanitize_text_field( $_POST['v2_invisible_captcha_secret'] ) );
481
 
482
- update_option( "forminator_v3_captcha_key", sanitize_text_field( $_POST['v3_captcha_key'] ) );
483
- update_option( "forminator_v3_captcha_secret", sanitize_text_field( $_POST['v3_captcha_secret'] ) );
484
 
485
- update_option( "forminator_captcha_language", sanitize_text_field( $_POST['captcha_language'] ) );
486
 
487
  wp_send_json_success();
488
  }
@@ -506,10 +485,10 @@ class Forminator_Admin_AJAX {
506
  * @since 1.0
507
  */
508
  public function save_currency() {
509
- // Validate nonce
510
  forminator_validate_ajax( 'forminator_save_popup_currency' );
511
 
512
- update_option( "forminator_currency", sanitize_text_field( $_POST['currency'] ) );
513
 
514
  wp_send_json_success();
515
  }
@@ -520,7 +499,7 @@ class Forminator_Admin_AJAX {
520
  * @since 1.0.2
521
  */
522
  public function load_pagination_entries() {
523
- // Validate nonce
524
  forminator_validate_ajax( 'forminator_popup_pagination_entries' );
525
 
526
  $html = forminator_template( 'settings/popup/edit-pagination-entries-content' );
@@ -538,7 +517,7 @@ class Forminator_Admin_AJAX {
538
  $language = get_option( 'forminator_captcha_language', '' );
539
  $language = ! empty( $language ) ? $language : $site_language;
540
 
541
- $captcha = sanitize_text_field( $_POST['captcha'] );// phpcs:ignore -- data without nonce verification
542
 
543
  if ( 'v2-invisible' === $captcha ) {
544
  $captcha_key = get_option( 'forminator_v2_invisible_captcha_key', '' );
@@ -575,7 +554,7 @@ class Forminator_Admin_AJAX {
575
  * @since 1.0.2
576
  */
577
  public function load_pagination_listings() {
578
- // Validate nonce
579
  forminator_validate_ajax( 'forminator_popup_pagination_listings' );
580
 
581
  $html = forminator_template( 'settings/popup/edit-pagination-listings-content' );
@@ -589,10 +568,10 @@ class Forminator_Admin_AJAX {
589
  * @since 1.0.2
590
  */
591
  public function save_pagination_listings() {
592
- // Validate nonce
593
  forminator_validate_ajax( 'forminator_save_popup_pagination_listings' );
594
 
595
- $pagination = intval( sanitize_text_field( $_POST['pagination_listings'] ) );
596
 
597
  if ( 0 < $pagination ) {
598
 
@@ -613,7 +592,7 @@ class Forminator_Admin_AJAX {
613
  * @since 1.1
614
  */
615
  public function load_email_form() {
616
- // Validate nonce
617
  forminator_validate_ajax( 'forminator_load_popup_email_settings' );
618
 
619
  $html = forminator_template( 'settings/popup/edit-email-content' );
@@ -627,7 +606,7 @@ class Forminator_Admin_AJAX {
627
  * @since 1.0.2
628
  */
629
  public function load_uninstall_form() {
630
- // Validate nonce
631
  forminator_validate_ajax( 'forminator_popup_uninstall_form' );
632
 
633
  $html = forminator_template( 'settings/popup/edit-uninstall-content' );
@@ -642,10 +621,10 @@ class Forminator_Admin_AJAX {
642
  * @since 1.0.2
643
  */
644
  public function save_uninstall_form() {
645
- // Validate nonce
646
  forminator_validate_ajax( 'forminator_save_popup_uninstall_settings' );
647
 
648
- $delete_uninstall = isset( $_POST['delete_uninstall'] ) ? sanitize_text_field( $_POST['delete_uninstall'] ) : false;
649
  $delete_uninstall = filter_var( $delete_uninstall, FILTER_VALIDATE_BOOLEAN );
650
 
651
  update_option( 'forminator_uninstall_clear_data', $delete_uninstall );
@@ -671,22 +650,23 @@ class Forminator_Admin_AJAX {
671
  $slug = 'quiz';
672
  }
673
 
674
- // Validate nonce
675
  forminator_validate_ajax( 'forminator_popup_preview_' . $slug );
676
 
677
  $preview_data = false;
678
- // force -1 for preview
679
- $form_id = isset( $_POST['id'] ) ? intval( $_POST['id'] ) : -1;// phpcs:ignore -- by forminator_validate_ajax
 
680
 
681
- // Check if preview data set
682
  if ( ! empty( $_POST['data'] ) ) {
683
- $data = $_POST['data']; // WPCS: CSRF ok by forminator_validate_ajax.
684
 
685
  if ( ! is_array( $data ) ) {
686
- $data = json_decode( stripslashes( $data ), true );
687
  }
688
  $function = 'forminator_data_to_model_' . $slug;
689
- $preview_data = $function( $data );// phpcs:ignore -- by forminator_validate_ajax
690
  }
691
 
692
  $html = forminator_preview( $form_id, $slug, true, $preview_data );
@@ -700,10 +680,10 @@ class Forminator_Admin_AJAX {
700
  * @since 1.0
701
  */
702
  public function load_exports() {
703
- // Validate nonce
704
  forminator_validate_ajax( 'forminator_load_exports' );
705
 
706
- $form_id = isset( $_POST['id'] ) && $_POST['id'] >= 0 ? intval( $_POST['id'] ) : false;
707
 
708
  if ( $form_id ) {
709
  $args = array(
@@ -722,10 +702,10 @@ class Forminator_Admin_AJAX {
722
  * @since 1.0
723
  */
724
  public function clear_exports() {
725
- // Validate nonce
726
- forminator_validate_ajax( "forminator_clear_exports" );
727
 
728
- $form_id = isset( $_POST['id'] ) && $_POST['id'] >= 0 ? intval( $_POST['id'] ) : false;
729
 
730
  if ( ! $form_id ) {
731
  wp_send_json_error( __( 'No ID was provided.', 'forminator' ) );
@@ -744,7 +724,7 @@ class Forminator_Admin_AJAX {
744
  * Search Emails
745
  *
746
  * @since 1.0.3
747
- * @since 1.1 change $_POST to `get_post_data`
748
  */
749
  public function search_emails() {
750
  forminator_validate_ajax( 'forminator_search_emails' );
@@ -754,11 +734,11 @@ class Forminator_Admin_AJAX {
754
 
755
  $submitted_data = $this->get_post_data();
756
 
757
- //TODO : add ajax validate here and js admin too
758
- $admin_email = ( ( isset( $submitted_data['admin_email'] ) && $submitted_data['admin_email'] ) ? true : false );
759
- $search_email = ( ( isset( $submitted_data['q'] ) && $submitted_data['q'] ) ? sanitize_text_field( $submitted_data['q'] ) : false );
760
 
761
- // return admin_email when requested
762
  if ( $admin_email ) {
763
  wp_send_json_success( get_option( 'admin_email' ) );
764
  }
@@ -777,12 +757,13 @@ class Forminator_Admin_AJAX {
777
  /**
778
  * Filter args to be passed on to get_users
779
  *
 
 
 
780
  * @see get_users()
781
  *
782
  * @since 1.2
783
  *
784
- * @param array $args
785
- * @param string $search_email string to search
786
  */
787
  $args = apply_filters( 'forminator_builder_search_emails_args', $args, $search_email );
788
 
@@ -801,12 +782,13 @@ class Forminator_Admin_AJAX {
801
  /**
802
  * Filter returned data when builder search emails
803
  *
 
 
 
 
 
804
  * @since 1.2
805
  *
806
- * @param array $data
807
- * @param array $users search result of get_users
808
- * @param array $args current query args passed to get_users
809
- * @param string $search_email string to search
810
  */
811
  $data = apply_filters( 'forminator_builder_search_emails_data', $data, $users, $args, $search_email );
812
 
@@ -814,30 +796,29 @@ class Forminator_Admin_AJAX {
814
  }
815
 
816
  /**
817
- * Get $_POST data
818
- *
819
- * @since 1.1
820
  *
821
- * @param string $nonce_action action to validate
822
- * @param array $sanitize_callbacks {
823
  * custom sanitize options, its assoc array
824
  * 'field_name_1' => 'function_to_call_1' function will called with `call_user_func_array`,
825
  * 'field_name_2' => 'function_to_call_2',
826
  * }
827
  *
828
  * @return array
 
 
829
  */
830
  protected function get_post_data( $nonce_action = '', $sanitize_callbacks = array() ) {
831
- // do nonce / caps check when requested
832
  if ( ! empty( $nonce_action ) ) {
833
- // it will wp_send_json_error
834
  forminator_validate_ajax( $nonce_action );
835
  }
836
 
837
- // TODO : mark this as phpcs comply after checking usages of this function
838
- $post_data = $_POST;// phpcs:ignore -- by forminator_validate_ajax
839
 
840
- // do some sanitize
841
  foreach ( $sanitize_callbacks as $field => $sanitize_func ) {
842
  if ( isset( $post_data[ $field ] ) ) {
843
  if ( is_callable( $sanitize_func ) ) {
@@ -846,7 +827,7 @@ class Forminator_Admin_AJAX {
846
  }
847
  }
848
 
849
- // do some validation
850
 
851
  return $post_data;
852
  }
@@ -857,7 +838,7 @@ class Forminator_Admin_AJAX {
857
  * @since 1.0.6
858
  */
859
  public function load_privacy_settings() {
860
- // Validate nonce
861
  forminator_validate_ajax( 'forminator_popup_privacy_settings' );
862
 
863
  $html = forminator_template( 'settings/popup/edit-privacy-settings' );
@@ -871,117 +852,106 @@ class Forminator_Admin_AJAX {
871
  * @since 1.0.6
872
  */
873
  public function save_privacy_settings() {
874
- // Validate nonce
875
  forminator_validate_ajax( 'forminator_save_privacy_settings' );
876
- $post_data = $_POST;// phpcs:ignore -- by forminator_validate_ajax
877
 
878
  /**
879
  * CUSTOM FORMS
880
  */
881
- // Account Erasure Requests
882
  if ( isset( $post_data['erase_form_submissions'] ) ) {
883
- $post_data['erase_form_submissions'] = sanitize_text_field( $post_data['erase_form_submissions'] );
884
  $enable_erasure_request_erase_form_submissions = filter_var( $post_data['erase_form_submissions'], FILTER_VALIDATE_BOOLEAN );
885
  update_option( 'forminator_enable_erasure_request_erase_form_submissions', $enable_erasure_request_erase_form_submissions );
886
  }
887
- // Account Erasure Requests
888
 
889
- // Submissions Retention
890
  $cform_retain_forever = filter_var( $post_data['form_retain_submission_forever'], FILTER_VALIDATE_BOOLEAN );
891
  update_option( 'retain_submission_forever', $cform_retain_forever );
892
  if ( $cform_retain_forever ) {
893
  $post_data['form_retain_submission_number'] = 0;
894
  }
895
  if ( isset( $post_data['form_retain_submission_number'] ) ) {
896
- $post_data['form_retain_submission_number'] = sanitize_text_field( $post_data['form_retain_submission_number'] );
897
- $post_data['form_retain_submission_unit'] = sanitize_text_field( $post_data['form_retain_submission_unit'] );
898
- $submissions_retention_number = intval( $post_data['form_retain_submission_number'] );
899
  if ( $submissions_retention_number < 0 ) {
900
  $submissions_retention_number = 0;
901
  }
902
  update_option( 'forminator_retain_submissions_interval_number', $submissions_retention_number );
903
  }
904
  update_option( 'forminator_retain_submissions_interval_unit', $post_data['form_retain_submission_unit'] );
905
- // Submissions Retention
906
 
907
- // IP Retention
908
  $cform_retain_ip_forever = filter_var( $post_data['form_retain_ip_forever'], FILTER_VALIDATE_BOOLEAN );
909
  update_option( 'retain_ip_forever', $cform_retain_ip_forever );
910
  if ( $cform_retain_ip_forever ) {
911
  $post_data['form_retain_ip_number'] = 0;
912
  }
913
  if ( isset( $post_data['form_retain_ip_number'] ) ) {
914
- $post_data['form_retain_ip_number'] = sanitize_text_field( $post_data['form_retain_ip_number'] );
915
- $post_data['form_retain_ip_unit'] = sanitize_text_field( $post_data['form_retain_ip_unit'] );
916
- $cform_ip_retention_number = intval( $post_data['form_retain_ip_number'] );
917
  if ( $cform_ip_retention_number < 0 ) {
918
  $cform_ip_retention_number = 0;
919
  }
920
  update_option( 'forminator_retain_ip_interval_number', $cform_ip_retention_number );
921
  }
922
  update_option( 'forminator_retain_ip_interval_unit', $post_data['form_retain_ip_unit'] );
923
- // IP Retention
924
 
925
  /**
926
  * POLLS
927
  */
928
- // Submissions Retention
929
  $poll_retain_submissions_forever = filter_var( $post_data['poll_retain_submission_forever'], FILTER_VALIDATE_BOOLEAN );
930
  update_option( 'poll_retain_submission_forever', $poll_retain_submissions_forever );
931
  if ( $poll_retain_submissions_forever ) {
932
  $post_data['poll_retain_submission_number'] = 0;
933
  }
934
- // Polls
935
  if ( isset( $post_data['poll_retain_submission_number'] ) ) {
936
- $post_data['poll_retain_submission_number'] = sanitize_text_field( $post_data['poll_retain_submission_number'] );
937
- $post_data['poll_retain_submission_unit'] = sanitize_text_field( $post_data['poll_retain_submission_unit'] );
938
- $poll_submissions_retention_number = intval( $post_data['poll_retain_submission_number'] );
939
  if ( $poll_submissions_retention_number < 0 ) {
940
  $poll_submissions_retention_number = 0;
941
  }
942
  update_option( 'forminator_retain_poll_submissions_interval_number', $poll_submissions_retention_number );
943
  }
944
  update_option( 'forminator_retain_poll_submissions_interval_unit', $post_data['poll_retain_submission_unit'] );
945
- // Submissions Retention
946
 
947
- // IP Retention
948
  $poll_retain_ip_forever = filter_var( $post_data['poll_retain_ip_forever'], FILTER_VALIDATE_BOOLEAN );
949
  update_option( 'retain_poll_forever', $poll_retain_ip_forever );
950
  if ( $poll_retain_ip_forever ) {
951
  $post_data['poll_retain_ip_number'] = 0;
952
  }
953
  if ( isset( $post_data['poll_retain_ip_number'] ) ) {
954
- $post_data['poll_retain_ip_number'] = sanitize_text_field( $post_data['poll_retain_ip_number'] );
955
- $post_data['poll_retain_ip_unit'] = sanitize_text_field( $post_data['poll_retain_ip_unit'] );
956
- $votes_retention_number = intval( $post_data['poll_retain_ip_number'] );
957
  if ( $votes_retention_number < 0 ) {
958
  $votes_retention_number = 0;
959
  }
960
  update_option( 'forminator_retain_votes_interval_number', $votes_retention_number );
961
  }
962
  update_option( 'forminator_retain_votes_interval_unit', $post_data['poll_retain_ip_unit'] );
963
- // IP Retention
964
 
965
  /**
966
  * QUIZ
967
  */
968
- // Submissions Retention
969
  $quiz_retain_submissions_forever = filter_var( $post_data['quiz_retain_submission_forever'], FILTER_VALIDATE_BOOLEAN );
970
  update_option( 'quiz_retain_submission_forever', $quiz_retain_submissions_forever );
971
  if ( $quiz_retain_submissions_forever ) {
972
  $post_data['quiz_retain_submission_number'] = 0;
973
  }
974
  if ( isset( $post_data['quiz_retain_submission_number'] ) ) {
975
- $post_data['quiz_retain_submission_number'] = sanitize_text_field( $post_data['quiz_retain_submission_number'] );
976
- $post_data['quiz_retain_submission_unit'] = sanitize_text_field( $post_data['quiz_retain_submission_unit'] );
977
- $quiz_submissions_retention_number = intval( $post_data['quiz_retain_submission_number'] );
978
  if ( $quiz_submissions_retention_number < 0 ) {
979
  $quiz_submissions_retention_number = 0;
980
  }
981
  update_option( 'forminator_retain_quiz_submissions_interval_number', $quiz_submissions_retention_number );
982
  }
983
  update_option( 'forminator_retain_quiz_submissions_interval_unit', $post_data['quiz_retain_submission_unit'] );
984
- // Submissions Retention
985
 
986
  wp_send_json_success();
987
  }
@@ -1017,15 +987,14 @@ class Forminator_Admin_AJAX {
1017
  if ( 'custom_form' === $slug ) {
1018
  $slug = 'form';
1019
  }
1020
- // Validate nonce
1021
  forminator_validate_ajax( 'forminator_save_import_' . $slug );
1022
 
1023
- $post_data = $this->get_post_data();
1024
- $importable = isset( $post_data['importable'] ) ? wp_unslash( trim( $post_data['importable'] ) ) : '';// wpcs: CSRF ok
1025
 
1026
  $import_data = json_decode( $importable, true );
1027
 
1028
- //hook custom data here
1029
  $import_data = apply_filters( 'forminator_' . $slug . '_import_data', $import_data );
1030
 
1031
  try {
@@ -1078,16 +1047,19 @@ class Forminator_Admin_AJAX {
1078
 
1079
  switch ( $type ) {
1080
  case 'cf7':
1081
- if ( class_exists( 'Forminator_Admin_Import_CF7' ) )
1082
  $class = new Forminator_Admin_Import_CF7();
 
1083
  break;
1084
  case 'ninja':
1085
- if ( class_exists( 'Forminator_Admin_Import_Ninja' ) )
1086
- $class = new Forminator_Admin_Import_Ninja();
 
1087
  break;
1088
  case 'gravity':
1089
- if ( class_exists( 'Forminator_Admin_Import_Gravity' ) )
1090
- return new Forminator_Admin_Import_Gravity();
 
1091
  break;
1092
  default:
1093
  break;
@@ -1103,11 +1075,11 @@ class Forminator_Admin_AJAX {
1103
  * @since 1.5
1104
  */
1105
  public function load_import_custom_form_cf7() {
1106
- if ( ! Forminator::is_import_export_feature_enabled() || ! forminator_is_import_plugin_enabled('cf7') ) {
1107
  wp_send_json_success( '' );
1108
  }
1109
- // Validate nonce
1110
- forminator_validate_ajax( "forminator_popup_import_cform_cf7" );
1111
 
1112
  $html = forminator_template( 'custom-form/popup/import-cf7' );
1113
 
@@ -1126,11 +1098,11 @@ class Forminator_Admin_AJAX {
1126
  if ( ! Forminator::is_import_export_feature_enabled() || ! forminator_is_import_plugin_enabled( 'cf7' ) ) {
1127
  wp_send_json_error( __( 'Import Export Feature disabled.', 'forminator' ) );
1128
  }
1129
- // Validate nonce
1130
- forminator_validate_ajax( "forminator_save_import_custom_form_cf7" );
1131
 
1132
  $post_data = $this->get_post_data();
1133
- $importable = ( isset( $post_data['cf7_forms'] ) ? $post_data['cf7_forms'] : '' );// wpcs: CSRF ok
1134
  $importer = $this->importers( 'cf7' );
1135
  if ( ! empty( $importer ) ) :
1136
  if ( ! empty( $importable ) ) {
@@ -1171,11 +1143,11 @@ class Forminator_Admin_AJAX {
1171
  * @since 1.5
1172
  */
1173
  public function load_import_custom_form_ninja() {
1174
- if ( ! Forminator::is_import_export_feature_enabled() || ! forminator_is_import_plugin_enabled('ninjaforms') ) {
1175
  wp_send_json_success( '' );
1176
  }
1177
- // Validate nonce
1178
- forminator_validate_ajax( "forminator_popup_import_cform_ninjaforms" );
1179
 
1180
  $html = forminator_template( 'custom-form/popup/import-ninjaforms' );
1181
 
@@ -1189,21 +1161,20 @@ class Forminator_Admin_AJAX {
1189
  */
1190
  public function save_import_custom_form_ninja() {
1191
 
1192
- if ( ! Forminator::is_import_export_feature_enabled() || ! forminator_is_import_plugin_enabled('ninjaforms') ) {
1193
  wp_send_json_error( __( 'Import Export Feature disabled.', 'forminator' ) );
1194
  }
1195
- // Validate nonce
1196
- forminator_validate_ajax( "forminator_save_import_custom_form_ninja" );
1197
 
1198
- $post_data = $this->get_post_data();
1199
- $importable = isset( $post_data['ninjaforms'] ) ? $post_data['ninjaforms'] : '';// wpcs: CSRF ok
1200
- $importer = ( ! empty ( $this->importers( 'ninja' ) ) ? $this->importers( 'ninja' ) : '' );
1201
 
1202
- if ( ! empty( $importer ) ):
1203
  if ( 'all' !== $importable && '' !== $importable ) {
1204
 
1205
- $importable = absint( $importable );
1206
- $imported = $importer->import_form( $importable );
1207
 
1208
  if ( 'fail' === $imported['type'] ) {
1209
  wp_send_json_error( $imported['message'] );
@@ -1214,7 +1185,7 @@ class Forminator_Admin_AJAX {
1214
  } elseif ( '' !== $importable ) {
1215
  $forms = forminator_list_thirdparty_contact_forms( 'ninjaforms' );
1216
 
1217
- foreach ($forms as $key => $value) {
1218
  $imported = $importer->import_form( $value->get_id() );
1219
 
1220
  if ( 'fail' === $imported['type'] ) {
@@ -1222,7 +1193,7 @@ class Forminator_Admin_AJAX {
1222
  }
1223
  }
1224
 
1225
- if ( !empty( $error ) ) {
1226
  wp_send_json_error( $error );
1227
  }
1228
 
@@ -1239,11 +1210,11 @@ class Forminator_Admin_AJAX {
1239
  * @since 1.5
1240
  */
1241
  public function load_import_custom_form_gravity() {
1242
- if ( ! Forminator::is_import_export_feature_enabled() || ! forminator_is_import_plugin_enabled('gravityforms') ) {
1243
  wp_send_json_success( '' );
1244
  }
1245
- // Validate nonce
1246
- forminator_validate_ajax( "forminator_popup_import_cform_gravityforms" );
1247
 
1248
  $html = forminator_template( 'custom-form/popup/import-gravityforms' );
1249
 
@@ -1257,21 +1228,20 @@ class Forminator_Admin_AJAX {
1257
  */
1258
  public function save_import_custom_form_gravity() {
1259
 
1260
- if ( ! Forminator::is_import_export_feature_enabled() || ! forminator_is_import_plugin_enabled('gravityforms') ) {
1261
  wp_send_json_error( __( 'Import Export Feature disabled.', 'forminator' ) );
1262
  }
1263
- // Validate nonce
1264
- forminator_validate_ajax( "forminator_save_import_custom_form_gravity" );
1265
 
1266
- $post_data = $this->get_post_data();
1267
- $importable = isset( $post_data['gravityforms'] ) ? $post_data['gravityforms'] : '';// wpcs: CSRF ok
1268
- $importer = ( ! empty ( $this->importers( 'gravity' ) ) ? $this->importers( 'gravity' ) : '' );
1269
 
1270
- if ( ! empty( $importer ) ):
1271
  if ( 'all' !== $importable && '' !== $importable ) {
1272
 
1273
- $importable = absint( $importable );
1274
- $imported = $importer->import_form( $importable );
1275
 
1276
  if ( 'fail' === $imported['type'] ) {
1277
  wp_send_json_error( $imported['message'] );
@@ -1282,7 +1252,7 @@ class Forminator_Admin_AJAX {
1282
  } elseif ( '' !== $importable ) {
1283
  $forms = forminator_list_thirdparty_contact_forms( 'gravityforms' );
1284
 
1285
- foreach ($forms as $key => $value) {
1286
  $imported = $importer->import_form( $value['id'] );
1287
 
1288
  if ( 'fail' === $imported['type'] ) {
@@ -1290,7 +1260,7 @@ class Forminator_Admin_AJAX {
1290
  }
1291
  }
1292
 
1293
- if ( !empty( $error ) ) {
1294
  wp_send_json_error( $error );
1295
  }
1296
 
@@ -1314,7 +1284,7 @@ class Forminator_Admin_AJAX {
1314
  if ( 'custom_form' === $slug ) {
1315
  $slug = 'form';
1316
  }
1317
- // Validate nonce
1318
  forminator_validate_ajax( 'forminator_popup_export_' . $slug );
1319
 
1320
  $html = forminator_template( 'common/popup/export', array( 'slug' => $slug ) );
@@ -1337,7 +1307,7 @@ class Forminator_Admin_AJAX {
1337
  if ( 'custom_form' === $slug ) {
1338
  $slug = 'form';
1339
  }
1340
- // Validate nonce
1341
  forminator_validate_ajax( 'forminator_popup_import_' . forminator_get_prefix( $slug, 'c' ) );
1342
 
1343
  $html = forminator_template( 'common/popup/import', array( 'slug' => $slug ) );
@@ -1351,11 +1321,11 @@ class Forminator_Admin_AJAX {
1351
  * @since 1.6
1352
  */
1353
  public function save_pagination() {
1354
- // Validate nonce
1355
  forminator_validate_ajax( 'forminator_save_popup_pagination' );
1356
 
1357
- $pagination = intval( sanitize_text_field( $_POST['pagination_entries'] ) );
1358
- $pagination_listing = intval( sanitize_text_field( $_POST['pagination_listings'] ) );
1359
 
1360
  if ( 1 > $pagination || 1 > $pagination_listing ) {
1361
  wp_send_json_error( __( 'Limit per page can not be less than one.', 'forminator' ) );
@@ -1373,11 +1343,10 @@ class Forminator_Admin_AJAX {
1373
  * @since 1.6.1
1374
  */
1375
  public function save_accessibility_settings() {
1376
- // Validate nonce
1377
  forminator_validate_ajax( 'forminator_save_accessibility_settings' );
1378
 
1379
- $enable_accessibility = isset( $_POST['enable_accessibility'] ) ? $_POST['enable_accessibility'] : false;
1380
- $enable_accessibility = filter_var( $enable_accessibility, FILTER_VALIDATE_BOOLEAN );
1381
 
1382
  update_option( 'forminator_enable_accessibility', $enable_accessibility );
1383
  wp_send_json_success();
@@ -1389,36 +1358,37 @@ class Forminator_Admin_AJAX {
1389
  * @since 1.6.3
1390
  */
1391
  public function save_dashboard_settings() {
1392
- // Validate nonce
1393
  forminator_validate_ajax( 'forminator_save_dashboard_settings' );
1394
 
1395
  $dashboard_settings = forminator_get_dashboard_settings();
1396
-
1397
  $widgets = array( 'forms', 'polls', 'quizzes' );
1398
 
1399
- $num_recents = isset( $_POST['num_recent'] ) ? $_POST['num_recent'] : array();// phpcs:ignore -- by forminator_validate_ajax
1400
- $publisheds = isset( $_POST['published'] ) ? $_POST['published'] : array();// phpcs:ignore -- by forminator_validate_ajax
1401
- $drafts = isset( $_POST['draft'] ) ? $_POST['draft'] : array();// phpcs:ignore -- by forminator_validate_ajax
 
 
 
1402
 
1403
- // value based settings
1404
  foreach ( $num_recents as $widget => $value ) {
1405
  if ( ! isset( $dashboard_settings[ $widget ] ) ) {
1406
  $dashboard_settings[ $widget ] = array();
1407
  }
1408
- $value = intval( $value );
1409
- // at least 0
1410
  if ( $value >= 0 ) {
1411
- $dashboard_settings[ $widget ]['num_recent'] = intval( $value );
1412
  }
1413
  }
1414
 
1415
- // bool based settings aka checkboxes
1416
  foreach ( $widgets as $widget ) {
1417
  if ( ! isset( $dashboard_settings[ $widget ] ) ) {
1418
  $dashboard_settings[ $widget ] = array();
1419
  }
1420
 
1421
- // default enabled, handle when not exist = false
1422
  if ( ! isset( $publisheds[ $widget ] ) ) {
1423
  $dashboard_settings[ $widget ]['published'] = false;
1424
  }
@@ -1428,12 +1398,17 @@ class Forminator_Admin_AJAX {
1428
  }
1429
 
1430
  update_option( 'forminator_dashboard_settings', $dashboard_settings );
1431
- update_option( "forminator_sender_email_address", sanitize_text_field( $_POST['sender_email'] ) );
1432
- update_option( "forminator_sender_name", sanitize_text_field( stripcslashes( $_POST['sender_name'] ) ) );
1433
-
1434
- $pagination = intval( sanitize_text_field( $_POST['pagination_entries'] ) );
1435
- $pagination_listing = intval( sanitize_text_field( $_POST['pagination_listings'] ) );
 
 
 
1436
 
 
 
1437
 
1438
  if ( 1 > $pagination || 1 > $pagination_listing ) {
1439
  wp_send_json_error( __( 'Limit per page can not be less than one.', 'forminator' ) );
@@ -1442,11 +1417,8 @@ class Forminator_Admin_AJAX {
1442
  update_option( 'forminator_pagination_entries', $pagination );
1443
  update_option( 'forminator_pagination_listings', $pagination_listing );
1444
 
1445
- if ( isset( $_POST['editor_settings'] ) ) {
1446
- update_option( "forminator_editor_settings", sanitize_text_field( $_POST['editor_settings'] ) );
1447
- } else {
1448
- update_option( "forminator_editor_settings", false );
1449
- }
1450
 
1451
  wp_send_json_success();
1452
  }
@@ -1458,15 +1430,14 @@ class Forminator_Admin_AJAX {
1458
  */
1459
  public function validate_calculation_formula() {
1460
 
1461
- // Validate nonce
1462
  forminator_validate_ajax( 'forminator_validate_calculation_formula' );
1463
 
1464
  try {
1465
- $formula = isset( $_POST['formula'] ) ? $_POST['formula'] : '';// phpcs:ignore -- by forminator_validate_ajax
1466
-
1467
  $formula = forminator_calculator_maybe_dummify_fields_on_formula( $formula );
1468
  $calculator = new Forminator_Calculator( $formula );
1469
- // handle throw
1470
  $calculator->set_is_throwable( true );
1471
  $calculator->parse();
1472
 
@@ -1483,7 +1454,7 @@ class Forminator_Admin_AJAX {
1483
  * @since 1.7
1484
  */
1485
  public function stripe_disconnect() {
1486
- // Validate nonce
1487
  forminator_validate_ajax( 'forminatorSettingsRequest' );
1488
 
1489
  if ( class_exists( 'Forminator_Gateway_Stripe' ) ) {
@@ -1510,7 +1481,7 @@ class Forminator_Admin_AJAX {
1510
  * @since 1.7
1511
  */
1512
  public function paypal_disconnect() {
1513
- // Validate nonce
1514
  forminator_validate_ajax( 'forminatorSettingsRequest' );
1515
 
1516
  if ( class_exists( 'Forminator_PayPal_Express' ) ) {
@@ -1537,7 +1508,7 @@ class Forminator_Admin_AJAX {
1537
  * @since 1.7
1538
  */
1539
  public function stripe_update_page() {
1540
- // Validate nonce
1541
  forminator_validate_ajax( 'forminator_stripe_settings_modal' );
1542
 
1543
  $file = forminator_plugin_dir() . 'admin/views/settings/payments/section-stripe.php';
@@ -1556,7 +1527,7 @@ class Forminator_Admin_AJAX {
1556
  * @since 1.7
1557
  */
1558
  public function paypal_update_page() {
1559
- // Validate nonce
1560
  forminator_validate_ajax( 'forminator_paypal_settings_modal' );
1561
 
1562
  $file = forminator_plugin_dir() . 'admin/views/settings/payments/section-paypal.php';
@@ -1579,21 +1550,21 @@ class Forminator_Admin_AJAX {
1579
  return false;
1580
  }
1581
 
1582
- // Validate nonce
1583
  forminator_validate_ajax( 'forminator_stripe_settings_modal' );
1584
 
1585
  $data = array();
1586
 
1587
- $post_data = $_POST;// phpcs:ignore -- by forminator_validate_ajax
1588
- $is_connect_request = isset( $post_data['connect'] ) ? filter_var( $post_data['connect'] ) : false;
1589
  $template_vars = array();
1590
  try {
1591
  $stripe = new Forminator_Gateway_Stripe();
1592
 
1593
- $test_key = isset( $post_data['test_key'] ) ? $post_data['test_key'] : $stripe->get_test_key();// WPCS: CSRF ok by forminator_validate_ajax.
1594
- $test_secret = isset( $post_data['test_secret'] ) ? $post_data['test_secret'] : $stripe->get_test_secret();// WPCS: CSRF ok by forminator_validate_ajax.
1595
- $live_key = isset( $post_data['live_key'] ) ? $post_data['live_key'] : $stripe->get_live_key();// WPCS: CSRF ok by forminator_validate_ajax.
1596
- $live_secret = isset( $post_data['live_secret'] ) ? $post_data['live_secret'] : $stripe->get_live_secret();// WPCS: CSRF ok by forminator_validate_ajax.
1597
  $default_currency = $stripe->get_default_currency();
1598
 
1599
  $template_vars['test_key'] = $test_key;
@@ -1689,11 +1660,11 @@ class Forminator_Admin_AJAX {
1689
  $data['buttons'] = array();
1690
 
1691
  $data['buttons']['connect']['markup'] = '<div class="sui-actions-right">' .
1692
- '<button class="sui-button forminator-stripe-connect" type="button" data-nonce="' . wp_create_nonce( 'forminator_stripe_settings_modal' ) . '">' .
1693
- '<span class="sui-loading-text">' . esc_html__( 'Connect', 'forminator' ) . '</span>' .
1694
- '<i class="sui-icon-loader sui-loading" aria-hidden="true"></i>' .
1695
- '</button>' .
1696
- '</div>';
1697
 
1698
  wp_send_json_success( $data );
1699
  }
@@ -1704,22 +1675,22 @@ class Forminator_Admin_AJAX {
1704
  * @since 1.7.1
1705
  */
1706
  public function paypal_settings_modal() {
1707
- // Validate nonce
1708
  forminator_validate_ajax( 'forminator_paypal_settings_modal' );
1709
 
1710
  $data = array();
1711
 
1712
- $post_data = $_POST;// phpcs:ignore -- by forminator_validate_ajax
1713
- $is_connect_request = isset( $post_data['connect'] ) ? filter_var( $post_data['connect'] ) : false;
1714
  $template_vars = array();
1715
 
1716
  try {
1717
  $paypal = new Forminator_PayPal_Express();
1718
 
1719
- $sandbox_id = isset( $post_data['sandbox_id'] ) ? $post_data['sandbox_id'] : $paypal->get_sandbox_id();// WPCS: CSRF ok by forminator_validate_ajax.
1720
- $sandbox_secret = isset( $post_data['sandbox_secret'] ) ? $post_data['sandbox_secret'] : $paypal->get_sandbox_secret();// WPCS: CSRF ok by forminator_validate_ajax.
1721
- $live_id = isset( $post_data['live_id'] ) ? $post_data['live_id'] : $paypal->get_live_id();// WPCS: CSRF ok by forminator_validate_ajax.
1722
- $live_secret = isset( $post_data['live_secret'] ) ? $post_data['live_secret'] : $paypal->get_live_secret();// WPCS: CSRF ok by forminator_validate_ajax.
1723
  $default_currency = $paypal->get_default_currency();
1724
 
1725
  $template_vars['sandbox_id'] = $sandbox_id;
@@ -1815,11 +1786,11 @@ class Forminator_Admin_AJAX {
1815
  $data['buttons'] = array();
1816
 
1817
  $data['buttons']['connect']['markup'] = '<div class="sui-actions-right">' .
1818
- '<button class="sui-button forminator-paypal-connect" type="button" data-nonce="' . wp_create_nonce( 'forminator_paypal_settings_modal' ) . '">' .
1819
- '<span class="sui-loading-text">' . esc_html__( 'Connect', 'forminator' ) . '</span>' .
1820
- '<i class="sui-icon-loader sui-loading" aria-hidden="true"></i>' .
1821
- '</button>' .
1822
- '</div>';
1823
 
1824
  wp_send_json_success( $data );
1825
  }
@@ -1832,8 +1803,8 @@ class Forminator_Admin_AJAX {
1832
  public function dismiss_notice() {
1833
  forminator_validate_ajax( 'forminator_dismiss_notification' );
1834
 
1835
- $notification_name = filter_input( INPUT_POST, 'prop', FILTER_SANITIZE_STRING );
1836
- $input_value = filter_input( INPUT_POST, 'value', FILTER_SANITIZE_STRING );
1837
 
1838
  if ( ! empty( $input_value ) ) {
1839
  update_option( $notification_name, $input_value );
@@ -1856,7 +1827,7 @@ class Forminator_Admin_AJAX {
1856
  public function dismiss_admin_notice() {
1857
  forminator_validate_ajax( 'forminator_dismiss_notice' );
1858
 
1859
- $slug = filter_input( INPUT_POST, 'slug', FILTER_SANITIZE_STRING );
1860
  $user_id = get_current_user_id();
1861
  $dismissed = get_user_meta( $user_id, 'frmt_dismissed_messages', true );
1862
  if ( ! $dismissed || ! is_array( $dismissed ) ) {
@@ -1874,10 +1845,10 @@ class Forminator_Admin_AJAX {
1874
  * @since 1.9
1875
  */
1876
  public function later_notice() {
1877
- forminator_validate_ajax( "forminator_dismiss_notification" );
1878
 
1879
- $notification_name = filter_input( INPUT_POST, 'prop', FILTER_SANITIZE_STRING );
1880
- $form_id = filter_input( INPUT_POST, 'form_id', FILTER_SANITIZE_NUMBER_INT );
1881
 
1882
  update_post_meta( $form_id, $notification_name, true );
1883
 
@@ -1892,9 +1863,9 @@ class Forminator_Admin_AJAX {
1892
  public function save_payments() {
1893
  forminator_validate_ajax( 'forminator_save_payments_settings' );
1894
 
1895
- // stripe
1896
- if ( isset( $_POST['stripe-default-currency'] ) && ! empty( $_POST['stripe-default-currency'] ) ) {
1897
- $default_currency = sanitize_text_field( $_POST['stripe-default-currency'] );
1898
 
1899
  try {
1900
  $stripe = new Forminator_Gateway_Stripe();
@@ -1919,9 +1890,10 @@ class Forminator_Admin_AJAX {
1919
  }
1920
  }
1921
 
1922
- // paypal
1923
- if ( isset( $_POST['paypal-default-currency'] ) && ! empty( $_POST['paypal-default-currency'] ) ) {
1924
- $default_currency = sanitize_text_field( $_POST['paypal-default-currency'] );
 
1925
 
1926
  try {
1927
  $paypal = new Forminator_PayPal_Express();
@@ -1958,8 +1930,8 @@ class Forminator_Admin_AJAX {
1958
  public function delete_poll_submissions() {
1959
  forminator_validate_ajax( 'forminatorPollEntries' );
1960
 
1961
- if ( ! empty( $_POST['id'] ) ) {
1962
- $form_id = intval( $_POST['id'] );
1963
 
1964
  Forminator_Form_Entry_Model::delete_by_form( $form_id );
1965
 
@@ -1995,15 +1967,24 @@ class Forminator_Admin_AJAX {
1995
  public function dismiss_prelaunch_subscriptions_notice() {
1996
  forminator_validate_ajax( 'forminator_dismiss_prelaunch_subscriptions' );
1997
 
1998
- $slug = filter_input( INPUT_POST, 'prop', FILTER_SANITIZE_STRING );
1999
 
2000
- $dismissed_messages = get_user_meta( get_current_user_id(), 'frmt_dismissed_messages', true );
2001
- $dismissed_messages = empty( $dismissed_messages ) ? array() : $dismissed_messages;
2002
  $dismissed_messages[ $slug ] = true;
2003
 
2004
  update_user_meta( get_current_user_id(), 'frmt_dismissed_messages', $dismissed_messages );
2005
  }
2006
 
 
 
 
 
 
 
 
 
 
2007
  /**
2008
  * Module search for all types
2009
  *
@@ -2011,22 +1992,23 @@ class Forminator_Admin_AJAX {
2011
  */
2012
  public function module_search() {
2013
  forminator_validate_ajax( 'forminator-nonce-search-module' );
2014
- $html = '';
2015
- $modules = Forminator_Admin_Module_Edit_Page::get_searched_modules( filter_input( INPUT_POST, 'search_keyword', FILTER_SANITIZE_STRING ) );
 
2016
 
2017
  ob_start();
2018
- Forminator_Admin_Module_Edit_Page::show_modules(
2019
- $modules,
2020
- filter_input( INPUT_POST, 'module_slug', FILTER_SANITIZE_STRING ),
2021
- filter_input( INPUT_POST, 'preview_dialog', FILTER_SANITIZE_STRING ),
2022
- filter_input( INPUT_POST, 'preview_title', FILTER_SANITIZE_STRING ),
2023
- filter_input( INPUT_POST, 'export_dialog', FILTER_SANITIZE_STRING ),
2024
- filter_input( INPUT_POST, 'post_type', FILTER_SANITIZE_STRING ),
2025
- filter_input( INPUT_POST, 'soon', FILTER_SANITIZE_STRING ),
2026
- filter_input( INPUT_POST, 'sql_month_start_date', FILTER_SANITIZE_STRING ),
2027
- filter_input( INPUT_POST, 'wizard_page', FILTER_SANITIZE_STRING ),
2028
- filter_input( INPUT_POST, 'search_keyword', FILTER_SANITIZE_STRING )
2029
- );
2030
  $html = ob_get_clean();
2031
 
2032
  wp_send_json_success( $html );
@@ -2036,18 +2018,14 @@ class Forminator_Admin_AJAX {
2036
  * Addons page details
2037
  */
2038
  public function addons_page_details() {
2039
- // Validate nonce
2040
  forminator_validate_ajax( 'forminator_addons_page_details' );
2041
 
2042
- $post_data = $_POST;
2043
-
2044
- if ( ! isset( $post_data['id'] ) || empty( $post_data['id'] ) ) {
2045
-
2046
  wp_send_json_error();
2047
  }
2048
 
2049
- $pid = $post_data['id'];
2050
-
2051
  $file = forminator_plugin_dir() . 'admin/views/addons/addon-details.php';
2052
 
2053
  ob_start();
@@ -2059,16 +2037,17 @@ class Forminator_Admin_AJAX {
2059
  }
2060
 
2061
  public function addons_page_actions() {
2062
- // Validate nonce
2063
  forminator_validate_ajax( 'forminator_popup_addons_actions' );
2064
 
2065
- if ( empty( $_REQUEST['action'] ) ) {
 
2066
  wp_send_json_error(
2067
  array( 'message' => __( 'Required field missing', 'forminator' ) )
2068
  );
2069
  }
2070
 
2071
- $action = str_replace( 'forminator_', '', $_REQUEST['action'] );
2072
 
2073
  Forminator_Admin_Addons_page::get_instance()->addons_action_ajax( $action );
2074
 
16
  * @since 1.0
17
  */
18
  public function __construct() {
19
+ // Handle close welcome box.
20
  add_action( 'wp_ajax_forminator_dismiss_welcome', array( $this, 'dismiss_welcome' ) );
21
  add_action( 'wp_ajax_nopriv_forminator_dismiss_welcome', array( $this, 'dismiss_welcome' ) );
22
 
23
+ // Handle load google fonts.
24
  add_action( 'wp_ajax_forminator_load_google_fonts', array( $this, 'load_google_fonts' ) );
25
 
26
+ // Handle load reCaptcha preview.
27
  add_action( 'wp_ajax_forminator_load_recaptcha_preview', array( $this, 'load_recaptcha_preview' ) );
28
 
29
+ // Handle save settings.
30
  add_action( 'wp_ajax_forminator_save_builder', array( $this, 'save_builder' ) );
31
  add_action( 'wp_ajax_forminator_save_poll', array( $this, 'save_poll_form' ) );
32
  add_action( 'wp_ajax_forminator_save_quiz_nowrong', array( $this, 'save_quiz' ) );
34
  add_action( 'wp_ajax_forminator_save_login', array( $this, 'save_login' ) );
35
  add_action( 'wp_ajax_forminator_save_register', array( $this, 'save_register' ) );
36
 
37
+ // Handle settings popups.
38
  add_action( 'wp_ajax_forminator_load_captcha_popup', array( $this, 'load_captcha' ) );
39
  add_action( 'wp_ajax_forminator_save_captcha_popup', array( $this, 'save_captcha' ) );
40
 
56
  add_action( 'wp_ajax_forminator_load_preview_polls_popup', array( $this, 'preview_module' ) );
57
  add_action( 'wp_ajax_forminator_load_preview_quizzes_popup', array( $this, 'preview_module' ) );
58
 
59
+ // Handle exports popup.
60
  add_action( 'wp_ajax_forminator_load_exports_popup', array( $this, 'load_exports' ) );
61
  add_action( 'wp_ajax_forminator_clear_exports_popup', array( $this, 'clear_exports' ) );
62
 
63
+ // Handle search user email.
64
  add_action( 'wp_ajax_forminator_builder_search_emails', array( $this, 'search_emails' ) );
65
 
66
  add_action( 'wp_ajax_forminator_load_privacy_settings_popup', array( $this, 'load_privacy_settings' ) );
70
  add_action( 'wp_ajax_forminator_load_import_custom_form_popup', array( $this, 'load_import' ) );
71
  add_action( 'wp_ajax_forminator_save_import_custom_form_popup', array( $this, 'save_import' ) );
72
 
73
+ add_action( 'wp_ajax_forminator_load_import_custom_form_cf7_popup', array( $this, 'load_import_custom_form_cf7' ) );
74
+ add_action( 'wp_ajax_forminator_save_import_custom_form_cf7_popup', array( $this, 'save_import_custom_form_cf7' ) );
75
 
76
+ add_action( 'wp_ajax_forminator_load_import_custom_form_ninja_popup', array( $this, 'load_import_custom_form_ninja' ) );
77
+ add_action( 'wp_ajax_forminator_save_import_custom_form_ninja_popup', array( $this, 'save_import_custom_form_ninja' ) );
78
 
79
+ add_action( 'wp_ajax_forminator_load_import_custom_form_gravity_popup', array( $this, 'load_import_custom_form_gravity' ) );
80
+ add_action( 'wp_ajax_forminator_save_import_custom_form_gravity_popup', array( $this, 'save_import_custom_form_gravity' ) );
81
 
82
  add_action( 'wp_ajax_forminator_load_export_poll_popup', array( $this, 'load_export' ) );
83
  add_action( 'wp_ajax_forminator_load_import_poll_popup', array( $this, 'load_import' ) );
115
  add_action( 'wp_ajax_forminator_module_search', array( $this, 'module_search' ) );
116
  add_action( 'wp_ajax_forminator_load_addons_page_details_popup', array( $this, 'addons_page_details' ) );
117
 
118
+ add_action( 'wp_ajax_forminator_dismiss_black_friday', array( $this, 'dismiss_black_friday' ) );
119
+
120
  // Process ajax actions.
121
  $ajax_actions = array(
122
  'forminator_addons-install',
134
  * Save quizzes
135
  *
136
  * @since 1.0
137
+ * @since 1.1 change superglobal POST to `get_post_data`
138
  */
139
  public function save_quiz() {
140
  if ( ! forminator_is_user_allowed() ) {
146
  $submitted_data = $this->get_post_data();
147
 
148
  $quiz_data = array();
149
+ if ( ! empty( $_POST['data'] ) ) {
150
+ $quiz_data = Forminator_Core::sanitize_array( json_decode( wp_unslash( $_POST['data'] ), true ) );
 
151
  }
152
 
153
+ $id = isset( $submitted_data['form_id'] ) ? intval( $submitted_data['form_id'] ) : 0;
154
+ $settings = isset( $quiz_data['settings'] ) ? $quiz_data['settings'] : array();
155
+ $title = isset( $submitted_data['quiz_title'] ) ? $submitted_data['quiz_title'] : $submitted_data['formName'];
156
+ $status = isset( $submitted_data['status'] ) ? $submitted_data['status'] : '';
157
+ $version = isset( $submitted_data['version'] ) ? $submitted_data['version'] : '1.0';
158
+ $template = new stdClass();
159
 
160
  $template->type = isset( $submitted_data['action'] ) ? $submitted_data['action'] : '';
161
+ // Check if results exist.
162
  if ( isset( $quiz_data['results'] ) && is_array( $quiz_data['results'] ) ) {
163
  $template->results = $quiz_data['results'];
164
  }
165
 
166
+ // Check if answers exist.
167
  if ( isset( $quiz_data['questions'] ) ) {
168
  $template->questions = $quiz_data['questions'];
169
  }
190
  * Save poll
191
  *
192
  * @since 1.0
193
+ * @since 1.1 change superglobal POST to `get_post_data`
194
  */
195
  public function save_poll_form() {
196
  if ( ! forminator_is_user_allowed() ) {
201
 
202
  $submitted_data = $this->get_post_data();
203
  $poll_data = array();
204
+ if ( ! empty( $_POST['data'] ) ) {
205
+ $poll_data = Forminator_Core::sanitize_array( json_decode( wp_unslash( $_POST['data'] ), true ) );
 
206
  }
207
 
208
  $settings = isset( $poll_data['settings'] ) ? $poll_data['settings'] : array();
209
  $id = isset( $submitted_data['form_id'] ) ? intval( $submitted_data['form_id'] ) : 0;
210
+ $title = $submitted_data['formName'];
211
+ $status = isset( $submitted_data['status'] ) ? $submitted_data['status'] : '';
212
+ $version = isset( $submitted_data['version'] ) ? $submitted_data['version'] : '1.0';
213
  $template = new stdClass();
214
 
215
  if ( isset( $poll_data['answers'] ) ) {
240
  forminator_validate_ajax( 'forminator_save_builder_fields' );
241
 
242
  $submitted_data = $this->get_post_data();
243
+ $form_data = array();
 
244
  $fields = array();
245
  $id = isset( $submitted_data['form_id'] ) ? intval( $submitted_data['form_id'] ) : 0;
246
+ $title = $submitted_data['formName'];
247
+ $status = isset( $submitted_data['status'] ) ? $submitted_data['status'] : '';
248
+ $version = isset( $submitted_data['version'] ) ? $submitted_data['version'] : '1.0';
249
  $template = new stdClass();
250
+ $action = false;
251
+
252
+ if ( ! empty( $_POST['data'] ) ) {
253
+ $form_data = Forminator_Core::sanitize_array( json_decode( wp_unslash( $_POST['data'] ), true ) );
254
+ }
255
 
256
  if ( is_null( $id ) || $id <= 0 ) {
257
  $form_model = new Forminator_Form_Model();
272
  $status = $form_model->status;
273
  }
274
 
275
+ // we need to empty fields cause we will send new data.
276
  $form_model->clear_fields();
277
  }
278
 
287
  $template->notifications = $form_data['notifications'];
288
  }
289
 
290
+ // Sanitize settings.
291
  $settings = $form_data['settings'];
292
  $settings['version'] = $version;
293
  $template->settings = $settings;
314
  forminator_validate_ajax( 'forminator_save_builder_fields' );
315
 
316
  $submitted_data = $this->get_post_data();
317
+ $id = isset( $submitted_data['form_id'] ) ? intval( $submitted_data['form_id'] ) : 0;
318
+ $title = $submitted_data['formName'];
319
+ $status = isset( $submitted_data['status'] ) ? $submitted_data['status'] : '';
320
+ $version = isset( $submitted_data['version'] ) ? $submitted_data['version'] : '1.0';
 
 
321
 
322
  if ( is_null( $id ) || $id <= 0 ) {
323
  $form_model = new Forminator_Form_Model();
325
  if ( empty( $status ) ) {
326
  $status = Forminator_Form_Model::STATUS_PUBLISH;
327
  }
 
328
  } else {
329
  $form_model = Forminator_Form_Model::model()->load( $id );
330
 
337
  }
338
  $form_model->set_var_in_array( 'name', 'formName', $submitted_data, 'forminator_sanitize_field' );
339
 
340
+ $settings = $submitted_data['data'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
341
 
342
  $settings['formName'] = $title;
343
  $settings['version'] = $version;
344
  $form_model->settings = $settings;
345
 
346
+ // status.
347
  $form_model->status = $status;
348
 
349
+ // Save data.
350
  $id = $form_model->save();
351
 
352
+ // add privacy settings to global option.
353
  $override_privacy = false;
354
  if ( isset( $settings['enable-submissions-retention'] ) ) {
355
  $override_privacy = filter_var( $settings['enable-submissions-retention'], FILTER_VALIDATE_BOOLEAN );
375
  /**
376
  * Load existing custom field keys
377
  *
 
378
  * @return string JSON
379
+ * @since 1.0
380
  */
381
  public function load_existing_cfields() {
382
 
423
  public function load_google_fonts() {
424
  forminator_validate_ajax( 'forminator_load_google_fonts' );
425
 
426
+ $is_object = isset( $_POST['data']['isObject'] ) ? sanitize_text_field( $_POST['data']['isObject'] ) : false;
427
 
428
  $fonts = forminator_get_font_families( $is_object );
429
  wp_send_json_success( $fonts );
435
  * @since 1.0
436
  */
437
  public function load_captcha() {
438
+ // Validate nonce.
439
  forminator_validate_ajax( 'forminator_popup_captcha' );
440
 
441
  $html = forminator_template( 'settings/popup/edit-captcha-content' );
449
  * @since 1.0
450
  */
451
  public function save_captcha() {
452
+ // Validate nonce.
453
  forminator_validate_ajax( 'forminator_save_popup_captcha' );
454
 
455
+ update_option( 'forminator_captcha_key', Forminator_Core::sanitize_text_field( 'v2_captcha_key' ) );
456
+ update_option( 'forminator_captcha_secret', Forminator_Core::sanitize_text_field( 'v2_captcha_secret' ) );
457
 
458
+ update_option( 'forminator_v2_invisible_captcha_key', Forminator_Core::sanitize_text_field( 'v2_invisible_captcha_key' ) );
459
+ update_option( 'forminator_v2_invisible_captcha_secret', Forminator_Core::sanitize_text_field( 'v2_invisible_captcha_secret' ) );
460
 
461
+ update_option( 'forminator_v3_captcha_key', Forminator_Core::sanitize_text_field( 'v3_captcha_key' ) );
462
+ update_option( 'forminator_v3_captcha_secret', Forminator_Core::sanitize_text_field( 'v3_captcha_secret' ) );
463
 
464
+ update_option( 'forminator_captcha_language', Forminator_Core::sanitize_text_field( 'captcha_language' ) );
465
 
466
  wp_send_json_success();
467
  }
485
  * @since 1.0
486
  */
487
  public function save_currency() {
488
+ // Validate nonce.
489
  forminator_validate_ajax( 'forminator_save_popup_currency' );
490
 
491
+ update_option( 'forminator_currency', Forminator_Core::sanitize_text_field( 'currency' ) );
492
 
493
  wp_send_json_success();
494
  }
499
  * @since 1.0.2
500
  */
501
  public function load_pagination_entries() {
502
+ // Validate nonce.
503
  forminator_validate_ajax( 'forminator_popup_pagination_entries' );
504
 
505
  $html = forminator_template( 'settings/popup/edit-pagination-entries-content' );
517
  $language = get_option( 'forminator_captcha_language', '' );
518
  $language = ! empty( $language ) ? $language : $site_language;
519
 
520
+ $captcha = Forminator_Core::sanitize_text_field( 'captcha' );
521
 
522
  if ( 'v2-invisible' === $captcha ) {
523
  $captcha_key = get_option( 'forminator_v2_invisible_captcha_key', '' );
554
  * @since 1.0.2
555
  */
556
  public function load_pagination_listings() {
557
+ // Validate nonce.
558
  forminator_validate_ajax( 'forminator_popup_pagination_listings' );
559
 
560
  $html = forminator_template( 'settings/popup/edit-pagination-listings-content' );
568
  * @since 1.0.2
569
  */
570
  public function save_pagination_listings() {
571
+ // Validate nonce.
572
  forminator_validate_ajax( 'forminator_save_popup_pagination_listings' );
573
 
574
+ $pagination = filter_input( INPUT_POST, 'pagination_listings', FILTER_VALIDATE_INT );
575
 
576
  if ( 0 < $pagination ) {
577
 
592
  * @since 1.1
593
  */
594
  public function load_email_form() {
595
+ // Validate nonce.
596
  forminator_validate_ajax( 'forminator_load_popup_email_settings' );
597
 
598
  $html = forminator_template( 'settings/popup/edit-email-content' );
606
  * @since 1.0.2
607
  */
608
  public function load_uninstall_form() {
609
+ // Validate nonce.
610
  forminator_validate_ajax( 'forminator_popup_uninstall_form' );
611
 
612
  $html = forminator_template( 'settings/popup/edit-uninstall-content' );
621
  * @since 1.0.2
622
  */
623
  public function save_uninstall_form() {
624
+ // Validate nonce.
625
  forminator_validate_ajax( 'forminator_save_popup_uninstall_settings' );
626
 
627
+ $delete_uninstall = Forminator_Core::sanitize_text_field( 'delete_uninstall', false );
628
  $delete_uninstall = filter_var( $delete_uninstall, FILTER_VALIDATE_BOOLEAN );
629
 
630
  update_option( 'forminator_uninstall_clear_data', $delete_uninstall );
650
  $slug = 'quiz';
651
  }
652
 
653
+ // Validate nonce.
654
  forminator_validate_ajax( 'forminator_popup_preview_' . $slug );
655
 
656
  $preview_data = false;
657
+ // force -1 for preview.
658
+ $form_id = filter_input( INPUT_POST, 'id', FILTER_VALIDATE_INT );
659
+ $form_id = $form_id ? $form_id : -1;
660
 
661
+ // Check if preview data set.
662
  if ( ! empty( $_POST['data'] ) ) {
663
+ $data = Forminator_Core::sanitize_array( $_POST['data'], 'data' );
664
 
665
  if ( ! is_array( $data ) ) {
666
+ $data = json_decode( $data, true );
667
  }
668
  $function = 'forminator_data_to_model_' . $slug;
669
+ $preview_data = $function( $data );
670
  }
671
 
672
  $html = forminator_preview( $form_id, $slug, true, $preview_data );
680
  * @since 1.0
681
  */
682
  public function load_exports() {
683
+ // Validate nonce.
684
  forminator_validate_ajax( 'forminator_load_exports' );
685
 
686
+ $form_id = filter_input( INPUT_POST, 'id', FILTER_VALIDATE_INT );
687
 
688
  if ( $form_id ) {
689
  $args = array(
702
  * @since 1.0
703
  */
704
  public function clear_exports() {
705
+ // Validate nonce.
706
+ forminator_validate_ajax( 'forminator_clear_exports' );
707
 
708
+ $form_id = filter_input( INPUT_POST, 'id', FILTER_VALIDATE_INT );
709
 
710
  if ( ! $form_id ) {
711
  wp_send_json_error( __( 'No ID was provided.', 'forminator' ) );
724
  * Search Emails
725
  *
726
  * @since 1.0.3
727
+ * @since 1.1 change superglobal POST to `get_post_data`
728
  */
729
  public function search_emails() {
730
  forminator_validate_ajax( 'forminator_search_emails' );
734
 
735
  $submitted_data = $this->get_post_data();
736
 
737
+ // TODO : add ajax validate here and js admin too.
738
+ $admin_email = ! empty( $submitted_data['admin_email'] ) ? true : false;
739
+ $search_email = ! empty( $submitted_data['q'] ) ? $submitted_data['q'] : false;
740
 
741
+ // return admin_email when requested.
742
  if ( $admin_email ) {
743
  wp_send_json_success( get_option( 'admin_email' ) );
744
  }
757
  /**
758
  * Filter args to be passed on to get_users
759
  *
760
+ * @param array $args
761
+ * @param string $search_email string to search.
762
+ *
763
  * @see get_users()
764
  *
765
  * @since 1.2
766
  *
 
 
767
  */
768
  $args = apply_filters( 'forminator_builder_search_emails_args', $args, $search_email );
769
 
782
  /**
783
  * Filter returned data when builder search emails
784
  *
785
+ * @param array $data
786
+ * @param array $users search result of get_users.
787
+ * @param array $args current query args passed to get_users.
788
+ * @param string $search_email string to search.
789
+ *
790
  * @since 1.2
791
  *
 
 
 
 
792
  */
793
  $data = apply_filters( 'forminator_builder_search_emails_data', $data, $users, $args, $search_email );
794
 
796
  }
797
 
798
  /**
799
+ * Get superglobal POST data
 
 
800
  *
801
+ * @param string $nonce_action action to validate.
802
+ * @param array $sanitize_callbacks {
803
  * custom sanitize options, its assoc array
804
  * 'field_name_1' => 'function_to_call_1' function will called with `call_user_func_array`,
805
  * 'field_name_2' => 'function_to_call_2',
806
  * }
807
  *
808
  * @return array
809
+ * @since 1.1
810
+ *
811
  */
812
  protected function get_post_data( $nonce_action = '', $sanitize_callbacks = array() ) {
813
+ // do nonce / caps check when requested.
814
  if ( ! empty( $nonce_action ) ) {
815
+ // it will wp_send_json_error.
816
  forminator_validate_ajax( $nonce_action );
817
  }
818
 
819
+ $post_data = Forminator_Core::sanitize_array( $_POST );
 
820
 
821
+ // do some additional sanitize.
822
  foreach ( $sanitize_callbacks as $field => $sanitize_func ) {
823
  if ( isset( $post_data[ $field ] ) ) {
824
  if ( is_callable( $sanitize_func ) ) {
827
  }
828
  }
829
 
830
+ // do some validation.
831
 
832
  return $post_data;
833
  }
838
  * @since 1.0.6
839
  */
840
  public function load_privacy_settings() {
841
+ // Validate nonce.
842
  forminator_validate_ajax( 'forminator_popup_privacy_settings' );
843
 
844
  $html = forminator_template( 'settings/popup/edit-privacy-settings' );
852
  * @since 1.0.6
853
  */
854
  public function save_privacy_settings() {
855
+ // Validate nonce.
856
  forminator_validate_ajax( 'forminator_save_privacy_settings' );
857
+ $post_data = Forminator_Core::sanitize_array( $_POST );
858
 
859
  /**
860
  * CUSTOM FORMS
861
  */
862
+ // Account Erasure Requests.
863
  if ( isset( $post_data['erase_form_submissions'] ) ) {
 
864
  $enable_erasure_request_erase_form_submissions = filter_var( $post_data['erase_form_submissions'], FILTER_VALIDATE_BOOLEAN );
865
  update_option( 'forminator_enable_erasure_request_erase_form_submissions', $enable_erasure_request_erase_form_submissions );
866
  }
867
+ // Account Erasure Requests.
868
 
869
+ // Submissions Retention.
870
  $cform_retain_forever = filter_var( $post_data['form_retain_submission_forever'], FILTER_VALIDATE_BOOLEAN );
871
  update_option( 'retain_submission_forever', $cform_retain_forever );
872
  if ( $cform_retain_forever ) {
873
  $post_data['form_retain_submission_number'] = 0;
874
  }
875
  if ( isset( $post_data['form_retain_submission_number'] ) ) {
876
+ $submissions_retention_number = intval( $post_data['form_retain_submission_number'] );
 
 
877
  if ( $submissions_retention_number < 0 ) {
878
  $submissions_retention_number = 0;
879
  }
880
  update_option( 'forminator_retain_submissions_interval_number', $submissions_retention_number );
881
  }
882
  update_option( 'forminator_retain_submissions_interval_unit', $post_data['form_retain_submission_unit'] );
883
+ // Submissions Retention.
884
 
885
+ // IP Retention.
886
  $cform_retain_ip_forever = filter_var( $post_data['form_retain_ip_forever'], FILTER_VALIDATE_BOOLEAN );
887
  update_option( 'retain_ip_forever', $cform_retain_ip_forever );
888
  if ( $cform_retain_ip_forever ) {
889
  $post_data['form_retain_ip_number'] = 0;
890
  }
891
  if ( isset( $post_data['form_retain_ip_number'] ) ) {
892
+ $cform_ip_retention_number = intval( $post_data['form_retain_ip_number'] );
 
 
893
  if ( $cform_ip_retention_number < 0 ) {
894
  $cform_ip_retention_number = 0;
895
  }
896
  update_option( 'forminator_retain_ip_interval_number', $cform_ip_retention_number );
897
  }
898
  update_option( 'forminator_retain_ip_interval_unit', $post_data['form_retain_ip_unit'] );
899
+ // IP Retention.
900
 
901
  /**
902
  * POLLS
903
  */
904
+ // Submissions Retention.
905
  $poll_retain_submissions_forever = filter_var( $post_data['poll_retain_submission_forever'], FILTER_VALIDATE_BOOLEAN );
906
  update_option( 'poll_retain_submission_forever', $poll_retain_submissions_forever );
907
  if ( $poll_retain_submissions_forever ) {
908
  $post_data['poll_retain_submission_number'] = 0;
909
  }
910
+ // Polls.
911
  if ( isset( $post_data['poll_retain_submission_number'] ) ) {
912
+ $poll_submissions_retention_number = intval( $post_data['poll_retain_submission_number'] );
 
 
913
  if ( $poll_submissions_retention_number < 0 ) {
914
  $poll_submissions_retention_number = 0;
915
  }
916
  update_option( 'forminator_retain_poll_submissions_interval_number', $poll_submissions_retention_number );
917
  }
918
  update_option( 'forminator_retain_poll_submissions_interval_unit', $post_data['poll_retain_submission_unit'] );
919
+ // Submissions Retention.
920
 
921
+ // IP Retention.
922
  $poll_retain_ip_forever = filter_var( $post_data['poll_retain_ip_forever'], FILTER_VALIDATE_BOOLEAN );
923
  update_option( 'retain_poll_forever', $poll_retain_ip_forever );
924
  if ( $poll_retain_ip_forever ) {
925
  $post_data['poll_retain_ip_number'] = 0;
926
  }
927
  if ( isset( $post_data['poll_retain_ip_number'] ) ) {
928
+ $votes_retention_number = intval( $post_data['poll_retain_ip_number'] );
 
 
929
  if ( $votes_retention_number < 0 ) {
930
  $votes_retention_number = 0;
931
  }
932
  update_option( 'forminator_retain_votes_interval_number', $votes_retention_number );
933
  }
934
  update_option( 'forminator_retain_votes_interval_unit', $post_data['poll_retain_ip_unit'] );
935
+ // IP Retention.
936
 
937
  /**
938
  * QUIZ
939
  */
940
+ // Submissions Retention.
941
  $quiz_retain_submissions_forever = filter_var( $post_data['quiz_retain_submission_forever'], FILTER_VALIDATE_BOOLEAN );
942
  update_option( 'quiz_retain_submission_forever', $quiz_retain_submissions_forever );
943
  if ( $quiz_retain_submissions_forever ) {
944
  $post_data['quiz_retain_submission_number'] = 0;
945
  }
946
  if ( isset( $post_data['quiz_retain_submission_number'] ) ) {
947
+ $quiz_submissions_retention_number = intval( $post_data['quiz_retain_submission_number'] );
 
 
948
  if ( $quiz_submissions_retention_number < 0 ) {
949
  $quiz_submissions_retention_number = 0;
950
  }
951
  update_option( 'forminator_retain_quiz_submissions_interval_number', $quiz_submissions_retention_number );
952
  }
953
  update_option( 'forminator_retain_quiz_submissions_interval_unit', $post_data['quiz_retain_submission_unit'] );
954
+ // Submissions Retention.
955
 
956
  wp_send_json_success();
957
  }
987
  if ( 'custom_form' === $slug ) {
988
  $slug = 'form';
989
  }
990
+ // Validate nonce.
991
  forminator_validate_ajax( 'forminator_save_import_' . $slug );
992
 
993
+ $importable = trim( Forminator_Core::sanitize_text_field( 'importable' ) );
 
994
 
995
  $import_data = json_decode( $importable, true );
996
 
997
+ // hook custom data here.
998
  $import_data = apply_filters( 'forminator_' . $slug . '_import_data', $import_data );
999
 
1000
  try {
1047
 
1048
  switch ( $type ) {
1049
  case 'cf7':
1050
+ if ( class_exists( 'Forminator_Admin_Import_CF7' ) ) {
1051
  $class = new Forminator_Admin_Import_CF7();
1052
+ }
1053
  break;
1054
  case 'ninja':
1055
+ if ( class_exists( 'Forminator_Admin_Import_Ninja' ) ) {
1056
+ $class = new Forminator_Admin_Import_Ninja();
1057
+ }
1058
  break;
1059
  case 'gravity':
1060
+ if ( class_exists( 'Forminator_Admin_Import_Gravity' ) ) {
1061
+ return new Forminator_Admin_Import_Gravity();
1062
+ }
1063
  break;
1064
  default:
1065
  break;
1075
  * @since 1.5
1076
  */
1077
  public function load_import_custom_form_cf7() {
1078
+ if ( ! Forminator::is_import_export_feature_enabled() || ! forminator_is_import_plugin_enabled( 'cf7' ) ) {
1079
  wp_send_json_success( '' );
1080
  }
1081
+ // Validate nonce.
1082
+ forminator_validate_ajax( 'forminator_popup_import_cform_cf7' );
1083
 
1084
  $html = forminator_template( 'custom-form/popup/import-cf7' );
1085
 
1098
  if ( ! Forminator::is_import_export_feature_enabled() || ! forminator_is_import_plugin_enabled( 'cf7' ) ) {
1099
  wp_send_json_error( __( 'Import Export Feature disabled.', 'forminator' ) );
1100
  }
1101
+ // Validate nonce.
1102
+ forminator_validate_ajax( 'forminator_save_import_custom_form_cf7' );
1103
 
1104
  $post_data = $this->get_post_data();
1105
+ $importable = ( isset( $post_data['cf7_forms'] ) ? $post_data['cf7_forms'] : '' );
1106
  $importer = $this->importers( 'cf7' );
1107
  if ( ! empty( $importer ) ) :
1108
  if ( ! empty( $importable ) ) {
1143
  * @since 1.5
1144
  */
1145
  public function load_import_custom_form_ninja() {
1146
+ if ( ! Forminator::is_import_export_feature_enabled() || ! forminator_is_import_plugin_enabled( 'ninjaforms' ) ) {
1147
  wp_send_json_success( '' );
1148
  }
1149
+ // Validate nonce.
1150
+ forminator_validate_ajax( 'forminator_popup_import_cform_ninjaforms' );
1151
 
1152
  $html = forminator_template( 'custom-form/popup/import-ninjaforms' );
1153
 
1161
  */
1162
  public function save_import_custom_form_ninja() {
1163
 
1164
+ if ( ! Forminator::is_import_export_feature_enabled() || ! forminator_is_import_plugin_enabled( 'ninjaforms' ) ) {
1165
  wp_send_json_error( __( 'Import Export Feature disabled.', 'forminator' ) );
1166
  }
1167
+ // Validate nonce.
1168
+ forminator_validate_ajax( 'forminator_save_import_custom_form_ninja' );
1169
 
1170
+ $importable = Forminator_Core::sanitize_text_field( 'ninjaforms' );
1171
+ $importer = ( ! empty( $this->importers( 'ninja' ) ) ? $this->importers( 'ninja' ) : '' );
 
1172
 
1173
+ if ( ! empty( $importer ) ) :
1174
  if ( 'all' !== $importable && '' !== $importable ) {
1175
 
1176
+ $importable = absint( $importable );
1177
+ $imported = $importer->import_form( $importable );
1178
 
1179
  if ( 'fail' === $imported['type'] ) {
1180
  wp_send_json_error( $imported['message'] );
1185
  } elseif ( '' !== $importable ) {
1186
  $forms = forminator_list_thirdparty_contact_forms( 'ninjaforms' );
1187
 
1188
+ foreach ( $forms as $key => $value ) {
1189
  $imported = $importer->import_form( $value->get_id() );
1190
 
1191
  if ( 'fail' === $imported['type'] ) {
1193
  }
1194
  }
1195
 
1196
+ if ( ! empty( $error ) ) {
1197
  wp_send_json_error( $error );
1198
  }
1199
 
1210
  * @since 1.5
1211
  */
1212
  public function load_import_custom_form_gravity() {
1213
+ if ( ! Forminator::is_import_export_feature_enabled() || ! forminator_is_import_plugin_enabled( 'gravityforms' ) ) {
1214
  wp_send_json_success( '' );
1215
  }
1216
+ // Validate nonce.
1217
+ forminator_validate_ajax( 'forminator_popup_import_cform_gravityforms' );
1218
 
1219
  $html = forminator_template( 'custom-form/popup/import-gravityforms' );
1220
 
1228
  */
1229
  public function save_import_custom_form_gravity() {
1230
 
1231
+ if ( ! Forminator::is_import_export_feature_enabled() || ! forminator_is_import_plugin_enabled( 'gravityforms' ) ) {
1232
  wp_send_json_error( __( 'Import Export Feature disabled.', 'forminator' ) );
1233
  }
1234
+ // Validate nonce.
1235
+ forminator_validate_ajax( 'forminator_save_import_custom_form_gravity' );
1236
 
1237
+ $importable = Forminator_Core::sanitize_text_field( 'gravityforms' );
1238
+ $importer = ( ! empty( $this->importers( 'gravity' ) ) ? $this->importers( 'gravity' ) : '' );
 
1239
 
1240
+ if ( ! empty( $importer ) ) :
1241
  if ( 'all' !== $importable && '' !== $importable ) {
1242
 
1243
+ $importable = absint( $importable );
1244
+ $imported = $importer->import_form( $importable );
1245
 
1246
  if ( 'fail' === $imported['type'] ) {
1247
  wp_send_json_error( $imported['message'] );
1252
  } elseif ( '' !== $importable ) {
1253
  $forms = forminator_list_thirdparty_contact_forms( 'gravityforms' );
1254
 
1255
+ foreach ( $forms as $key => $value ) {
1256
  $imported = $importer->import_form( $value['id'] );
1257
 
1258
  if ( 'fail' === $imported['type'] ) {
1260
  }
1261
  }
1262
 
1263
+ if ( ! empty( $error ) ) {
1264
  wp_send_json_error( $error );
1265
  }
1266
 
1284
  if ( 'custom_form' === $slug ) {
1285
  $slug = 'form';
1286
  }
1287
+ // Validate nonce.
1288
  forminator_validate_ajax( 'forminator_popup_export_' . $slug );
1289
 
1290
  $html = forminator_template( 'common/popup/export', array( 'slug' => $slug ) );
1307
  if ( 'custom_form' === $slug ) {
1308
  $slug = 'form';
1309
  }
1310
+ // Validate nonce.
1311
  forminator_validate_ajax( 'forminator_popup_import_' . forminator_get_prefix( $slug, 'c' ) );
1312
 
1313
  $html = forminator_template( 'common/popup/import', array( 'slug' => $slug ) );
1321
  * @since 1.6
1322
  */
1323
  public function save_pagination() {
1324
+ // Validate nonce.
1325
  forminator_validate_ajax( 'forminator_save_popup_pagination' );
1326
 
1327
+ $pagination = filter_input( INPUT_POST, 'pagination_entries', FILTER_VALIDATE_INT );
1328
+ $pagination_listing = filter_input( INPUT_POST, 'pagination_listings', FILTER_VALIDATE_INT );
1329
 
1330
  if ( 1 > $pagination || 1 > $pagination_listing ) {
1331
  wp_send_json_error( __( 'Limit per page can not be less than one.', 'forminator' ) );
1343
  * @since 1.6.1
1344
  */
1345
  public function save_accessibility_settings() {
1346
+ // Validate nonce.
1347
  forminator_validate_ajax( 'forminator_save_accessibility_settings' );
1348
 
1349
+ $enable_accessibility = filter_input( INPUT_POST, 'enable_accessibility', FILTER_VALIDATE_BOOLEAN );
 
1350
 
1351
  update_option( 'forminator_enable_accessibility', $enable_accessibility );
1352
  wp_send_json_success();
1358
  * @since 1.6.3
1359
  */
1360
  public function save_dashboard_settings() {
1361
+ // Validate nonce.
1362
  forminator_validate_ajax( 'forminator_save_dashboard_settings' );
1363
 
1364
  $dashboard_settings = forminator_get_dashboard_settings();
 
1365
  $widgets = array( 'forms', 'polls', 'quizzes' );
1366
 
1367
+ $num_recents = filter_input( INPUT_POST, 'num_recent', FILTER_VALIDATE_INT, FILTER_REQUIRE_ARRAY );
1368
+ $num_recents = is_array( $num_recents ) ? $num_recents : array();
1369
+ $publisheds = filter_input( INPUT_POST, 'published', FILTER_VALIDATE_BOOLEAN, FILTER_REQUIRE_ARRAY );
1370
+ $publisheds = is_array( $publisheds ) ? $publisheds : array();
1371
+ $drafts = filter_input( INPUT_POST, 'draft', FILTER_VALIDATE_BOOLEAN, FILTER_REQUIRE_ARRAY );
1372
+ $drafts = is_array( $drafts ) ? $drafts : array();
1373
 
1374
+ // value based settings.
1375
  foreach ( $num_recents as $widget => $value ) {
1376
  if ( ! isset( $dashboard_settings[ $widget ] ) ) {
1377
  $dashboard_settings[ $widget ] = array();
1378
  }
1379
+ // at least 0.
 
1380
  if ( $value >= 0 ) {
1381
+ $dashboard_settings[ $widget ]['num_recent'] = $value;
1382
  }
1383
  }
1384
 
1385
+ // bool based settings aka checkboxes.
1386
  foreach ( $widgets as $widget ) {
1387
  if ( ! isset( $dashboard_settings[ $widget ] ) ) {
1388
  $dashboard_settings[ $widget ] = array();
1389
  }
1390
 
1391
+ // default enabled, handle when not exist = false.
1392
  if ( ! isset( $publisheds[ $widget ] ) ) {
1393
  $dashboard_settings[ $widget ]['published'] = false;
1394
  }
1398
  }
1399
 
1400
  update_option( 'forminator_dashboard_settings', $dashboard_settings );
1401
+ $sender_email = filter_input( INPUT_POST, 'sender_email', FILTER_SANITIZE_EMAIL );
1402
+ if ( $sender_email ) {
1403
+ update_option( 'forminator_sender_email_address', $sender_email );
1404
+ }
1405
+ $sender_name = Forminator_Core::sanitize_text_field( 'sender_name' );
1406
+ if ( $sender_name ) {
1407
+ update_option( 'forminator_sender_name', $sender_name );
1408
+ }
1409
 
1410
+ $pagination = filter_input( INPUT_POST, 'pagination_entries', FILTER_VALIDATE_INT );
1411
+ $pagination_listing = filter_input( INPUT_POST, 'pagination_listings', FILTER_VALIDATE_INT );
1412
 
1413
  if ( 1 > $pagination || 1 > $pagination_listing ) {
1414
  wp_send_json_error( __( 'Limit per page can not be less than one.', 'forminator' ) );
1417
  update_option( 'forminator_pagination_entries', $pagination );
1418
  update_option( 'forminator_pagination_listings', $pagination_listing );
1419
 
1420
+ $editor_settings = Forminator_Core::sanitize_text_field( 'editor_settings', false );
1421
+ update_option( 'forminator_editor_settings', $editor_settings );
 
 
 
1422
 
1423
  wp_send_json_success();
1424
  }
1430
  */
1431
  public function validate_calculation_formula() {
1432
 
1433
+ // Validate nonce.
1434
  forminator_validate_ajax( 'forminator_validate_calculation_formula' );
1435
 
1436
  try {
1437
+ $formula = Forminator_Core::sanitize_text_field( 'formula' );
 
1438
  $formula = forminator_calculator_maybe_dummify_fields_on_formula( $formula );
1439
  $calculator = new Forminator_Calculator( $formula );
1440
+ // handle throw.
1441
  $calculator->set_is_throwable( true );
1442
  $calculator->parse();
1443
 
1454
  * @since 1.7
1455
  */
1456
  public function stripe_disconnect() {
1457
+ // Validate nonce.
1458
  forminator_validate_ajax( 'forminatorSettingsRequest' );
1459
 
1460
  if ( class_exists( 'Forminator_Gateway_Stripe' ) ) {
1481
  * @since 1.7
1482
  */
1483
  public function paypal_disconnect() {
1484
+ // Validate nonce.
1485
  forminator_validate_ajax( 'forminatorSettingsRequest' );
1486
 
1487
  if ( class_exists( 'Forminator_PayPal_Express' ) ) {
1508
  * @since 1.7
1509
  */
1510
  public function stripe_update_page() {
1511
+ // Validate nonce.
1512
  forminator_validate_ajax( 'forminator_stripe_settings_modal' );
1513
 
1514
  $file = forminator_plugin_dir() . 'admin/views/settings/payments/section-stripe.php';
1527
  * @since 1.7
1528
  */
1529
  public function paypal_update_page() {
1530
+ // Validate nonce.
1531
  forminator_validate_ajax( 'forminator_paypal_settings_modal' );
1532
 
1533
  $file = forminator_plugin_dir() . 'admin/views/settings/payments/section-paypal.php';
1550
  return false;
1551
  }
1552
 
1553
+ // Validate nonce.
1554
  forminator_validate_ajax( 'forminator_stripe_settings_modal' );
1555
 
1556
  $data = array();
1557
 
1558
+ $post_data = Forminator_Core::sanitize_array( $_POST );
1559
+ $is_connect_request = isset( $post_data['connect'] ) ? $post_data['connect'] : false;
1560
  $template_vars = array();
1561
  try {
1562
  $stripe = new Forminator_Gateway_Stripe();
1563
 
1564
+ $test_key = isset( $post_data['test_key'] ) ? $post_data['test_key'] : $stripe->get_test_key();
1565
+ $test_secret = isset( $post_data['test_secret'] ) ? $post_data['test_secret'] : $stripe->get_test_secret();
1566
+ $live_key = isset( $post_data['live_key'] ) ? $post_data['live_key'] : $stripe->get_live_key();
1567
+ $live_secret = isset( $post_data['live_secret'] ) ? $post_data['live_secret'] : $stripe->get_live_secret();
1568
  $default_currency = $stripe->get_default_currency();
1569
 
1570
  $template_vars['test_key'] = $test_key;
1660
  $data['buttons'] = array();
1661
 
1662
  $data['buttons']['connect']['markup'] = '<div class="sui-actions-right">' .
1663
+ '<button class="sui-button forminator-stripe-connect" type="button" data-nonce="' . wp_create_nonce( 'forminator_stripe_settings_modal' ) . '">' .
1664
+ '<span class="sui-loading-text">' . esc_html__( 'Connect', 'forminator' ) . '</span>' .
1665
+ '<i class="sui-icon-loader sui-loading" aria-hidden="true"></i>' .
1666
+ '</button>' .
1667
+ '</div>';
1668
 
1669
  wp_send_json_success( $data );
1670
  }
1675
  * @since 1.7.1
1676
  */
1677
  public function paypal_settings_modal() {
1678
+ // Validate nonce.
1679
  forminator_validate_ajax( 'forminator_paypal_settings_modal' );
1680
 
1681
  $data = array();
1682
 
1683
+ $post_data = Forminator_Core::sanitize_array( $_POST );
1684
+ $is_connect_request = isset( $post_data['connect'] ) ? $post_data['connect'] : false;
1685
  $template_vars = array();
1686
 
1687
  try {
1688
  $paypal = new Forminator_PayPal_Express();
1689
 
1690
+ $sandbox_id = isset( $post_data['sandbox_id'] ) ? $post_data['sandbox_id'] : $paypal->get_sandbox_id();
1691
+ $sandbox_secret = isset( $post_data['sandbox_secret'] ) ? $post_data['sandbox_secret'] : $paypal->get_sandbox_secret();
1692
+ $live_id = isset( $post_data['live_id'] ) ? $post_data['live_id'] : $paypal->get_live_id();
1693
+ $live_secret = isset( $post_data['live_secret'] ) ? $post_data['live_secret'] : $paypal->get_live_secret();
1694
  $default_currency = $paypal->get_default_currency();
1695
 
1696
  $template_vars['sandbox_id'] = $sandbox_id;
1786
  $data['buttons'] = array();
1787
 
1788
  $data['buttons']['connect']['markup'] = '<div class="sui-actions-right">' .
1789
+ '<button class="sui-button forminator-paypal-connect" type="button" data-nonce="' . wp_create_nonce( 'forminator_paypal_settings_modal' ) . '">' .
1790
+ '<span class="sui-loading-text">' . esc_html__( 'Connect', 'forminator' ) . '</span>' .
1791
+ '<i class="sui-icon-loader sui-loading" aria-hidden="true"></i>' .
1792
+ '</button>' .
1793
+ '</div>';
1794
 
1795
  wp_send_json_success( $data );
1796
  }
1803
  public function dismiss_notice() {
1804
  forminator_validate_ajax( 'forminator_dismiss_notification' );
1805
 
1806
+ $notification_name = Forminator_Core::sanitize_text_field( 'prop' );
1807
+ $input_value = Forminator_Core::sanitize_text_field( 'value' );
1808
 
1809
  if ( ! empty( $input_value ) ) {
1810
  update_option( $notification_name, $input_value );
1827
  public function dismiss_admin_notice() {
1828
  forminator_validate_ajax( 'forminator_dismiss_notice' );
1829
 
1830
+ $slug = Forminator_Core::sanitize_text_field( 'slug' );
1831
  $user_id = get_current_user_id();
1832
  $dismissed = get_user_meta( $user_id, 'frmt_dismissed_messages', true );
1833
  if ( ! $dismissed || ! is_array( $dismissed ) ) {
1845
  * @since 1.9
1846
  */
1847
  public function later_notice() {
1848
+ forminator_validate_ajax( 'forminator_dismiss_notification' );
1849
 
1850
+ $notification_name = Forminator_Core::sanitize_text_field( 'prop' );
1851
+ $form_id = filter_input( INPUT_POST, 'form_id', FILTER_VALIDATE_INT );
1852
 
1853
  update_post_meta( $form_id, $notification_name, true );
1854
 
1863
  public function save_payments() {
1864
  forminator_validate_ajax( 'forminator_save_payments_settings' );
1865
 
1866
+ // stripe.
1867
+ $default_currency = filter_input( INPUT_POST, 'stripe-default-currency' );
1868
+ if ( $default_currency ) {
1869
 
1870
  try {
1871
  $stripe = new Forminator_Gateway_Stripe();
1890
  }
1891
  }
1892
 
1893
+ // paypal.
1894
+ $pp_default_currency = Forminator_Core::sanitize_text_field( 'paypal-default-currency' );
1895
+ if ( $pp_default_currency ) {
1896
+ $default_currency = $pp_default_currency;
1897
 
1898
  try {
1899
  $paypal = new Forminator_PayPal_Express();
1930
  public function delete_poll_submissions() {
1931
  forminator_validate_ajax( 'forminatorPollEntries' );
1932
 
1933
+ $form_id = filter_input( INPUT_POST, 'id', FILTER_VALIDATE_INT );
1934
+ if ( $form_id ) {
1935
 
1936
  Forminator_Form_Entry_Model::delete_by_form( $form_id );
1937
 
1967
  public function dismiss_prelaunch_subscriptions_notice() {
1968
  forminator_validate_ajax( 'forminator_dismiss_prelaunch_subscriptions' );
1969
 
1970
+ $slug = Forminator_Core::sanitize_text_field( 'prop' );
1971
 
1972
+ $dismissed_messages = get_user_meta( get_current_user_id(), 'frmt_dismissed_messages', true );
1973
+ $dismissed_messages = empty( $dismissed_messages ) ? array() : $dismissed_messages;
1974
  $dismissed_messages[ $slug ] = true;
1975
 
1976
  update_user_meta( get_current_user_id(), 'frmt_dismissed_messages', $dismissed_messages );
1977
  }
1978
 
1979
+ /**
1980
+ * Dismiss Black Friday notice
1981
+ */
1982
+ public function dismiss_black_friday() {
1983
+ forminator_validate_ajax( 'forminator_dismiss_notification' );
1984
+ $slug = Forminator_Core::sanitize_text_field( 'prop' );
1985
+ add_site_option( $slug, true );
1986
+ }
1987
+
1988
  /**
1989
  * Module search for all types
1990
  *
1992
  */
1993
  public function module_search() {
1994
  forminator_validate_ajax( 'forminator-nonce-search-module' );
1995
+ $html = '';
1996
+ $keyword = Forminator_Core::sanitize_text_field( 'search_keyword' );
1997
+ $modules = Forminator_Admin_Module_Edit_Page::get_searched_modules( $keyword );
1998
 
1999
  ob_start();
2000
+ Forminator_Admin_Module_Edit_Page::show_modules(
2001
+ $modules,
2002
+ Forminator_Core::sanitize_text_field( 'module_slug' ),
2003
+ Forminator_Core::sanitize_text_field( 'preview_dialog' ),
2004
+ Forminator_Core::sanitize_text_field( 'preview_title' ),
2005
+ Forminator_Core::sanitize_text_field( 'export_dialog' ),
2006
+ Forminator_Core::sanitize_text_field( 'post_type' ),
2007
+ Forminator_Core::sanitize_text_field( 'soon' ),
2008
+ Forminator_Core::sanitize_text_field( 'sql_month_start_date' ),
2009
+ Forminator_Core::sanitize_text_field( 'wizard_page' ),
2010
+ $keyword
2011
+ );
2012
  $html = ob_get_clean();
2013
 
2014
  wp_send_json_success( $html );
2018
  * Addons page details
2019
  */
2020
  public function addons_page_details() {
2021
+ // Validate nonce.
2022
  forminator_validate_ajax( 'forminator_addons_page_details' );
2023
 
2024
+ $pid = filter_input( INPUT_POST, 'id' );
2025
+ if ( ! $pid ) {
 
 
2026
  wp_send_json_error();
2027
  }
2028
 
 
 
2029
  $file = forminator_plugin_dir() . 'admin/views/addons/addon-details.php';
2030
 
2031
  ob_start();
2037
  }
2038
 
2039
  public function addons_page_actions() {
2040
+ // Validate nonce.
2041
  forminator_validate_ajax( 'forminator_popup_addons_actions' );
2042
 
2043
+ $action = Forminator_Core::sanitize_text_field( 'action' );
2044
+ if ( ! $action ) {
2045
  wp_send_json_error(
2046
  array( 'message' => __( 'Required field missing', 'forminator' ) )
2047
  );
2048
  }
2049
 
2050
+ $action = str_replace( 'forminator_', '', $action );
2051
 
2052
  Forminator_Admin_Addons_page::get_instance()->addons_action_ajax( $action );
2053
 
admin/classes/class-admin-data.php CHANGED
@@ -67,7 +67,6 @@ class Forminator_Admin_Data {
67
  *
68
  * @return mixed
69
  * @since 1.8
70
- *
71
  */
72
  public static function get_pages() {
73
  if ( ! is_null( self::$pages ) ) {
@@ -89,7 +88,7 @@ class Forminator_Admin_Data {
89
  * @since 1.0
90
  */
91
  public function admin_js_defaults() {
92
- // Generate addon nonce
93
  Forminator_Addon_Admin_Ajax::get_instance()->generate_nonce();
94
  $id = filter_input( INPUT_GET, 'id', FILTER_VALIDATE_INT );
95
 
@@ -113,10 +112,10 @@ class Forminator_Admin_Data {
113
  'hasStripe' => forminator_has_stripe_connected(),
114
  'formNonce' => $this->get_nonce(),
115
  'resetTrackingDataNonce' => wp_create_nonce( 'forminator_reset_tracking_data' ),
116
- 'previewNonce' => wp_create_nonce( 'forminator_load_module' ),
117
  'searchNonce' => wp_create_nonce( 'forminator_search_emails' ),
118
  'gFontNonce' => wp_create_nonce( 'forminator_load_google_fonts' ),
119
- 'dismissNonce' => wp_create_nonce( 'forminator_dismiss_notification' ),
120
  'formProcessNonce' => wp_create_nonce( 'forminator_form_request' ),
121
  'formExportNonce' => wp_create_nonce( 'forminator_popup_export_form' ),
122
  'pollProcessNonce' => wp_create_nonce( 'forminator_poll_request' ),
@@ -159,7 +158,7 @@ class Forminator_Admin_Data {
159
  'pollAnswerColors' => forminator_get_poll_chart_colors(),
160
  'isMainSite' => forminator_is_main_site(),
161
  'isSubdomainNetwork' => forminator_is_subdomain_network(),
162
- 'showFieldSettings' => get_option( 'forminator_editor_settings', "true" ),
163
  'hasStripePro' => defined( 'FORMINATOR_STRIPE_ADDON' ) && class_exists( 'Forminator_Stripe_Addon' ),
164
  'stripeForms' => $this->get_forms_by_field_type( 'stripe' ),
165
  'paypalForms' => $this->get_forms_by_field_type( 'paypal' ),
67
  *
68
  * @return mixed
69
  * @since 1.8
 
70
  */
71
  public static function get_pages() {
72
  if ( ! is_null( self::$pages ) ) {
88
  * @since 1.0
89
  */
90
  public function admin_js_defaults() {
91
+ // Generate addon nonce.
92
  Forminator_Addon_Admin_Ajax::get_instance()->generate_nonce();
93
  $id = filter_input( INPUT_GET, 'id', FILTER_VALIDATE_INT );
94
 
112
  'hasStripe' => forminator_has_stripe_connected(),
113
  'formNonce' => $this->get_nonce(),
114
  'resetTrackingDataNonce' => wp_create_nonce( 'forminator_reset_tracking_data' ),
115
+ 'previewNonce' => wp_create_nonce( 'forminator_load_module' ),
116
  'searchNonce' => wp_create_nonce( 'forminator_search_emails' ),
117
  'gFontNonce' => wp_create_nonce( 'forminator_load_google_fonts' ),
118
+ 'dismissNonce' => wp_create_nonce( 'forminator_dismiss_notification' ),
119
  'formProcessNonce' => wp_create_nonce( 'forminator_form_request' ),
120
  'formExportNonce' => wp_create_nonce( 'forminator_popup_export_form' ),
121
  'pollProcessNonce' => wp_create_nonce( 'forminator_poll_request' ),
158
  'pollAnswerColors' => forminator_get_poll_chart_colors(),
159
  'isMainSite' => forminator_is_main_site(),
160
  'isSubdomainNetwork' => forminator_is_subdomain_network(),
161
+ 'showFieldSettings' => get_option( 'forminator_editor_settings', 'true' ),
162
  'hasStripePro' => defined( 'FORMINATOR_STRIPE_ADDON' ) && class_exists( 'Forminator_Stripe_Addon' ),
163
  'stripeForms' => $this->get_forms_by_field_type( 'stripe' ),
164
  'paypalForms' => $this->get_forms_by_field_type( 'paypal' ),
admin/classes/class-admin-l10n.php CHANGED
@@ -38,118 +38,118 @@ class Forminator_Admin_L10n {
38
  */
39
  public function admin_l10n() {
40
  $properties = array(
41
- "popup" => array(
42
- "form_name_label" => __( "Name your form", 'forminator' ),
43
- "form_name_placeholder" => __( "E.g., Contact Form", 'forminator' ),
44
- "name" => __( "Name", 'forminator' ),
45
- "fields" => __( "Fields", 'forminator' ),
46
- "date" => __( "Date", 'forminator' ),
47
- "clear_all" => __( "Clear All", 'forminator' ),
48
- "your_exports" => __( "Your exports", 'forminator' ),
49
- "edit_login_form" => __( "Edit Login or Register form", 'forminator' ),
50
- "edit_scheduled_export" => __( "Edit Scheduled Export", 'forminator' ),
51
- "frequency" => __( "Frequency", 'forminator' ),
52
- "daily" => __( "Daily", 'forminator' ),
53
- "weekly" => __( "Weekly", 'forminator' ),
54
- "monthly" => __( "Monthly", 'forminator' ),
55
- "week_day" => __( "Day of the week", 'forminator' ),
56
- "monday" => __( "Monday", 'forminator' ),
57
- "tuesday" => __( "Tuesday", 'forminator' ),
58
- "wednesday" => __( "Wednesday", 'forminator' ),
59
- "thursday" => __( "Thursday", 'forminator' ),
60
- "friday" => __( "Friday", 'forminator' ),
61
- "saturday" => __( "Saturday", 'forminator' ),
62
- "sunday" => __( "Sunday", 'forminator' ),
63
- "day_time" => __( "Time of the day", 'forminator' ),
64
- "email_to" => __( "Email export data to", 'forminator' ),
65
- "email_placeholder" => __( "E.g., john@doe.com", 'forminator' ),
66
- "schedule_help" => __( "Leave blank if you don't want to receive exports via email.", 'forminator' ),
67
- "congratulations" => __( "Congratulations!", 'forminator' ),
68
- "is_ready" => __( "is ready!", 'forminator' ),
69
- "new_form_desc" => __( "Add it to any post / page by clicking Forminator button, or set it up as a Widget.", 'forminator' ),
70
- "paypal_settings" => __( "Edit PayPal credentials", 'forminator' ),
71
- "preview_cforms" => __( "Preview Custom Form", 'forminator' ),
72
- "preview_polls" => __( "Preview Poll", 'forminator' ),
73
- "preview_quizzes" => __( "Preview Quiz", 'forminator' ),
74
- "captcha_settings" => __( "Edit reCAPTCHA credentials", 'forminator' ),
75
- "currency_settings" => __( "Edit default currency", 'forminator' ),
76
- "pagination_entries" => __( "Submissions | Pagination Settings", 'forminator' ),
77
- "pagination_listings" => __( "Listings | Pagination Settings", 'forminator' ),
78
- "email_settings" => __( "Email Settings", 'forminator' ),
79
- "uninstall_settings" => __( "Uninstall Settings", 'forminator' ),
80
- "privacy_settings" => __( "Privacy Settings", 'forminator' ),
81
- "validate_form_name" => __( "Form name cannot be empty! Please pick a name for your form.", 'forminator' ),
82
- "close" => __( "Close", 'forminator' ),
83
- "close_label" => __( "Close this dialog window", 'forminator' ),
84
- 'go_back' => __( 'Go back', 'forminator' ),
85
- 'records' => __( "Records", 'forminator' ),
86
- "delete" => __( "Delete", 'forminator' ),
87
- "confirm" => __( "Confirm", 'forminator' ),
88
- "are_you_sure" => __( "Are you sure?", 'forminator' ),
89
- "cannot_be_reverted" => __( "Have in mind this action cannot be reverted.", 'forminator' ),
90
- "are_you_sure_form" => __( "Are you sure you wish to permanently delete this form?", 'forminator' ),
91
- "are_you_sure_poll" => __( "Are you sure you wish to permanently delete this poll?", 'forminator' ),
92
- "are_you_sure_quiz" => __( "Are you sure you wish to permanently delete this quiz?", 'forminator' ),
93
- "delete_form" => __( "Delete Form", 'forminator' ),
94
- "delete_poll" => __( "Delete Poll", 'forminator' ),
95
- "delete_quiz" => __( "Delete Quiz", 'forminator' ),
96
- "confirm_action" => __( "Please confirm that you want to do this action.", 'forminator' ),
97
- "confirm_title" => __( "Confirm Action", 'forminator' ),
98
- "confirm_field_delete" => __( "Please confirm that you want to delete this field", 'forminator' ),
99
- "cancel" => __( "Cancel", 'forminator' ),
100
- "save_alert" => __( "The changes you made may be lost if you navigate away from this page.", 'forminator' ),
101
- "save_changes" => __( "Save Changes", 'forminator' ),
102
- "save" => __( "Save", 'forminator' ),
103
- "export_cform" => __( "Export Form", 'forminator' ),
104
- "export_poll" => __( "Export Poll", 'forminator' ),
105
- "export_quiz" => __( "Export Quiz", 'forminator' ),
106
- "import_cform" => __( "Import Form", 'forminator' ),
107
- "import_cform_cf7" => __( "Import", 'forminator' ),
108
- "import_cform_ninja" => __( "Import Ninja Forms", 'forminator' ),
109
- "import_cform_gravity" => __( "Import Gravity Forms", 'forminator' ),
110
- "import_poll" => __( "Import Poll", 'forminator' ),
111
- "import_quiz" => __( "Import Quiz", 'forminator' ),
112
  'enable_scheduled_export' => __( 'Enable scheduled exports', 'forminator' ),
113
  'scheduled_export_if_new' => __( 'Send email only if there are new submissions', 'forminator' ),
114
- "download_csv" => __( 'Download CSV', 'forminator' ),
115
- "scheduled_exports" => __( 'Scheduled Exports', 'forminator' ),
116
- "manual_exports" => __( 'Manual Exports', 'forminator' ),
117
- "manual_description" => __( 'Download the submissions list in .csv format.', 'forminator' ),
118
- "scheduled_description" => __( 'Enable scheduled exports to get the submissions list in your email.', 'forminator' ),
119
- "disable" => __( 'Disable', 'forminator' ),
120
- "enable" => __( 'Enable', 'forminator' ),
121
- "enter_name" => __( 'Enter a name', 'forminator' ),
122
- "new_form_desc2" => __( 'Name your new form, then let\'s start building!', 'forminator' ),
123
- "new_poll_desc2" => __( 'Name your new poll, then let\'s start building!', 'forminator' ),
124
- "new_quiz_desc2" => __( 'Choose whether you want to collect participants details (e.g. name, email, etc.) on your quiz.'),
125
- "learn_more" => __( 'Learn more', 'forminator' ),
126
- "input_label" => __( 'Input Label', 'forminator' ),
127
- "form_name_validation" => __( 'Form name cannot be empty.', 'forminator' ),
128
- "poll_name_validation" => __( 'Poll name cannot be empty.', 'forminator' ),
129
- "quiz_name_validation" => __( 'Quiz name cannot be empty.', 'forminator' ),
130
- "new_form_placeholder" => __( 'E.g., Blank Form', 'forminator' ),
131
- "new_poll_placeholder" => __( 'E.g., Blank Poll', 'forminator' ),
132
- "new_quiz_placeholder" => __( 'E.g., My Awesome Quiz', 'forminator' ),
133
- "create" => __( 'Create', 'forminator' ),
134
  'reset' => __( 'RESET', 'forminator' ),
135
- "disconnect" => __( 'Disconnect', 'forminator' ),
136
- "apply_submission_filter" => __( 'Apply Submission Filters', 'forminator' ),
137
  'registration_notice' => __( "This template allows you to create your own registration form and insert it on a custom page. This doesn't modify the default registration form.", 'forminator' ),
138
  'login_notice' => __( "This template allows you to create your own login form and insert it on a custom page. This doesn't modify the default login form.", 'forminator' ),
139
  'approve_user' => __( 'Approve', 'forminator' ),
140
  'registration_name' => __( 'User Registration', 'forminator' ),
141
  'login_name' => __( 'User Login', 'forminator' ),
142
- "deactivate" => __( 'Deactivate', 'forminator' ),
143
- "deactivateContent" => __( 'Are you sure you want to deactivate this Add-on?', 'forminator' ),
144
- "deactivateAnyway" => __( 'Deactivate Anyway', 'forminator' ),
145
- "forms" => __( 'Forms', 'forminator' ),
146
  ),
147
  'quiz' => array(
148
  'choose_quiz_title' => __( 'Create Quiz', 'forminator' ),
149
  'choose_quiz_description' => __( "Let's start by giving your quiz a name and choosing the appropriate quiz type based on your goal.", 'forminator' ),
150
- 'quiz_name' => __( "Quiz Name", 'forminator' ),
151
- 'quiz_type' => __( "Quiz Type", 'forminator' ),
152
- 'collect_leads' => __( "Collect Leads", 'forminator' ),
153
  'no_pagination' => __( 'No Pagination', 'forminator' ),
154
  'paginate_quiz' => __( 'Paginated Quiz', 'forminator' ),
155
  'presentation' => __( 'Presentation', 'forminator' ),
@@ -161,16 +161,16 @@ class Forminator_Admin_L10n {
161
  'nowrong_label' => __( 'Personality Quiz', 'forminator' ),
162
  'nowrong_description' => __( "Show different outcomes depending on the visitor's answers. There are no wrong answers. E.g., Which superhero are you?", 'forminator' ),
163
  'continue_button' => __( 'Continue', 'forminator' ),
164
- 'quiz_leads_toggle' => __( 'Collect leads on your quiz', 'forminator' ),
165
- 'create_quiz' => __( 'Create Quiz', 'forminator' ),
166
- 'quiz_leads_desc' => __( 'We will automatically create a default lead generation form for you. The lead generation form uses the Forms module, and some of the settings are shared between this quiz and the leads form.')
167
  ),
168
  'form' => array(
169
  'form_template_title' => __( 'Choose a template', 'forminator' ),
170
  'form_template_description' => __( 'Customize one of our pre-made form templates, or start from scratch.' ),
171
  'continue_button' => __( 'Continue', 'forminator' ),
172
- 'result' => __( 'result', 'forminator' ),
173
- 'results' => __( 'results', 'forminator' ),
174
  ),
175
  'sidebar' => array(
176
  'label' => __( 'Label', 'forminator' ),
@@ -253,86 +253,86 @@ class Forminator_Admin_L10n {
253
  'user_email' => __( 'User Email', 'forminator' ),
254
  'user_login' => __( 'User Login', 'forminator' ),
255
  'shortcode_copied' => __( 'Shortcode has been copied successfully.', 'forminator' ),
256
- 'uri_copied' => __( 'URI has been copied successfully.', 'forminator' ),
257
  ),
258
- "commons" => array(
259
- "color" => __( "Color", 'forminator' ),
260
- "colors" => __( "Colors", 'forminator' ),
261
- "border_color" => __( "Border color", 'forminator' ),
262
- "border_color_hover" => __( "Border color (hover)", 'forminator' ),
263
- "border_color_active" => __( "Border color (active)", 'forminator' ),
264
- "border_color_correct" => __( "Border color (correct)", 'forminator' ),
265
- "border_color_incorrect" => __( "Border color (incorrect)", 'forminator' ),
266
- "border_width" => __( "Border width", 'forminator' ),
267
- "border_style" => __( "Border style", 'forminator' ),
268
- "background" => __( "Background", 'forminator' ),
269
- "background_hover" => __( "Background (hover)", 'forminator' ),
270
- "background_active" => __( "Background (active)", 'forminator' ),
271
- "background_correct" => __( "Background (correct)", 'forminator' ),
272
- "background_incorrect" => __( "Background (incorrect)", 'forminator' ),
273
- "font_color" => __( "Font color", 'forminator' ),
274
- "font_color_hover" => __( "Font color (hover)", 'forminator' ),
275
- "font_color_active" => __( "Font color (active)", 'forminator' ),
276
- "font_color_correct" => __( "Font color (correct)", 'forminator' ),
277
- "font_color_incorrect" => __( "Font color (incorrect)", 'forminator' ),
278
- "font_background" => __( "Font background", 'forminator' ),
279
- "font_background" => __( "Font background (hover)", 'forminator' ),
280
- "font_background_active" => __( "Font background (active)", 'forminator' ),
281
- "font_family" => __( "Font family", 'forminator' ),
282
- "font_family_custom" => __( "Custom font family", 'forminator' ),
283
- "font_family_placeholder" => __( "E.g., 'Arial', sans-serif", 'forminator' ),
284
- "font_family_custom_description" => __( "Here you can type the font family you want to use, as you would in CSS.", 'forminator' ),
285
- "icon_size" => __( "Icon size", 'forminator' ),
286
- "enable" => __( "Enable", 'forminator' ),
287
- "dropdown" => __( "Dropdown", 'forminator' ),
288
- "appearance" => __( "Appearance", 'forminator' ),
289
- "expand" => __( "Expand", 'forminator' ),
290
- "placeholder" => __( "Placeholder", 'forminator' ),
291
- "preview" => __( "Preview", 'forminator' ),
292
- "icon_color" => __( "Icon color", 'forminator' ),
293
- "icon_color_hover" => __( "Icon color (hover)", 'forminator' ),
294
- "icon_color_active" => __( "Icon color (active)", 'forminator' ),
295
- "icon_color_correct" => __( "Icon color (correct)", 'forminator' ),
296
- "icon_color_incorrect" => __( "Icon color (incorrect)", 'forminator' ),
297
- "box_shadow" => __( "Box shadow", 'forminator' ),
298
- "enable_settings" => __( "Enable settings", 'forminator' ),
299
- "font_size" => __( "Font size", 'forminator' ),
300
- "font_weight" => __( "Font weight", 'forminator' ),
301
- "text_align" => __( "Text align", 'forminator' ),
302
- "regular" => __( "Regular", 'forminator' ),
303
- "medium" => __( "Medium", 'forminator' ),
304
- "large" => __( "Large", 'forminator' ),
305
- "light" => __( "Light", 'forminator' ),
306
- "normal" => __( "Normal", 'forminator' ),
307
- "bold" => __( "Bold", 'forminator' ),
308
- "typography" => __( "Typography", 'forminator' ),
309
- "padding_top" => __( "Top padding", 'forminator' ),
310
- "padding_right" => __( "Right padding", 'forminator' ),
311
- "padding_bottom" => __( "Bottom padding", 'forminator' ),
312
- "padding_left" => __( "Left padding", 'forminator' ),
313
- "border_radius" => __( "Border radius", 'forminator' ),
314
- "date_placeholder" => __( "20 April 2018", 'forminator' ),
315
- "left" => __( "Left", 'forminator' ),
316
- "center" => __( "Center", 'forminator' ),
317
- "right" => __( "Right", 'forminator' ),
318
- "none" => __( "None", 'forminator' ),
319
- "solid" => __( "Solid", 'forminator' ),
320
- "dashed" => __( "Dashed", 'forminator' ),
321
- "dotted" => __( "Dotted", 'forminator' ),
322
- "delete_option" => __( "Delete option", 'forminator' ),
323
- "label" => __( "Label", 'forminator' ),
324
- "value" => __( "Value", 'forminator' ),
325
- "reorder_option" => __( "Re-order this option", 'forminator' ),
326
- "forminator_ui" => __( "Forminator UI", 'forminator' ),
327
- "forminator_bold" => __( "Forminator Bold", 'forminator' ),
328
- "forminator_flat" => __( "Forminator Flat", 'forminator' ),
329
- "material_design" => __( "Material Design", 'forminator' ),
330
- "no_file_chosen" => __( "No file chosen", 'forminator' ),
331
- "update_successfully" => __( "saved succesfully!", 'forminator' ),
332
- "update_unsuccessfull" => __( "Error! Settings were not saved.", 'forminator' ),
333
- "approve_user_successfull" => __( "User approved succesfully.", 'forminator' ),
334
- "error_message" => __( "Something went wrong!", 'forminator' ),
335
- "approve_user_unsuccessfull" => __( "Error! User was not approved.", 'forminator' ),
336
  ),
337
  'social' => array(
338
  'facebook' => __( 'Facebook', 'forminator' ),
@@ -396,7 +396,7 @@ class Forminator_Admin_L10n {
396
  * @return array
397
  */
398
  private static function add_notice( $properties ) {
399
- $key = filter_input( INPUT_GET, 'forminator_notice', FILTER_SANITIZE_STRING );
400
  if ( $key ) {
401
  $notices = self::get_notices_list();
402
  if ( ! empty( $notices[ $key ] ) ) {
38
  */
39
  public function admin_l10n() {
40
  $properties = array(
41
+ 'popup' => array(
42
+ 'form_name_label' => __( 'Name your form', 'forminator' ),
43
+ 'form_name_placeholder' => __( 'E.g., Contact Form', 'forminator' ),
44
+ 'name' => __( 'Name', 'forminator' ),
45
+ 'fields' => __( 'Fields', 'forminator' ),
46
+ 'date' => __( 'Date', 'forminator' ),
47
+ 'clear_all' => __( 'Clear All', 'forminator' ),
48
+ 'your_exports' => __( 'Your exports', 'forminator' ),
49
+ 'edit_login_form' => __( 'Edit Login or Register form', 'forminator' ),
50
+ 'edit_scheduled_export' => __( 'Edit Scheduled Export', 'forminator' ),
51
+ 'frequency' => __( 'Frequency', 'forminator' ),
52
+ 'daily' => __( 'Daily', 'forminator' ),
53
+ 'weekly' => __( 'Weekly', 'forminator' ),
54
+ 'monthly' => __( 'Monthly', 'forminator' ),
55
+ 'week_day' => __( 'Day of the week', 'forminator' ),
56
+ 'monday' => __( 'Monday', 'forminator' ),
57
+ 'tuesday' => __( 'Tuesday', 'forminator' ),
58
+ 'wednesday' => __( 'Wednesday', 'forminator' ),
59
+ 'thursday' => __( 'Thursday', 'forminator' ),
60
+ 'friday' => __( 'Friday', 'forminator' ),
61
+ 'saturday' => __( 'Saturday', 'forminator' ),
62
+ 'sunday' => __( 'Sunday', 'forminator' ),
63
+ 'day_time' => __( 'Time of the day', 'forminator' ),
64
+ 'email_to' => __( 'Email export data to', 'forminator' ),
65
+ 'email_placeholder' => __( 'E.g., john@doe.com', 'forminator' ),
66
+ 'schedule_help' => __( "Leave blank if you don't want to receive exports via email.", 'forminator' ),
67
+ 'congratulations' => __( 'Congratulations!', 'forminator' ),
68
+ 'is_ready' => __( 'is ready!', 'forminator' ),
69
+ 'new_form_desc' => __( 'Add it to any post / page by clicking Forminator button, or set it up as a Widget.', 'forminator' ),
70
+ 'paypal_settings' => __( 'Edit PayPal credentials', 'forminator' ),
71
+ 'preview_cforms' => __( 'Preview Custom Form', 'forminator' ),
72
+ 'preview_polls' => __( 'Preview Poll', 'forminator' ),
73
+ 'preview_quizzes' => __( 'Preview Quiz', 'forminator' ),
74
+ 'captcha_settings' => __( 'Edit reCAPTCHA credentials', 'forminator' ),
75
+ 'currency_settings' => __( 'Edit default currency', 'forminator' ),
76
+ 'pagination_entries' => __( 'Submissions | Pagination Settings', 'forminator' ),
77
+ 'pagination_listings' => __( 'Listings | Pagination Settings', 'forminator' ),
78
+ 'email_settings' => __( 'Email Settings', 'forminator' ),
79
+ 'uninstall_settings' => __( 'Uninstall Settings', 'forminator' ),
80
+ 'privacy_settings' => __( 'Privacy Settings', 'forminator' ),
81
+ 'validate_form_name' => __( 'Form name cannot be empty! Please pick a name for your form.', 'forminator' ),
82
+ 'close' => __( 'Close', 'forminator' ),
83
+ 'close_label' => __( 'Close this dialog window', 'forminator' ),
84
+ 'go_back' => __( 'Go back', 'forminator' ),
85
+ 'records' => __( 'Records', 'forminator' ),
86
+ 'delete' => __( 'Delete', 'forminator' ),
87
+ 'confirm' => __( 'Confirm', 'forminator' ),
88
+ 'are_you_sure' => __( 'Are you sure?', 'forminator' ),
89
+ 'cannot_be_reverted' => __( 'Have in mind this action cannot be reverted.', 'forminator' ),
90
+ 'are_you_sure_form' => __( 'Are you sure you wish to permanently delete this form?', 'forminator' ),
91
+ 'are_you_sure_poll' => __( 'Are you sure you wish to permanently delete this poll?', 'forminator' ),
92
+ 'are_you_sure_quiz' => __( 'Are you sure you wish to permanently delete this quiz?', 'forminator' ),
93
+ 'delete_form' => __( 'Delete Form', 'forminator' ),
94
+ 'delete_poll' => __( 'Delete Poll', 'forminator' ),
95
+ 'delete_quiz' => __( 'Delete Quiz', 'forminator' ),
96
+ 'confirm_action' => __( 'Please confirm that you want to do this action.', 'forminator' ),
97
+ 'confirm_title' => __( 'Confirm Action', 'forminator' ),
98
+ 'confirm_field_delete' => __( 'Please confirm that you want to delete this field', 'forminator' ),
99
+ 'cancel' => __( 'Cancel', 'forminator' ),
100
+ 'save_alert' => __( 'The changes you made may be lost if you navigate away from this page.', 'forminator' ),
101
+ 'save_changes' => __( 'Save Changes', 'forminator' ),
102
+ 'save' => __( 'Save', 'forminator' ),
103
+ 'export_cform' => __( 'Export Form', 'forminator' ),
104
+ 'export_poll' => __( 'Export Poll', 'forminator' ),
105
+ 'export_quiz' => __( 'Export Quiz', 'forminator' ),
106
+ 'import_cform' => __( 'Import Form', 'forminator' ),
107
+ 'import_cform_cf7' => __( 'Import', 'forminator' ),
108
+ 'import_cform_ninja' => __( 'Import Ninja Forms', 'forminator' ),
109
+ 'import_cform_gravity' => __( 'Import Gravity Forms', 'forminator' ),
110
+ 'import_poll' => __( 'Import Poll', 'forminator' ),
111
+ 'import_quiz' => __( 'Import Quiz', 'forminator' ),
112
  'enable_scheduled_export' => __( 'Enable scheduled exports', 'forminator' ),
113
  'scheduled_export_if_new' => __( 'Send email only if there are new submissions', 'forminator' ),
114
+ 'download_csv' => __( 'Download CSV', 'forminator' ),
115
+ 'scheduled_exports' => __( 'Scheduled Exports', 'forminator' ),
116
+ 'manual_exports' => __( 'Manual Exports', 'forminator' ),
117
+ 'manual_description' => __( 'Download the submissions list in .csv format.', 'forminator' ),
118
+ 'scheduled_description' => __( 'Enable scheduled exports to get the submissions list in your email.', 'forminator' ),
119
+ 'disable' => __( 'Disable', 'forminator' ),
120
+ 'enable' => __( 'Enable', 'forminator' ),
121
+ 'enter_name' => __( 'Enter a name', 'forminator' ),
122
+ 'new_form_desc2' => __( 'Name your new form, then let\'s start building!', 'forminator' ),
123
+ 'new_poll_desc2' => __( 'Name your new poll, then let\'s start building!', 'forminator' ),
124
+ 'new_quiz_desc2' => __( 'Choose whether you want to collect participants details (e.g. name, email, etc.) on your quiz.' ),
125
+ 'learn_more' => __( 'Learn more', 'forminator' ),
126
+ 'input_label' => __( 'Input Label', 'forminator' ),
127
+ 'form_name_validation' => __( 'Form name cannot be empty.', 'forminator' ),
128
+ 'poll_name_validation' => __( 'Poll name cannot be empty.', 'forminator' ),
129
+ 'quiz_name_validation' => __( 'Quiz name cannot be empty.', 'forminator' ),
130
+ 'new_form_placeholder' => __( 'E.g., Blank Form', 'forminator' ),
131
+ 'new_poll_placeholder' => __( 'E.g., Blank Poll', 'forminator' ),
132
+ 'new_quiz_placeholder' => __( 'E.g., My Awesome Quiz', 'forminator' ),
133
+ 'create' => __( 'Create', 'forminator' ),
134
  'reset' => __( 'RESET', 'forminator' ),
135
+ 'disconnect' => __( 'Disconnect', 'forminator' ),
136
+ 'apply_submission_filter' => __( 'Apply Submission Filters', 'forminator' ),
137
  'registration_notice' => __( "This template allows you to create your own registration form and insert it on a custom page. This doesn't modify the default registration form.", 'forminator' ),
138
  'login_notice' => __( "This template allows you to create your own login form and insert it on a custom page. This doesn't modify the default login form.", 'forminator' ),
139
  'approve_user' => __( 'Approve', 'forminator' ),
140
  'registration_name' => __( 'User Registration', 'forminator' ),
141
  'login_name' => __( 'User Login', 'forminator' ),
142
+ 'deactivate' => __( 'Deactivate', 'forminator' ),
143
+ 'deactivateContent' => __( 'Are you sure you want to deactivate this Add-on?', 'forminator' ),
144
+ 'deactivateAnyway' => __( 'Deactivate Anyway', 'forminator' ),
145
+ 'forms' => __( 'Forms', 'forminator' ),
146
  ),
147
  'quiz' => array(
148
  'choose_quiz_title' => __( 'Create Quiz', 'forminator' ),
149
  'choose_quiz_description' => __( "Let's start by giving your quiz a name and choosing the appropriate quiz type based on your goal.", 'forminator' ),
150
+ 'quiz_name' => __( 'Quiz Name', 'forminator' ),
151
+ 'quiz_type' => __( 'Quiz Type', 'forminator' ),
152
+ 'collect_leads' => __( 'Collect Leads', 'forminator' ),
153
  'no_pagination' => __( 'No Pagination', 'forminator' ),
154
  'paginate_quiz' => __( 'Paginated Quiz', 'forminator' ),
155
  'presentation' => __( 'Presentation', 'forminator' ),
161
  'nowrong_label' => __( 'Personality Quiz', 'forminator' ),
162
  'nowrong_description' => __( "Show different outcomes depending on the visitor's answers. There are no wrong answers. E.g., Which superhero are you?", 'forminator' ),
163
  'continue_button' => __( 'Continue', 'forminator' ),
164
+ 'quiz_leads_toggle' => __( 'Collect leads on your quiz', 'forminator' ),
165
+ 'create_quiz' => __( 'Create Quiz', 'forminator' ),
166
+ 'quiz_leads_desc' => __( 'We will automatically create a default lead generation form for you. The lead generation form uses the Forms module, and some of the settings are shared between this quiz and the leads form.' ),
167
  ),
168
  'form' => array(
169
  'form_template_title' => __( 'Choose a template', 'forminator' ),
170
  'form_template_description' => __( 'Customize one of our pre-made form templates, or start from scratch.' ),
171
  'continue_button' => __( 'Continue', 'forminator' ),
172
+ 'result' => __( 'result', 'forminator' ),
173
+ 'results' => __( 'results', 'forminator' ),
174
  ),
175
  'sidebar' => array(
176
  'label' => __( 'Label', 'forminator' ),
253
  'user_email' => __( 'User Email', 'forminator' ),
254
  'user_login' => __( 'User Login', 'forminator' ),
255
  'shortcode_copied' => __( 'Shortcode has been copied successfully.', 'forminator' ),
256
+ 'uri_copied' => __( 'URI has been copied successfully.', 'forminator' ),
257
  ),
258
+ 'commons' => array(
259
+ 'color' => __( 'Color', 'forminator' ),
260
+ 'colors' => __( 'Colors', 'forminator' ),
261
+ 'border_color' => __( 'Border color', 'forminator' ),
262
+ 'border_color_hover' => __( 'Border color (hover)', 'forminator' ),
263
+ 'border_color_active' => __( 'Border color (active)', 'forminator' ),
264
+ 'border_color_correct' => __( 'Border color (correct)', 'forminator' ),
265
+ 'border_color_incorrect' => __( 'Border color (incorrect)', 'forminator' ),
266
+ 'border_width' => __( 'Border width', 'forminator' ),
267
+ 'border_style' => __( 'Border style', 'forminator' ),
268
+ 'background' => __( 'Background', 'forminator' ),
269
+ 'background_hover' => __( 'Background (hover)', 'forminator' ),
270
+ 'background_active' => __( 'Background (active)', 'forminator' ),
271
+ 'background_correct' => __( 'Background (correct)', 'forminator' ),
272
+ 'background_incorrect' => __( 'Background (incorrect)', 'forminator' ),
273
+ 'font_color' => __( 'Font color', 'forminator' ),
274
+ 'font_color_hover' => __( 'Font color (hover)', 'forminator' ),
275
+ 'font_color_active' => __( 'Font color (active)', 'forminator' ),
276
+ 'font_color_correct' => __( 'Font color (correct)', 'forminator' ),
277
+ 'font_color_incorrect' => __( 'Font color (incorrect)', 'forminator' ),
278
+ 'font_background' => __( 'Font background', 'forminator' ),
279
+ 'font_background' => __( 'Font background (hover)', 'forminator' ),
280
+ 'font_background_active' => __( 'Font background (active)', 'forminator' ),
281
+ 'font_family' => __( 'Font family', 'forminator' ),
282
+ 'font_family_custom' => __( 'Custom font family', 'forminator' ),
283
+ 'font_family_placeholder' => __( "E.g., 'Arial', sans-serif", 'forminator' ),
284
+ 'font_family_custom_description' => __( 'Here you can type the font family you want to use, as you would in CSS.', 'forminator' ),
285
+ 'icon_size' => __( 'Icon size', 'forminator' ),
286
+ 'enable' => __( 'Enable', 'forminator' ),
287
+ 'dropdown' => __( 'Dropdown', 'forminator' ),
288
+ 'appearance' => __( 'Appearance', 'forminator' ),
289
+ 'expand' => __( 'Expand', 'forminator' ),
290
+ 'placeholder' => __( 'Placeholder', 'forminator' ),
291
+ 'preview' => __( 'Preview', 'forminator' ),
292
+ 'icon_color' => __( 'Icon color', 'forminator' ),
293
+ 'icon_color_hover' => __( 'Icon color (hover)', 'forminator' ),
294
+ 'icon_color_active' => __( 'Icon color (active)', 'forminator' ),
295
+ 'icon_color_correct' => __( 'Icon color (correct)', 'forminator' ),
296
+ 'icon_color_incorrect' => __( 'Icon color (incorrect)', 'forminator' ),
297
+ 'box_shadow' => __( 'Box shadow', 'forminator' ),
298
+ 'enable_settings' => __( 'Enable settings', 'forminator' ),
299
+ 'font_size' => __( 'Font size', 'forminator' ),
300
+ 'font_weight' => __( 'Font weight', 'forminator' ),
301
+ 'text_align' => __( 'Text align', 'forminator' ),
302
+ 'regular' => __( 'Regular', 'forminator' ),
303
+ 'medium' => __( 'Medium', 'forminator' ),
304
+ 'large' => __( 'Large', 'forminator' ),
305
+ 'light' => __( 'Light', 'forminator' ),
306
+ 'normal' => __( 'Normal', 'forminator' ),
307
+ 'bold' => __( 'Bold', 'forminator' ),
308
+ 'typography' => __( 'Typography', 'forminator' ),
309
+ 'padding_top' => __( 'Top padding', 'forminator' ),
310
+ 'padding_right' => __( 'Right padding', 'forminator' ),
311
+ 'padding_bottom' => __( 'Bottom padding', 'forminator' ),
312
+ 'padding_left' => __( 'Left padding', 'forminator' ),
313
+ 'border_radius' => __( 'Border radius', 'forminator' ),
314
+ 'date_placeholder' => __( '20 April 2018', 'forminator' ),
315
+ 'left' => __( 'Left', 'forminator' ),
316
+ 'center' => __( 'Center', 'forminator' ),
317
+ 'right' => __( 'Right', 'forminator' ),
318
+ 'none' => __( 'None', 'forminator' ),
319
+ 'solid' => __( 'Solid', 'forminator' ),
320
+ 'dashed' => __( 'Dashed', 'forminator' ),
321
+ 'dotted' => __( 'Dotted', 'forminator' ),
322
+ 'delete_option' => __( 'Delete option', 'forminator' ),
323
+ 'label' => __( 'Label', 'forminator' ),
324
+ 'value' => __( 'Value', 'forminator' ),
325
+ 'reorder_option' => __( 'Re-order this option', 'forminator' ),
326
+ 'forminator_ui' => __( 'Forminator UI', 'forminator' ),
327
+ 'forminator_bold' => __( 'Forminator Bold', 'forminator' ),
328
+ 'forminator_flat' => __( 'Forminator Flat', 'forminator' ),
329
+ 'material_design' => __( 'Material Design', 'forminator' ),
330
+ 'no_file_chosen' => __( 'No file chosen', 'forminator' ),
331
+ 'update_successfully' => __( 'saved succesfully!', 'forminator' ),
332
+ 'update_unsuccessfull' => __( 'Error! Settings were not saved.', 'forminator' ),
333
+ 'approve_user_successfull' => __( 'User approved succesfully.', 'forminator' ),
334
+ 'error_message' => __( 'Something went wrong!', 'forminator' ),
335
+ 'approve_user_unsuccessfull' => __( 'Error! User was not approved.', 'forminator' ),
336
  ),
337
  'social' => array(
338
  'facebook' => __( 'Facebook', 'forminator' ),
396
  * @return array
397
  */
398
  private static function add_notice( $properties ) {
399
+ $key = filter_input( INPUT_GET, 'forminator_notice' );
400
  if ( $key ) {
401
  $notices = self::get_notices_list();
402
  if ( ! empty( $notices[ $key ] ) ) {
admin/classes/class-admin.php CHANGED
@@ -21,7 +21,7 @@ class Forminator_Admin {
21
  public function __construct() {
22
  $this->includes();
23
 
24
- // Init admin pages
25
  add_action( 'admin_menu', array( $this, 'add_dashboard_page' ) );
26
  add_action( 'admin_notices', array( $this, 'show_stripe_updated_notice' ) );
27
  add_action( 'admin_notices', array( $this, 'show_rating_notice' ) );
@@ -31,18 +31,21 @@ class Forminator_Admin {
31
  add_action( 'admin_notices', array( $this, 'show_prelaunch_subscriptions_notice' ) );
32
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts_for_notices' ) );
33
 
34
- // Add plugin action links
35
  add_filter( 'plugin_action_links_' . FORMINATOR_PLUGIN_BASENAME, array( $this, 'add_plugin_action_links' ) );
36
  if ( forminator_is_networkwide() ) {
37
- add_filter( 'network_admin_plugin_action_links_' . FORMINATOR_PLUGIN_BASENAME, array(
38
- $this,
39
- 'add_plugin_action_links'
40
- ) );
41
- }
42
- // Add links next to plugin details
 
 
 
43
  add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 3 );
44
 
45
- // Init Admin AJAX class
46
  new Forminator_Admin_AJAX();
47
 
48
  /**
@@ -52,29 +55,26 @@ class Forminator_Admin {
52
  }
53
 
54
  public function enqueue_scripts_for_notices() {
55
- // Hide for Forminator Pro
56
  if ( FORMINATOR_PRO ) {
57
  return;
58
  }
59
 
60
- // Enable notifications for main site and super admins only
61
  if ( ! is_main_site() || ! current_user_can( 'update_core' ) ) {
62
  return;
63
  }
64
 
65
- if (
66
- ! isset( $_GET['page'] ) ||
67
- ( isset( $_GET['page'] ) && false === strpos( $_GET['page'], 'forminator' ) )
68
- ) {
69
  return;
70
  }
71
 
72
  $dismissed_messages = get_user_meta( get_current_user_id(), 'frmt_dismissed_messages', true );
73
 
74
- // Hide if already dismissed
75
  if ( isset( $dismissed_messages['forminator_prelaunch_subscriptions_notice_dismissed'] ) &&
76
- $dismissed_messages['forminator_prelaunch_subscriptions_notice_dismissed'] )
77
- {
78
  return;
79
  }
80
 
@@ -108,27 +108,24 @@ class Forminator_Admin {
108
  public function show_prelaunch_subscriptions_notice() {
109
  $dismissed_messages = get_user_meta( get_current_user_id(), 'frmt_dismissed_messages', true );
110
 
111
- // Hide for Forminator Pro
112
  if ( FORMINATOR_PRO ) {
113
  return;
114
  }
115
 
116
- // Enable notifications for main site and super admins only
117
  if ( ! is_main_site() || ! current_user_can( 'update_core' ) ) {
118
  return;
119
  }
120
 
121
- if (
122
- ! isset( $_GET['page'] ) ||
123
- ( isset( $_GET['page'] ) && false === strpos( $_GET['page'], 'forminator' ) )
124
- ) {
125
  return;
126
  }
127
 
128
- // Hide if already dismissed
129
  if ( isset( $dismissed_messages['forminator_prelaunch_subscriptions_notice_dismissed'] ) &&
130
- $dismissed_messages['forminator_prelaunch_subscriptions_notice_dismissed'] )
131
- {
132
  return;
133
  }
134
 
@@ -151,7 +148,7 @@ class Forminator_Admin {
151
 
152
  FORMI.dismissNotice = function() {
153
  var $notice = $( '#app' );
154
- var ajaxUrl = '<?php echo forminator_ajax_url();// phpcs:ignore ?>';
155
 
156
  jQuery.post(
157
  ajaxUrl,
@@ -164,7 +161,8 @@ class Forminator_Admin {
164
  }
165
  }( jQuery ) );
166
  </script>
167
- <?php }
 
168
 
169
  /**
170
  * Include required files
@@ -172,7 +170,7 @@ class Forminator_Admin {
172
  * @since 1.0
173
  */
174
  private function includes() {
175
- // Admin pages
176
  include_once forminator_plugin_dir() . 'admin/pages/dashboard-page.php';
177
  include_once forminator_plugin_dir() . 'admin/pages/entries-page.php';
178
  include_once forminator_plugin_dir() . 'admin/pages/integrations-page.php';
@@ -180,31 +178,31 @@ class Forminator_Admin {
180
  include_once forminator_plugin_dir() . 'admin/pages/upgrade-page.php';
181
  include_once forminator_plugin_dir() . 'admin/pages/addons-page.php';
182
 
183
- // Admin AJAX
184
  include_once forminator_plugin_dir() . 'admin/classes/class-admin-ajax.php';
185
 
186
- // Admin Data
187
  include_once forminator_plugin_dir() . 'admin/classes/class-admin-data.php';
188
 
189
- // Admin l10n
190
  include_once forminator_plugin_dir() . 'admin/classes/class-admin-l10n.php';
191
 
192
  if ( forminator_is_import_plugin_enabled( 'cf7' ) ) {
193
- //CF7 Import
194
  include_once forminator_plugin_dir() . 'admin/classes/thirdparty-importers/class-importer-cf7.php';
195
  }
196
 
197
  if ( forminator_is_import_plugin_enabled( 'ninjaforms' ) ) {
198
- //Ninjaforms Import
199
  include_once forminator_plugin_dir() . 'admin/classes/thirdparty-importers/class-importer-ninja.php';
200
  }
201
 
202
  if ( forminator_is_import_plugin_enabled( 'gravityforms' ) ) {
203
- //Gravityforms CF7 Import
204
  include_once forminator_plugin_dir() . 'admin/classes/thirdparty-importers/class-importer-gravity.php';
205
  }
206
 
207
- // Admin Addons page
208
  include_once forminator_plugin_dir() . 'admin/classes/class-addons-page.php';
209
 
210
  }
@@ -247,7 +245,7 @@ class Forminator_Admin {
247
  'forminator'
248
  );
249
 
250
- //TODO: remove this after converted to JS
251
  $addons = Forminator_Addon_Loader::get_instance()->get_addons()->to_array();
252
  foreach ( $addons as $slug => $addon_array ) {
253
  $addon_class = forminator_get_addon( $slug );
@@ -339,7 +337,7 @@ class Forminator_Admin {
339
  'addons',
340
  __( 'Forminator Add-ons', 'forminator' ),
341
  sprintf(
342
- __( 'Add-ons %sNew%s', 'forminator' ),
343
  '<span style="padding: 2px 8px; border-radius: 9px; background-color: #1ABC9C; color: #FFF; font-size: 8px; letter-spacing: -0.25px; text-transform: uppercase;">',
344
  '</span>'
345
  ),
@@ -387,7 +385,7 @@ class Forminator_Admin {
387
  * Shown in forminator pages. Per user notification.
388
  */
389
  public function show_pro_available_notice() {
390
- $page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_STRING );
391
  if ( 'forminator' !== substr( $page, 0, 10 ) || FORMINATOR_PRO ) {
392
  return;
393
  }
@@ -420,7 +418,7 @@ class Forminator_Admin {
420
  echo '<div class="forminator-grouped-notice notice notice-info is-dismissible"'
421
  . ' data-notice-slug="forminator_pro_is_available"'
422
  . ' data-nonce="' . esc_attr( wp_create_nonce( 'forminator_dismiss_notice' ) ) . '">';
423
- echo $message;
424
  echo '</div>';
425
  }
426
 
@@ -464,60 +462,60 @@ class Forminator_Admin {
464
  }
465
 
466
  ?>
467
- <div class="forminator-notice-cf7 forminator-notice notice notice-info"
468
- data-prop="forminator_cf7_notice_dismissed"
469
- data-nonce="<?php echo esc_attr( wp_create_nonce( 'forminator_dismiss_notification' ) ); ?>">
470
- <p style="color: #1A2432; font-size: 14px; font-weight: bold;"><?php echo esc_html__( 'Forminator - Import your Contact Form 7 forms automatically', 'forminator' ); ?></p>
471
-
472
- <p style="color: #72777C; line-height: 22px;"><?php echo esc_html__( 'We noticed that Contact Form 7 is active on your website. You can use our built-in Contact Form 7 importer to import your existing forms and the relevant plugin settings from Contact Form 7 to Forminator. The importer supports the most widely used add-ons as well.', 'forminator' ); ?></p>
473
-
474
- <p>
475
- <a href="<?php echo esc_url( menu_page_url( 'forminator-settings', false ) . '&section=import' ); ?>"
476
- class="button button-primary"><?php esc_html_e( 'Import Contact Form 7 Forms', 'forminator' ); ?></a>
477
- <a href="#" class="dismiss-notice"
478
- style="margin-left: 10px; text-decoration: none; color: #555; font-weight: 500;"><?php esc_html_e( 'Dismiss', 'forminator' ); ?></a>
479
- </p>
480
-
481
- </div>
482
-
483
- <script type="text/javascript">
484
- jQuery('.forminator-notice-cf7 .button-primary').on('click', function (e) {
485
- e.preventDefault();
486
-
487
- var $self = jQuery(this);
488
- var $notice = jQuery(e.currentTarget).closest('.forminator-notice');
489
- var ajaxUrl = '<?php echo forminator_ajax_url(); ?>';
490
-
491
- jQuery.post(
492
- ajaxUrl,
493
- {
494
- action: 'forminator_dismiss_notification',
495
- prop: $notice.data('prop'),
496
- _ajax_nonce: $notice.data('nonce')
497
- }
498
- ).always(function () {
499
- location.href = $self.attr('href');
500
- });
501
- });
502
-
503
- jQuery('.forminator-notice-cf7 .dismiss-notice').on('click', function (e) {
504
- e.preventDefault();
505
-
506
- var $notice = jQuery(e.currentTarget).closest('.forminator-notice');
507
- var ajaxUrl = '<?php echo forminator_ajax_url(); ?>';
508
-
509
- jQuery.post(
510
- ajaxUrl,
511
- {
512
- action: 'forminator_dismiss_notification',
513
- prop: $notice.data('prop'),
514
- _ajax_nonce: $notice.data('nonce')
515
- }
516
- ).always(function () {
517
- $notice.hide();
518
- });
519
- });
520
- </script>
521
  <?php
522
  }
523
 
@@ -540,7 +538,7 @@ class Forminator_Admin {
540
 
541
  <div class="forminator-notice notice notice-warning" data-prop="forminator_stripe_notice_dismissed" data-nonce="<?php echo esc_attr( wp_create_nonce( 'forminator_dismiss_notification' ) ); ?>">
542
 
543
- <p style="color: #72777C; line-height: 22px;"><?php echo sprintf( __( 'To make Forminator\'s Stripe field <a href="%s" target="_blank">SCA Compliant</a>, we have replaced the Stripe Checkout modal with Stripe Elements which adds an inline field to collect your customer\'s credit or debit card details. Your existing forms with Stripe field are automatically updated, but we recommend checking them to ensure everything works fine.', 'forminator' ), 'https://stripe.com/gb/guides/strong-customer-authentication' ); ?></p>
544
 
545
  <p>
546
  <a href="<?php echo esc_url( menu_page_url( 'forminator', false ) . '&show_stripe_dialog=true' ); ?>" class="button button-primary"><?php esc_html_e( 'Learn more', 'forminator' ); ?></a>
@@ -554,7 +552,7 @@ class Forminator_Admin {
554
  e.preventDefault();
555
 
556
  var $notice = jQuery( e.currentTarget ).closest( '.forminator-notice' );
557
- var ajaxUrl = '<?php echo forminator_ajax_url();// phpcs:ignore ?>';
558
 
559
  jQuery.post(
560
  ajaxUrl,
@@ -599,41 +597,43 @@ class Forminator_Admin {
599
 
600
  <div id="forminator-free-publish-notice" class="forminator-rating-notice notice notice-info fui-wordpress-notice" data-nonce="<?php echo esc_attr( wp_create_nonce( 'forminator_dismiss_notification' ) ); ?>">
601
 
602
- <p style="color: #72777C; line-height: 22px;"><?php printf( __( 'Awesome! You\'ve published more than %d modules with Forminator. Hope you are enjoying it so far. We have spent countless hours developing this free plugin for you, and we would really appreciate it if you could drop us a rating on wp.org to help us spread the word and boost our motivation.', 'forminator' ), $milestone ); ?></p>
603
 
604
  <p>
605
  <a type="button" href="#" target="_blank" class="button button-primary button-large" data-prop="forminator_rating_success"><?php esc_html_e( 'Rate Forminator', 'forminator' ); ?></a>
606
 
607
- <button type="button" class="button button-large" style="margin-left: 11px;" data-prop="<?php echo 10 > $published_modules ? 'forminator_publish_rating_later' : 'forminator_publish_rating_later_dismiss'; ?>"><?php esc_html_e( 'Maybe later', 'forminator' ); ?></button>
608
 
609
  <a href="#" class="dismiss" style="margin-left: 11px; color: #555; line-height: 16px; font-weight: 500; text-decoration: none;" data-prop="forminator_rating_dismissed"><?php esc_html_e( 'No Thanks', 'forminator' ); ?></a>
610
  </p>
611
 
612
- </div>
613
 
614
- <?php } else {
 
615
 
616
- $install_date = get_site_option( 'forminator_free_install_date', false );
617
  $days_later_dismiss = get_option( 'forminator_days_rating_later_dismiss', false );
618
 
619
- if ( $install_date && current_time( 'timestamp' ) > strtotime( '+7 days', $install_date ) && ! $publish_later && ! $publish_later_dismiss && ! $days_later_dismiss ) { ?>
 
620
 
621
- <div id="forminator-free-usage-notice"
622
- class="forminator-rating-notice notice notice-info fui-wordpress-notice"
623
- data-nonce="<?php echo esc_attr( wp_create_nonce( 'forminator_dismiss_notification' ) ); ?>">
624
 
625
  <p style="color: #72777C; line-height: 22px;"><?php esc_html_e( 'Excellent! You\'ve been using Forminator for a while now. Hope you are enjoying it so far. We have spent countless hours developing this free plugin for you, and we would really appreciate it if you could drop us a rating on wp.org to help us spread the word and boost our motivation.', 'forminator' ); ?></p>
626
 
627
- <p>
628
- <a type="button" href="#" target="_blank" class="button button-primary button-large"
629
- data-prop="forminator_rating_success"><?php esc_html_e( 'Rate Forminator', 'forminator' ); ?></a>
630
 
631
- <a href="#" class="dismiss"
632
- style="margin-left: 11px; color: #555; line-height: 16px; font-weight: 500; text-decoration: none;"
633
- data-prop="forminator_days_rating_later_dismiss"><?php esc_html_e( 'Maybe later', 'forminator' ); ?></a>
634
- </p>
635
 
636
- </div>
637
 
638
  <?php
639
  }
@@ -641,32 +641,33 @@ class Forminator_Admin {
641
 
642
  ?>
643
 
644
- <script type="text/javascript">
645
- jQuery('.forminator-rating-notice a, .forminator-rating-notice button').on('click', function (e) {
646
- e.preventDefault();
647
-
648
- var $notice = jQuery(e.currentTarget).closest('.forminator-rating-notice'),
649
- prop = jQuery(this).data('prop'),
650
- ajaxUrl = '<?php echo forminator_ajax_url(); ?>';
651
-
652
- if ('forminator_rating_success' === prop) {
653
- window.open('https://wordpress.org/support/plugin/forminator/reviews/#new-post', '_blank');
654
- }
655
-
656
- jQuery.post(
657
- ajaxUrl,
658
- {
659
- action: 'forminator_dismiss_notification',
660
- prop: prop,
661
- _ajax_nonce: $notice.data('nonce')
662
- }
663
- ).always(function () {
664
- $notice.hide();
665
- });
666
- });
667
- </script>
668
-
669
- <?php }
 
670
 
671
  /**
672
  * Show action links on the plugin screen.
@@ -717,19 +718,19 @@ class Forminator_Admin {
717
  }
718
 
719
  // Change AuthorURI link.
720
- if ( isset( $links[1] ) ){
721
  $author_uri = FORMINATOR_PRO ? 'https://wpmudev.com/' : 'https://profiles.wordpress.org/wpmudev/';
722
  $author_uri = sprintf(
723
  '<a href="%s" target="_blank">%s</a>',
724
  $author_uri,
725
  __( 'WPMU DEV' )
726
  );
727
- $links[1] = sprintf( __( 'By %s' ), $author_uri );
728
  }
729
 
730
  if ( ! FORMINATOR_PRO ) {
731
  // Change AuthorURI link.
732
- if( isset( $links[2] ) && false === strpos( $links[2], 'target="_blank"' ) ) {
733
  if ( ! isset( $plugin_data['slug'] ) && $plugin_data['Name'] ) {
734
  $links[2] = sprintf(
735
  '<a href="%s" class="thickbox open-plugin-details-modal" aria-label="%s" data-title="%s">%s</a>',
@@ -794,50 +795,51 @@ class Forminator_Admin {
794
  $notice_later = get_option( 'forminator_addons_update_' . $version . 'later', false );
795
  if ( $notice_later && current_time( 'timestamp' ) < strtotime( '+7 days', $notice_later ) ) {
796
  return;
797
- } ?>
798
-
799
- <div id="forminator-addons-update-notice" class="forminator-update-notice notice notice-info fui-wordpress-notice is-dismissible" data-nonce="<?php echo esc_attr( wp_create_nonce( 'forminator_dismiss_notification' ) ); ?>">
800
- <p style="color: #72777C; line-height: 22px;">
801
- <strong>
802
- <?php echo esc_html__( 'New update available for one or more Add-ons.', 'forminator' ); ?>
803
- </strong>
804
- </p>
805
- <p style="color: #72777C; line-height: 22px;">
806
- <?php esc_html_e( 'A new update is available for one or more of your Forminator Add-ons. Click on the button below to check and update the required Add-on.', 'forminator' ); ?>
807
- </p>
808
- <p><a type="button"
809
- href="<?php echo esc_url( menu_page_url( 'forminator-addons', false ) ); ?>"
810
- target="_blank" class="button button-primary button-large"
811
- ><?php esc_html_e( 'View and Update', 'forminator' ); ?></a>
812
- <?php if ( ! $notice_later ) { ?>
813
- <a href="#" class="forminator-notice-dismiss" data-prop="forminator_addons_update_<?php echo esc_attr( $version ); ?>later" style="margin-left: 11px; color: #555; line-height: 16px; font-weight: 500; text-decoration: none;" data-prop-value="<?php echo current_time( 'timestamp' ); ?>"><?php esc_html_e( 'Remind me later', 'forminator' ); ?></a>
814
- <?php } ?>
815
- </p>
816
- <button type="button" class="notice-dismiss forminator-notice-dismiss" data-prop="forminator_addons_update_<?php echo esc_attr( $version ); ?>dismiss">
817
- <span class="screen-reader-text"></span>
818
- </button>
819
- </div>
820
- <script type="text/javascript">
821
- jQuery( '.forminator-update-notice .forminator-notice-dismiss' ).on( 'click', function( e ) {
822
- e.preventDefault();
823
-
824
- var $notice = jQuery( e.currentTarget ).closest( '.forminator-update-notice' ),
825
- prop = jQuery( this ).data('prop'),
826
- value = jQuery( this ).data('prop-value'),
827
- ajaxUrl = '<?php echo forminator_ajax_url(); ?>';
828
- jQuery.post(
829
- ajaxUrl,
830
- {
831
- action: 'forminator_dismiss_notification',
832
- prop: prop,
833
- value: 'undefined' !== typeof value ? value : '',
834
- _ajax_nonce: $notice.data('nonce')
835
- }
836
- ).always( function() {
837
- $notice.hide();
838
- });
839
- });
840
- </script>
841
- <?php
 
842
  }
843
  }
21
  public function __construct() {
22
  $this->includes();
23
 
24
+ // Init admin pages.
25
  add_action( 'admin_menu', array( $this, 'add_dashboard_page' ) );
26
  add_action( 'admin_notices', array( $this, 'show_stripe_updated_notice' ) );
27
  add_action( 'admin_notices', array( $this, 'show_rating_notice' ) );
31
  add_action( 'admin_notices', array( $this, 'show_prelaunch_subscriptions_notice' ) );
32
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts_for_notices' ) );
33
 
34
+ // Add plugin action links.
35
  add_filter( 'plugin_action_links_' . FORMINATOR_PLUGIN_BASENAME, array( $this, 'add_plugin_action_links' ) );
36
  if ( forminator_is_networkwide() ) {
37
+ add_filter(
38
+ 'network_admin_plugin_action_links_' . FORMINATOR_PLUGIN_BASENAME,
39
+ array(
40
+ $this,
41
+ 'add_plugin_action_links',
42
+ )
43
+ );
44
+ }
45
+ // Add links next to plugin details.
46
  add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 3 );
47
 
48
+ // Init Admin AJAX class.
49
  new Forminator_Admin_AJAX();
50
 
51
  /**
55
  }
56
 
57
  public function enqueue_scripts_for_notices() {
58
+ // Hide for Forminator Pro.
59
  if ( FORMINATOR_PRO ) {
60
  return;
61
  }
62
 
63
+ // Enable notifications for main site and super admins only.
64
  if ( ! is_main_site() || ! current_user_can( 'update_core' ) ) {
65
  return;
66
  }
67
 
68
+ $page = filter_input( INPUT_GET, 'page' );
69
+ if ( ! $page || false === strpos( $page, 'forminator' ) ) {
 
 
70
  return;
71
  }
72
 
73
  $dismissed_messages = get_user_meta( get_current_user_id(), 'frmt_dismissed_messages', true );
74
 
75
+ // Hide if already dismissed.
76
  if ( isset( $dismissed_messages['forminator_prelaunch_subscriptions_notice_dismissed'] ) &&
77
+ $dismissed_messages['forminator_prelaunch_subscriptions_notice_dismissed'] ) {
 
78
  return;
79
  }
80
 
108
  public function show_prelaunch_subscriptions_notice() {
109
  $dismissed_messages = get_user_meta( get_current_user_id(), 'frmt_dismissed_messages', true );
110
 
111
+ // Hide for Forminator Pro.
112
  if ( FORMINATOR_PRO ) {
113
  return;
114
  }
115
 
116
+ // Enable notifications for main site and super admins only.
117
  if ( ! is_main_site() || ! current_user_can( 'update_core' ) ) {
118
  return;
119
  }
120
 
121
+ $page = filter_input( INPUT_GET, 'page' );
122
+ if ( ! $page || false === strpos( $page, 'forminator' ) ) {
 
 
123
  return;
124
  }
125
 
126
+ // Hide if already dismissed.
127
  if ( isset( $dismissed_messages['forminator_prelaunch_subscriptions_notice_dismissed'] ) &&
128
+ $dismissed_messages['forminator_prelaunch_subscriptions_notice_dismissed'] ) {
 
129
  return;
130
  }
131
 
148
 
149
  FORMI.dismissNotice = function() {
150
  var $notice = $( '#app' );
151
+ var ajaxUrl = '<?php echo esc_url( forminator_ajax_url() ); ?>';
152
 
153
  jQuery.post(
154
  ajaxUrl,
161
  }
162
  }( jQuery ) );
163
  </script>
164
+ <?php
165
+ }
166
 
167
  /**
168
  * Include required files
170
  * @since 1.0
171
  */
172
  private function includes() {
173
+ // Admin pages.
174
  include_once forminator_plugin_dir() . 'admin/pages/dashboard-page.php';
175
  include_once forminator_plugin_dir() . 'admin/pages/entries-page.php';
176
  include_once forminator_plugin_dir() . 'admin/pages/integrations-page.php';
178
  include_once forminator_plugin_dir() . 'admin/pages/upgrade-page.php';
179
  include_once forminator_plugin_dir() . 'admin/pages/addons-page.php';
180
 
181
+ // Admin AJAX.
182
  include_once forminator_plugin_dir() . 'admin/classes/class-admin-ajax.php';
183
 
184
+ // Admin Data.
185
  include_once forminator_plugin_dir() . 'admin/classes/class-admin-data.php';
186
 
187
+ // Admin l10n.
188
  include_once forminator_plugin_dir() . 'admin/classes/class-admin-l10n.php';
189
 
190
  if ( forminator_is_import_plugin_enabled( 'cf7' ) ) {
191
+ // CF7 Import.
192
  include_once forminator_plugin_dir() . 'admin/classes/thirdparty-importers/class-importer-cf7.php';
193
  }
194
 
195
  if ( forminator_is_import_plugin_enabled( 'ninjaforms' ) ) {
196
+ // Ninjaforms Import.
197
  include_once forminator_plugin_dir() . 'admin/classes/thirdparty-importers/class-importer-ninja.php';
198
  }
199
 
200
  if ( forminator_is_import_plugin_enabled( 'gravityforms' ) ) {
201
+ // Gravityforms CF7 Import.
202
  include_once forminator_plugin_dir() . 'admin/classes/thirdparty-importers/class-importer-gravity.php';
203
  }
204
 
205
+ // Admin Addons page.
206
  include_once forminator_plugin_dir() . 'admin/classes/class-addons-page.php';
207
 
208
  }
245
  'forminator'
246
  );
247
 
248
+ // TODO: remove this after converted to JS.
249
  $addons = Forminator_Addon_Loader::get_instance()->get_addons()->to_array();
250
  foreach ( $addons as $slug => $addon_array ) {
251
  $addon_class = forminator_get_addon( $slug );
337
  'addons',
338
  __( 'Forminator Add-ons', 'forminator' ),
339
  sprintf(
340
+ __( 'Add-ons %1$sNew%2$s', 'forminator' ),
341
  '<span style="padding: 2px 8px; border-radius: 9px; background-color: #1ABC9C; color: #FFF; font-size: 8px; letter-spacing: -0.25px; text-transform: uppercase;">',
342
  '</span>'
343
  ),
385
  * Shown in forminator pages. Per user notification.
386
  */
387
  public function show_pro_available_notice() {
388
+ $page = (string) filter_input( INPUT_GET, 'page' );
389
  if ( 'forminator' !== substr( $page, 0, 10 ) || FORMINATOR_PRO ) {
390
  return;
391
  }
418
  echo '<div class="forminator-grouped-notice notice notice-info is-dismissible"'
419
  . ' data-notice-slug="forminator_pro_is_available"'
420
  . ' data-nonce="' . esc_attr( wp_create_nonce( 'forminator_dismiss_notice' ) ) . '">';
421
+ echo wp_kses_post( $message );
422
  echo '</div>';
423
  }
424
 
462
  }
463
 
464
  ?>
465
+ <div class="forminator-notice-cf7 forminator-notice notice notice-info"
466
+ data-prop="forminator_cf7_notice_dismissed"
467
+ data-nonce="<?php echo esc_attr( wp_create_nonce( 'forminator_dismiss_notification' ) ); ?>">
468
+ <p style="color: #1A2432; font-size: 14px; font-weight: bold;"><?php echo esc_html__( 'Forminator - Import your Contact Form 7 forms automatically', 'forminator' ); ?></p>
469
+
470
+ <p style="color: #72777C; line-height: 22px;"><?php echo esc_html__( 'We noticed that Contact Form 7 is active on your website. You can use our built-in Contact Form 7 importer to import your existing forms and the relevant plugin settings from Contact Form 7 to Forminator. The importer supports the most widely used add-ons as well.', 'forminator' ); ?></p>
471
+
472
+ <p>
473
+ <a href="<?php echo esc_url( menu_page_url( 'forminator-settings', false ) . '&section=import' ); ?>"
474
+ class="button button-primary"><?php esc_html_e( 'Import Contact Form 7 Forms', 'forminator' ); ?></a>
475
+ <a href="#" class="dismiss-notice"
476
+ style="margin-left: 10px; text-decoration: none; color: #555; font-weight: 500;"><?php esc_html_e( 'Dismiss', 'forminator' ); ?></a>
477
+ </p>
478
+
479
+ </div>
480
+
481
+ <script type="text/javascript">
482
+ jQuery('.forminator-notice-cf7 .button-primary').on('click', function (e) {
483
+ e.preventDefault();
484
+
485
+ var $self = jQuery(this);
486
+ var $notice = jQuery(e.currentTarget).closest('.forminator-notice');
487
+ var ajaxUrl = '<?php echo esc_url( forminator_ajax_url() ); ?>';
488
+
489
+ jQuery.post(
490
+ ajaxUrl,
491
+ {
492
+ action: 'forminator_dismiss_notification',
493
+ prop: $notice.data('prop'),
494
+ _ajax_nonce: $notice.data('nonce')
495
+ }
496
+ ).always(function () {
497
+ location.href = $self.attr('href');
498
+ });
499
+ });
500
+
501
+ jQuery('.forminator-notice-cf7 .dismiss-notice').on('click', function (e) {
502
+ e.preventDefault();
503
+
504
+ var $notice = jQuery(e.currentTarget).closest('.forminator-notice');
505
+ var ajaxUrl = '<?php echo esc_url( forminator_ajax_url() ); ?>';
506
+
507
+ jQuery.post(
508
+ ajaxUrl,
509
+ {
510
+ action: 'forminator_dismiss_notification',
511
+ prop: $notice.data('prop'),
512
+ _ajax_nonce: $notice.data('nonce')
513
+ }
514
+ ).always(function () {
515
+ $notice.hide();
516
+ });
517
+ });
518
+ </script>
519
  <?php
520
  }
521
 
538
 
539
  <div class="forminator-notice notice notice-warning" data-prop="forminator_stripe_notice_dismissed" data-nonce="<?php echo esc_attr( wp_create_nonce( 'forminator_dismiss_notification' ) ); ?>">
540
 
541
+ <p style="color: #72777C; line-height: 22px;"><?php echo wp_kses_post( sprintf( __( 'To make Forminator\'s Stripe field <a href="%s" target="_blank">SCA Compliant</a>, we have replaced the Stripe Checkout modal with Stripe Elements which adds an inline field to collect your customer\'s credit or debit card details. Your existing forms with Stripe field are automatically updated, but we recommend checking them to ensure everything works fine.', 'forminator' ), 'https://stripe.com/gb/guides/strong-customer-authentication' ) ); ?></p>
542
 
543
  <p>
544
  <a href="<?php echo esc_url( menu_page_url( 'forminator', false ) . '&show_stripe_dialog=true' ); ?>" class="button button-primary"><?php esc_html_e( 'Learn more', 'forminator' ); ?></a>
552
  e.preventDefault();
553
 
554
  var $notice = jQuery( e.currentTarget ).closest( '.forminator-notice' );
555
+ var ajaxUrl = '<?php echo esc_url( forminator_ajax_url() ); ?>';
556
 
557
  jQuery.post(
558
  ajaxUrl,
597
 
598
  <div id="forminator-free-publish-notice" class="forminator-rating-notice notice notice-info fui-wordpress-notice" data-nonce="<?php echo esc_attr( wp_create_nonce( 'forminator_dismiss_notification' ) ); ?>">
599
 
600
+ <p style="color: #72777C; line-height: 22px;"><?php printf( esc_html__( 'Awesome! You\'ve published more than %d modules with Forminator. Hope you are enjoying it so far. We have spent countless hours developing this free plugin for you, and we would really appreciate it if you could drop us a rating on wp.org to help us spread the word and boost our motivation.', 'forminator' ), (int) $milestone ); ?></p>
601
 
602
  <p>
603
  <a type="button" href="#" target="_blank" class="button button-primary button-large" data-prop="forminator_rating_success"><?php esc_html_e( 'Rate Forminator', 'forminator' ); ?></a>
604
 
605
+ <button type="button" class="button button-large" style="margin-left: 11px;" data-prop="<?php echo 10 > $published_modules ? 'forminator_publish_rating_later' : 'forminator_publish_rating_later_dismiss'; ?>"><?php esc_html_e( 'Maybe later', 'forminator' ); ?></button>
606
 
607
  <a href="#" class="dismiss" style="margin-left: 11px; color: #555; line-height: 16px; font-weight: 500; text-decoration: none;" data-prop="forminator_rating_dismissed"><?php esc_html_e( 'No Thanks', 'forminator' ); ?></a>
608
  </p>
609
 
610
+ </div>
611
 
612
+ <?php
613
+ } else {
614
 
615
+ $install_date = get_site_option( 'forminator_free_install_date', false );
616
  $days_later_dismiss = get_option( 'forminator_days_rating_later_dismiss', false );
617
 
618
+ if ( $install_date && current_time( 'timestamp' ) > strtotime( '+7 days', $install_date ) && ! $publish_later && ! $publish_later_dismiss && ! $days_later_dismiss ) {
619
+ ?>
620
 
621
+ <div id="forminator-free-usage-notice"
622
+ class="forminator-rating-notice notice notice-info fui-wordpress-notice"
623
+ data-nonce="<?php echo esc_attr( wp_create_nonce( 'forminator_dismiss_notification' ) ); ?>">
624
 
625
  <p style="color: #72777C; line-height: 22px;"><?php esc_html_e( 'Excellent! You\'ve been using Forminator for a while now. Hope you are enjoying it so far. We have spent countless hours developing this free plugin for you, and we would really appreciate it if you could drop us a rating on wp.org to help us spread the word and boost our motivation.', 'forminator' ); ?></p>
626
 
627
+ <p>
628
+ <a type="button" href="#" target="_blank" class="button button-primary button-large"
629
+ data-prop="forminator_rating_success"><?php esc_html_e( 'Rate Forminator', 'forminator' ); ?></a>
630
 
631
+ <a href="#" class="dismiss"
632
+ style="margin-left: 11px; color: #555; line-height: 16px; font-weight: 500; text-decoration: none;"
633
+ data-prop="forminator_days_rating_later_dismiss"><?php esc_html_e( 'Maybe later', 'forminator' ); ?></a>
634
+ </p>
635
 
636
+ </div>
637
 
638
  <?php
639
  }
641
 
642
  ?>
643
 
644
+ <script type="text/javascript">
645
+ jQuery('.forminator-rating-notice a, .forminator-rating-notice button').on('click', function (e) {
646
+ e.preventDefault();
647
+
648
+ var $notice = jQuery(e.currentTarget).closest('.forminator-rating-notice'),
649
+ prop = jQuery(this).data('prop'),
650
+ ajaxUrl = '<?php echo esc_url( forminator_ajax_url() ); ?>';
651
+
652
+ if ('forminator_rating_success' === prop) {
653
+ window.open('https://wordpress.org/support/plugin/forminator/reviews/#new-post', '_blank');
654
+ }
655
+
656
+ jQuery.post(
657
+ ajaxUrl,
658
+ {
659
+ action: 'forminator_dismiss_notification',
660
+ prop: prop,
661
+ _ajax_nonce: $notice.data('nonce')
662
+ }
663
+ ).always(function () {
664
+ $notice.hide();
665
+ });
666
+ });
667
+ </script>
668
+
669
+ <?php
670
+ }
671
 
672
  /**
673
  * Show action links on the plugin screen.
718
  }
719
 
720
  // Change AuthorURI link.
721
+ if ( isset( $links[1] ) ) {
722
  $author_uri = FORMINATOR_PRO ? 'https://wpmudev.com/' : 'https://profiles.wordpress.org/wpmudev/';
723
  $author_uri = sprintf(
724
  '<a href="%s" target="_blank">%s</a>',
725
  $author_uri,
726
  __( 'WPMU DEV' )
727
  );
728
+ $links[1] = sprintf( __( 'By %s' ), $author_uri );
729
  }
730
 
731
  if ( ! FORMINATOR_PRO ) {
732
  // Change AuthorURI link.
733
+ if ( isset( $links[2] ) && false === strpos( $links[2], 'target="_blank"' ) ) {
734
  if ( ! isset( $plugin_data['slug'] ) && $plugin_data['Name'] ) {
735
  $links[2] = sprintf(
736
  '<a href="%s" class="thickbox open-plugin-details-modal" aria-label="%s" data-title="%s">%s</a>',
795
  $notice_later = get_option( 'forminator_addons_update_' . $version . 'later', false );
796
  if ( $notice_later && current_time( 'timestamp' ) < strtotime( '+7 days', $notice_later ) ) {
797
  return;
798
+ }
799
+ ?>
800
+
801
+ <div id="forminator-addons-update-notice" class="forminator-update-notice notice notice-info fui-wordpress-notice is-dismissible" data-nonce="<?php echo esc_attr( wp_create_nonce( 'forminator_dismiss_notification' ) ); ?>">
802
+ <p style="color: #72777C; line-height: 22px;">
803
+ <strong>
804
+ <?php echo esc_html__( 'New update available for one or more Add-ons.', 'forminator' ); ?>
805
+ </strong>
806
+ </p>
807
+ <p style="color: #72777C; line-height: 22px;">
808
+ <?php esc_html_e( 'A new update is available for one or more of your Forminator Add-ons. Click on the button below to check and update the required Add-on.', 'forminator' ); ?>
809
+ </p>
810
+ <p><a type="button"
811
+ href="<?php echo esc_url( menu_page_url( 'forminator-addons', false ) ); ?>"
812
+ target="_blank" class="button button-primary button-large"
813
+ ><?php esc_html_e( 'View and Update', 'forminator' ); ?></a>
814
+ <?php if ( ! $notice_later ) { ?>
815
+ <a href="#" class="forminator-notice-dismiss" data-prop="forminator_addons_update_<?php echo esc_attr( $version ); ?>later" style="margin-left: 11px; color: #555; line-height: 16px; font-weight: 500; text-decoration: none;" data-prop-value="<?php echo esc_attr( current_time( 'timestamp' ) ); ?>"><?php esc_html_e( 'Remind me later', 'forminator' ); ?></a>
816
+ <?php } ?>
817
+ </p>
818
+ <button type="button" class="notice-dismiss forminator-notice-dismiss" data-prop="forminator_addons_update_<?php echo esc_attr( $version ); ?>dismiss">
819
+ <span class="screen-reader-text"></span>
820
+ </button>
821
+ </div>
822
+ <script type="text/javascript">
823
+ jQuery( '.forminator-update-notice .forminator-notice-dismiss' ).on( 'click', function( e ) {
824
+ e.preventDefault();
825
+
826
+ var $notice = jQuery( e.currentTarget ).closest( '.forminator-update-notice' ),
827
+ prop = jQuery( this ).data('prop'),
828
+ value = jQuery( this ).data('prop-value'),
829
+ ajaxUrl = '<?php echo esc_url( forminator_ajax_url() ); ?>';
830
+ jQuery.post(
831
+ ajaxUrl,
832
+ {
833
+ action: 'forminator_dismiss_notification',
834
+ prop: prop,
835
+ value: 'undefined' !== typeof value ? value : '',
836
+ _ajax_nonce: $notice.data('nonce')
837
+ }
838
+ ).always( function() {
839
+ $notice.hide();
840
+ });
841
+ });
842
+ </script>
843
+ <?php
844
  }
845
  }
admin/classes/thirdparty-importers/class-importer-cf7.php CHANGED
@@ -12,6 +12,7 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
12
 
13
  /**
14
  * Plugin instance
 
15
  * @since 1.11
16
  * @access private
17
  * @var null
@@ -35,7 +36,6 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
35
  /**
36
  * Get label text from CF7 form HTML
37
  *
38
- *
39
  * @since 1.11
40
  * @return string field label
41
  */
@@ -51,7 +51,7 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
51
  }
52
  $form = preg_replace( $regex, '', $form );
53
  $is_tag = strpos( $label_html, '[' );
54
- //get label from form html
55
 
56
  if ( isset( $label_html ) && ! empty( $label_html ) && false === $is_tag ) {
57
  return trim( rtrim( $label_html ) );
@@ -110,7 +110,7 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
110
  $submit_class = '';
111
  $autofill = array();
112
 
113
- // fields import
114
  if ( is_plugin_active( 'cf7-conditional-fields/contact-form-7-conditional-fields.php' ) && in_array( 'conditional', $cf7_addons, true ) ) {
115
  $wpcf7cf_entries = CF7CF::getConditions( $id );
116
  }
@@ -137,14 +137,14 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
137
  if ( 'submit' === $field['type'] ) {
138
  $submit_label = $field->labels[0];
139
  if ( isset( $field['options'] ) ) {
140
- $classes = preg_grep( "/^class:/", $field['options'] );
141
 
142
  if ( ! empty( $classes ) ) {
143
  foreach ( $classes as $class_value ) {
144
- $exploded = explode( ":", $class_value );
145
 
146
  if ( isset( $exploded[1] ) ) {
147
- $submit_class .= $exploded[1] . " ";
148
  }
149
  }
150
  }
@@ -161,8 +161,8 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
161
  $after_pipes = array();
162
 
163
  if ( isset( $field['options'] ) ) {
164
- $has_blank = preg_grep( "/^include_blank/", $field['options'] );
165
- $has_values = preg_grep( "/^default:/", $field['options'] );
166
 
167
  if ( ! empty( $has_values ) ) {
168
  $keys = array_keys( $has_values );
@@ -181,7 +181,7 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
181
  'label' => '---',
182
  'value' => '',
183
  'limit' => '',
184
- 'default' => ''
185
  );
186
  }
187
  foreach ( $field->labels as $key => $label ) {
@@ -189,7 +189,7 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
189
  'label' => esc_html( $label ),
190
  'value' => isset( $after_pipes[ $key ] ) ? esc_html( $after_pipes[ $key ] ) : esc_html( $field->values[ $key ] ),
191
  'limit' => '',
192
- 'default' => in_array( $key + 1, $checked )
193
  );
194
  }
195
  $options = array_merge( $blank_options, $options );
@@ -200,21 +200,21 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
200
  }
201
 
202
  if ( isset( $field['options'] ) ) {
203
- $classes = preg_grep( "/^class:/", $field['options'] );
204
 
205
  if ( ! empty( $classes ) ) {
206
  foreach ( $classes as $class_value ) {
207
- $exploded = explode( ":", $class_value );
208
 
209
  if ( isset( $exploded[1] ) ) {
210
- $custom_class .= $exploded[1] . " ";
211
  }
212
  }
213
  }
214
  }
215
 
216
  if ( isset( $field['options'] ) ) {
217
- $placeholder = preg_grep( "/^placeholder/", $field['options'] );
218
  $field_value = ( isset( $field['values'] ) && isset( $field['values'][0] ) ) ? $field['values'][0] : '';
219
 
220
  if ( ! empty( $placeholder ) ) {
@@ -253,10 +253,10 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
253
  'default' => esc_html( $default_value ),
254
  'default_value' => esc_html( $default_value ),
255
  'custom-class' => trim( $custom_class ),
256
- 'conditions' => $condition
257
  );
258
 
259
- // Handle specific field options
260
  switch ( $field['basetype'] ) {
261
  case 'select':
262
  $new_fields[ $mkey ] = $this->handle_select_field( $field, $new_fields[ $mkey ], $messages );
@@ -298,11 +298,11 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
298
  break;
299
  }
300
 
301
- $tag_key = $field['name'];
302
- $tags["[$tag_key]"] = '{' . $new_fields[ $mkey ]['element_id'] . '}';
303
 
304
  if ( isset( $field['options'] ) ) {
305
- $has_default_values = preg_grep( "/^default:/", $field['options'] );
306
  if ( ! empty( $has_default_values ) ) {
307
  $has_default_values = array_values( $has_default_values );
308
  $explode_default_value = explode( ':', $has_default_values[0] );
@@ -318,10 +318,9 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
318
  }
319
  }
320
  }
321
-
322
  }//endforeach fields
323
 
324
- //admin mail import
325
  $settings['use-admin-email'] = false;
326
 
327
  if ( isset( $mail['active'] ) && true === $mail['active'] ) {
@@ -357,10 +356,10 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
357
  }
358
  }
359
 
360
- $settings['admin-email-recipients'] = explode( " ", $this->replace_invalid_tags( $mail['recipient'], $tags ) );
361
  }
362
 
363
- //autoresponder import
364
  $settings['use-user-email'] = false;
365
 
366
  if ( isset( $mail_2['active'] ) && true === $mail_2['active'] ) {
@@ -396,9 +395,9 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
396
  }
397
  }
398
 
399
- $settings['user-email-recipients'] = explode( " ", $this->replace_invalid_tags( $mail_2['recipient'], $tags ) );
400
  }
401
- //form settings basic import
402
  $settings['formName'] = esc_html( get_the_title( $id ) );
403
  $settings['thankyou-message'] = $messages['mail_sent_ok'];
404
  $settings['custom-invalid-form-message'] = $messages['validation_error'];
@@ -412,7 +411,7 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
412
  $settings['fields-autofill'] = array_values( $autofill );
413
  }
414
 
415
- // form submit data settings
416
  $settings['submitData']['custom-submit-text'] = $submit_label;
417
  $settings['submitData']['custom-class'] = $submit_class;
418
 
@@ -439,7 +438,7 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
439
  $settings['newtab'] = 'on' === $redirect_meta['open_in_new_tab'] ? 'newtab_thankyou' : 'sametab';
440
  }
441
  }
442
- //for basics generation
443
  $data['status'] = get_post_status( $id );
444
  $data['version'] = FORMINATOR_VERSION;
445
  $data['type'] = 'form';
@@ -482,10 +481,10 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
482
  * @return mixed
483
  */
484
  public function handle_select_field( $field, $options, $messages ) {
485
- // Check if select field has any options
486
  $options['value_type'] = 'single';
487
  if ( isset( $field['options'] ) ) {
488
- // Check if multiple option enabled
489
  if ( in_array( 'multiple', $field['options'], true ) ) {
490
  $options['value_type'] = 'multiselect';
491
  }
@@ -529,15 +528,15 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
529
  */
530
  public function handle_text_field( $field, $options, $messages ) {
531
  if ( isset( $field['options'] ) ) {
532
- $max_length = preg_grep( "/^maxlength:/", $field['options'] );
533
 
534
  if ( ! empty( $max_length ) ) {
535
  foreach ( $max_length as $length ) {
536
- $exploded = explode( ":", $length );
537
 
538
  if ( isset( $exploded[1] ) ) {
539
  $options['limit'] = $exploded[1];
540
- $options['limit_type'] = "characters";
541
  }
542
  }
543
  }
@@ -563,12 +562,12 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
563
  */
564
  public function handle_number_field( $field, $options, $messages ) {
565
  if ( isset( $field['options'] ) ) {
566
- $min = preg_grep( "/^min:/", $field['options'] );
567
- $max = preg_grep( "/^max:/", $field['options'] );
568
 
569
  if ( ! empty( $min ) ) {
570
  foreach ( $min as $length ) {
571
- $exploded = explode( ":", $length );
572
 
573
  if ( isset( $exploded[1] ) ) {
574
  $options['limit_min'] = $exploded[1];
@@ -578,14 +577,13 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
578
 
579
  if ( ! empty( $max ) ) {
580
  foreach ( $max as $length ) {
581
- $exploded = explode( ":", $length );
582
 
583
  if ( isset( $exploded[1] ) ) {
584
  $options['limit_max'] = $exploded[1];
585
  }
586
  }
587
  }
588
-
589
  }
590
  if ( ! empty( $messages['invalid_required'] ) ) {
591
  $options['required_message'] = $messages['invalid_required'];
@@ -606,7 +604,7 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
606
  * @return mixed
607
  */
608
  public function handle_acceptance_field( $field, $options, $messages ) {
609
- // Check if content exists
610
  if ( isset( $field['content'] ) ) {
611
  $options['gdpr_description'] = $field['content'];
612
  }
@@ -632,12 +630,12 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
632
  public function handle_date_field( $field, $options, $messages ) {
633
  $field_value = ( isset( $field['values'] ) && isset( $field['values'][0] ) ) ? $field['values'][0] : '';
634
  if ( isset( $field['options'] ) ) {
635
- $min = preg_grep( "/^min:/", $field['options'] );
636
- $max = preg_grep( "/^max:/", $field['options'] );
637
 
638
  if ( ! empty( $min ) ) {
639
  foreach ( $min as $length ) {
640
- $exploded = explode( ":", $length );
641
 
642
  if ( isset( $exploded[1] ) ) {
643
  $options['min_year'] = date( 'Y', strtotime( $exploded[1] ) );
@@ -647,7 +645,7 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
647
 
648
  if ( ! empty( $max ) ) {
649
  foreach ( $max as $length ) {
650
- $exploded = explode( ":", $length );
651
 
652
  if ( isset( $exploded[1] ) ) {
653
  $options['max_year'] = date( 'Y', strtotime( $exploded[1] ) );
@@ -769,13 +767,13 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
769
  */
770
  public function handle_upload_field( $field, $options, $messages ) {
771
  if ( isset( $field['options'] ) ) {
772
- $limit_value = preg_grep( "/^limit:/", $field['options'] );
773
- $types_value = preg_grep( "/^filetypes:/", $field['options'] );
774
 
775
- // Handle size limit options
776
  if ( ! empty( $limit_value ) ) {
777
  foreach ( $limit_value as $limit ) {
778
- $exploded = explode( ":", $limit );
779
 
780
  if ( isset( $exploded[1] ) ) {
781
  $options['upload-limit'] = $this->convert_limit_to_mb( $exploded[1] );
@@ -783,13 +781,13 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
783
  }
784
  }
785
 
786
- // Handle file types
787
  if ( ! empty( $types_value ) ) {
788
  foreach ( $types_value as $types_values ) {
789
- $exploded = explode( ":", $types_values );
790
 
791
  if ( isset( $exploded[1] ) ) {
792
- $types = explode( "|", $exploded[1] );
793
  $filtered = array();
794
 
795
  foreach ( $types as $type ) {
@@ -817,14 +815,14 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
817
  */
818
  public function convert_limit_to_mb( $limit ) {
819
  if ( strpos( $limit, 'mb' ) !== false ) {
820
- // Limit is already in MB, return value
821
  return mb_substr( $limit, 0, - 2 );
822
  }
823
 
824
  if ( strpos( $limit, 'kb' ) !== false ) {
825
  $limit = mb_substr( $limit, 0, - 2 );
826
 
827
- // Limit is in KB, we need to convert to MB
828
  return round( $limit / 1024, 2 );
829
  }
830
 
@@ -843,34 +841,34 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
843
  public function filter_filetypes( $file ) {
844
  switch ( $file ) {
845
  case 'jpg':
846
- $file = "jpg|jpeg|jpe";
847
  break;
848
  case 'jpeg':
849
- $file = "jpg|jpeg|jpe";
850
  break;
851
  case 'mp3':
852
- $file = "mp3|m4a|m4b";
853
  break;
854
  case '3gp':
855
- $file = "3gp|3gpp";
856
  break;
857
  case 'mp4':
858
- $file = "mp4|m4v";
859
  break;
860
  case 'mpeg':
861
- $file = "mpeg|mpg|mpe";
862
  break;
863
  case 'mpg':
864
- $file = "mpeg|mpg|mpe";
865
  break;
866
  case 'mov':
867
- $file = "mov|qt";
868
  break;
869
  case 'tiff':
870
- $file = "tiff|tif";
871
  break;
872
  case 'tif':
873
- $file = "tiff|tif";
874
  break;
875
  default:
876
  break;
@@ -893,10 +891,12 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
893
  if ( ! empty( $import ) && 'success' === $import['type'] ) {
894
  $entry->form_id = $import['id'];
895
  $slug = get_post_field( 'post_name', $id );
896
- $flamingo_data = Flamingo_Inbound_Message::find( array(
897
- 'posts_per_page' => - 1,
898
- 'channel' => $slug
899
- ) );
 
 
900
  if ( ! empty( $flamingo_data ) ) {
901
  foreach ( $flamingo_data as $flamingo ) {
902
  $created_date = date_i18n( 'Y-m-d H:i:s', strtotime( str_replace( ' @', '', $flamingo->date ) ) );
@@ -907,10 +907,10 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
907
  if ( strpos( $meta[ $key ], 'upload' ) !== false ) {
908
  $value = array(
909
  'file' => array(
910
- 'success' => true,
911
- 'file_url' => $value,
912
  'file_path' => '',
913
- )
914
  );
915
  }
916
  $field_data_array[] = array(
@@ -968,7 +968,7 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
968
  'success' => true,
969
  'file_url' => $file_url,
970
  'file_path' => '',
971
- )
972
  );
973
  }
974
 
@@ -999,12 +999,14 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
999
 
1000
  if ( ! empty( $import ) && 'success' === $import['type'] ) {
1001
  $entry->form_id = $import['id'];
1002
- $submissions_data = get_posts( array(
1003
- 'posts_per_page' => - 1,
1004
- 'post_type' => 'wpcf7s',
1005
- 'meta_key' => 'form_id',
1006
- 'meta_value' => (int) $id
1007
- ) );
 
 
1008
 
1009
  if ( ! empty( $submissions_data ) ) {
1010
  foreach ( $submissions_data as $submissions ) {
@@ -1023,10 +1025,10 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
1023
  $file_url = ! empty( $meta_value ) ? $wpcf7s_url . '/' . $submissions->ID . '/' . $meta_value : '';
1024
  $data_value = array(
1025
  'file' => array(
1026
- 'success' => true,
1027
- 'file_url' => $file_url,
1028
  'file_path' => '',
1029
- )
1030
  );
1031
  }
1032
 
@@ -1130,14 +1132,14 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
1130
  if ( strpos( $value, 'upload' ) !== false ) {
1131
  $data_value = array(
1132
  'file' => array(
1133
- 'success' => true,
1134
- 'file_url' => $submissions[ $key ],
1135
  'file_path' => '',
1136
- )
1137
  );
1138
  }
1139
  if ( strpos( $value, 'checkbox' ) !== false ||
1140
- strpos( $value, 'select' ) !== false ) {
1141
  $data_value = explode( '<br />', nl2br( $submissions[ $key ] ) );
1142
  $data_value = array_map( 'trim', $data_value );
1143
  }
@@ -1216,4 +1218,4 @@ class Forminator_Admin_Import_CF7 extends Forminator_Import_Mediator {
1216
 
1217
  return $condition;
1218
  }
1219
- }
12
 
13
  /**
14
  * Plugin instance
15
+ *
16
  * @since 1.11
17
  * @access private
18
  * @var null
36
  /**
37
  * Get label text from CF7 form HTML
38
  *
 
39
  * @since 1.11
40
  * @return string field label
41
  */
51
  }
52
  $form = preg_replace( $regex, '', $form );
53
  $is_tag = strpos( $label_html, '[' );
54
+ // get label from form html.
55
 
56
  if ( isset( $label_html ) && ! empty( $label_html ) && false === $is_tag ) {
57
  return trim( rtrim( $label_html ) );
110
  $submit_class = '';
111
  $autofill = array();
112
 
113
+ // fields import.
114
  if ( is_plugin_active( 'cf7-conditional-fields/contact-form-7-conditional-fields.php' ) && in_array( 'conditional', $cf7_addons, true ) ) {
115
  $wpcf7cf_entries = CF7CF::getConditions( $id );
116
  }
137
  if ( 'submit' === $field['type'] ) {
138
  $submit_label = $field->labels[0];
139
  if ( isset( $field['options'] ) ) {
140
+ $classes = preg_grep( '/^class:/', $field['options'] );
141
 
142
  if ( ! empty( $classes ) ) {
143
  foreach ( $classes as $class_value ) {
144
+ $exploded = explode( ':', $class_value );
145
 
146
  if ( isset( $exploded[1] ) ) {
147
+ $submit_class .= $exploded[1] . ' ';
148
  }
149
  }
150
  }
161
  $after_pipes = array();
162
 
163
  if ( isset( $field['options'] ) ) {
164
+ $has_blank = preg_grep( '/^include_blank/', $field['options'] );
165
+ $has_values = preg_grep( '/^default:/', $field['options'] );
166
 
167
  if ( ! empty( $has_values ) ) {
168
  $keys = array_keys( $has_values );
181
  'label' => '---',
182
  'value' => '',
183
  'limit' => '',
184
+ 'default' => '',
185
  );
186
  }
187
  foreach ( $field->labels as $key => $label ) {
189
  'label' => esc_html( $label ),
190
  'value' => isset( $after_pipes[ $key ] ) ? esc_html( $after_pipes[ $key ] ) : esc_html( $field->values[ $key ] ),
191
  'limit' => '',
192
+ 'default' => in_array( $key + 1, $checked ),
193
  );
194
  }
195
  $options = array_merge( $blank_options, $options );
200
  }
201
 
202
  if ( isset( $field['options'] ) ) {
203
+ $classes = preg_grep( '/^class:/', $field['options'] );
204
 
205
  if ( ! empty( $classes ) ) {
206
  foreach ( $classes as $class_value ) {
207
+ $exploded = explode( ':', $class_value );
208
 
209
  if ( isset( $exploded[1] ) ) {
210
+ $custom_class .= $exploded[1] . ' ';
211
  }
212
  }
213
  }
214
  }
215
 
216
  if ( isset( $field['options'] ) ) {
217
+ $placeholder = preg_grep( '/^placeholder/', $field['options'] );
218
  $field_value = ( isset( $field['values'] ) && isset( $field['values'][0] ) ) ? $field['values'][0] : '';
219
 
220
  if ( ! empty( $placeholder ) ) {
253
  'default' => esc_html( $default_value ),
254
  'default_value' => esc_html( $default_value ),
255
  'custom-class' => trim( $custom_class ),
256
+ 'conditions' => $condition,
257
  );
258
 
259
+ // Handle specific field options.
260
  switch ( $field['basetype'] ) {
261
  case 'select':
262
  $new_fields[ $mkey ] = $this->handle_select_field( $field, $new_fields[ $mkey ], $messages );
298
  break;
299
  }
300
 
301
+ $tag_key = $field['name'];
302
+ $tags[ "[$tag_key]" ] = '{' . $new_fields[ $mkey ]['element_id'] . '}';
303
 
304
  if ( isset( $field['options'] ) ) {
305
+ $has_default_values = preg_grep( '/^default:/', $field['options'] );
306
  if ( ! empty( $has_default_values ) ) {
307
  $has_default_values = array_values( $has_default_values );
308
  $explode_default_value = explode( ':', $has_default_values[0] );
318
  }
319
  }
320
  }
 
321
  }//endforeach fields
322
 
323
+ // admin mail import.
324
  $settings['use-admin-email'] = false;
325
 
326
  if ( isset( $mail['active'] ) && true === $mail['active'] ) {
356
  }
357
  }
358
 
359
+ $settings['admin-email-recipients'] = explode( ' ', $this->replace_invalid_tags( $mail['recipient'], $tags ) );
360
  }
361
 
362
+ // autoresponder import.
363
  $settings['use-user-email'] = false;
364
 
365
  if ( isset( $mail_2['active'] ) && true === $mail_2['active'] ) {
395
  }
396
  }
397
 
398
+ $settings['user-email-recipients'] = explode( ' ', $this->replace_invalid_tags( $mail_2['recipient'], $tags ) );
399
  }
400
+ // form settings basic import.
401
  $settings['formName'] = esc_html( get_the_title( $id ) );
402
  $settings['thankyou-message'] = $messages['mail_sent_ok'];
403
  $settings['custom-invalid-form-message'] = $messages['validation_error'];
411
  $settings['fields-autofill'] = array_values( $autofill );
412
  }
413
 
414
+ // form submit data settings.
415
  $settings['submitData']['custom-submit-text'] = $submit_label;
416
  $settings['submitData']['custom-class'] = $submit_class;
417
 
438
  $settings['newtab'] = 'on' === $redirect_meta['open_in_new_tab'] ? 'newtab_thankyou' : 'sametab';
439
  }
440
  }
441
+ // for basics generation.
442
  $data['status'] = get_post_status( $id );
443
  $data['version'] = FORMINATOR_VERSION;
444
  $data['type'] = 'form';
481
  * @return mixed
482
  */
483
  public function handle_select_field( $field, $options, $messages ) {
484
+ // Check if select field has any options.
485
  $options['value_type'] = 'single';
486
  if ( isset( $field['options'] ) ) {
487
+ // Check if multiple option enabled.
488
  if ( in_array( 'multiple', $field['options'], true ) ) {
489
  $options['value_type'] = 'multiselect';
490
  }
528
  */
529
  public function handle_text_field( $field, $options, $messages ) {
530
  if ( isset( $field['options'] ) ) {
531
+ $max_length = preg_grep( '/^maxlength:/', $field['options'] );
532
 
533
  if ( ! empty( $max_length ) ) {
534
  foreach ( $max_length as $length ) {
535
+ $exploded = explode( ':', $length );
536
 
537
  if ( isset( $exploded[1] ) ) {
538
  $options['limit'] = $exploded[1];
539
+ $options['limit_type'] = 'characters';
540
  }
541
  }
542
  }
562
  */
563
  public function handle_number_field( $field, $options, $messages ) {
564
  if ( isset( $field['options'] ) ) {
565
+ $min = preg_grep( '/^min:/', $field['options'] );
566
+ $max = preg_grep( '/^max:/', $field['options'] );
567
 
568
  if ( ! empty( $min ) ) {
569
  foreach ( $min as $length ) {
570
+ $exploded = explode( ':', $length );
571
 
572
  if ( isset( $exploded[1] ) ) {
573
  $options['limit_min'] = $exploded[1];
577
 
578
  if ( ! empty( $max ) ) {
579
  foreach ( $max as $length ) {
580
+ $exploded = explode( ':', $length );
581
 
582
  if ( isset( $exploded[1] ) ) {
583
  $options['limit_max'] = $exploded[1];
584
  }
585
  }
586
  }
 
587
  }
588
  if ( ! empty( $messages['invalid_required'] ) ) {
589
  $options['required_message'] = $messages['invalid_required'];
604
  * @return mixed
605
  */
606
  public function handle_acceptance_field( $field, $options, $messages ) {
607
+ // Check if content exists.
608
  if ( isset( $field['content'] ) ) {
609
  $options['gdpr_description'] = $field['content'];
610
  }
630
  public function handle_date_field( $field, $options, $messages ) {
631
  $field_value = ( isset( $field['values'] ) && isset( $field['values'][0] ) ) ? $field['values'][0] : '';
632
  if ( isset( $field['options'] ) ) {
633
+ $min = preg_grep( '/^min:/', $field['options'] );
634
+ $max = preg_grep( '/^max:/', $field['options'] );
635
 
636
  if ( ! empty( $min ) ) {
637
  foreach ( $min as $length ) {
638
+ $exploded = explode( ':', $length );
639
 
640
  if ( isset( $exploded[1] ) ) {
641
  $options['min_year'] = date( 'Y', strtotime( $exploded[1] ) );
645
 
646
  if ( ! empty( $max ) ) {
647
  foreach ( $max as $length ) {
648
+ $exploded = explode( ':', $length );
649
 
650
  if ( isset( $exploded[1] ) ) {
651
  $options['max_year'] = date( 'Y', strtotime( $exploded[1] ) );
767
  */
768
  public function handle_upload_field( $field, $options, $messages ) {
769
  if ( isset( $field['options'] ) ) {
770
+ $limit_value = preg_grep( '/^limit:/', $field['options'] );
771
+ $types_value = preg_grep( '/^filetypes:/', $field['options'] );
772
 
773
+ // Handle size limit options.
774
  if ( ! empty( $limit_value ) ) {
775
  foreach ( $limit_value as $limit ) {
776
+ $exploded = explode( ':', $limit );
777
 
778
  if ( isset( $exploded[1] ) ) {
779
  $options['upload-limit'] = $this->convert_limit_to_mb( $exploded[1] );
781
  }
782
  }
783
 
784
+ // Handle file types.
785
  if ( ! empty( $types_value ) ) {
786
  foreach ( $types_value as $types_values ) {
787
+ $exploded = explode( ':', $types_values );
788
 
789
  if ( isset( $exploded[1] ) ) {
790
+ $types = explode( '|', $exploded[1] );
791
  $filtered = array();
792
 
793
  foreach ( $types as $type ) {
815
  */
816
  public function convert_limit_to_mb( $limit ) {
817
  if ( strpos( $limit, 'mb' ) !== false ) {
818
+ // Limit is already in MB, return value.
819
  return mb_substr( $limit, 0, - 2 );
820
  }
821
 
822
  if ( strpos( $limit, 'kb' ) !== false ) {
823
  $limit = mb_substr( $limit, 0, - 2 );
824
 
825
+ // Limit is in KB, we need to convert to MB.
826
  return round( $limit / 1024, 2 );
827
  }
828
 
841
  public function filter_filetypes( $file ) {
842
  switch ( $file ) {
843
  case 'jpg':
844
+ $file = 'jpg|jpeg|jpe';
845
  break;
846
  case 'jpeg':
847
+ $file = 'jpg|jpeg|jpe';
848
  break;
849
  case 'mp3':
850
+ $file = 'mp3|m4a|m4b';
851
  break;
852
  case '3gp':
853
+ $file = '3gp|3gpp';
854
  break;
855
  case 'mp4':
856
+ $file = 'mp4|m4v';
857
  break;
858
  case 'mpeg':
859
+ $file = 'mpeg|mpg|mpe';
860
  break;
861
  case 'mpg':
862
+ $file = 'mpeg|mpg|mpe';
863
  break;
864
  case 'mov':
865
+ $file = 'mov|qt';
866
  break;
867
  case 'tiff':
868
+ $file = 'tiff|tif';
869
  break;
870
  case 'tif':
871
+ $file = 'tiff|tif';
872
  break;
873
  default:
874
  break;
891
  if ( ! empty( $import ) && 'success' === $import['type'] ) {
892
  $entry->form_id = $import['id'];
893
  $slug = get_post_field( 'post_name', $id );
894
+ $flamingo_data = Flamingo_Inbound_Message::find(
895
+ array(
896
+ 'posts_per_page' => - 1,
897
+ 'channel' => $slug,
898
+ )
899
+ );
900
  if ( ! empty( $flamingo_data ) ) {
901
  foreach ( $flamingo_data as $flamingo ) {
902
  $created_date = date_i18n( 'Y-m-d H:i:s', strtotime( str_replace( ' @', '', $flamingo->date ) ) );
907
  if ( strpos( $meta[ $key ], 'upload' ) !== false ) {
908
  $value = array(
909
  'file' => array(
910
+ 'success' => true,
911
+ 'file_url' => $value,
912
  'file_path' => '',
913
+ ),
914
  );
915
  }
916
  $field_data_array[] = array(
968
  'success' => true,
969
  'file_url' => $file_url,
970
  'file_path' => '',
971
+ ),
972
  );
973
  }
974
 
999
 
1000
  if ( ! empty( $import ) && 'success' === $import['type'] ) {
1001
  $entry->form_id = $import['id'];
1002
+ $submissions_data = get_posts(
1003
+ array(
1004
+ 'posts_per_page' => - 1,
1005
+ 'post_type' => 'wpcf7s',
1006
+ 'meta_key' => 'form_id',
1007
+ 'meta_value' => (int) $id,
1008
+ )
1009
+ );
1010
 
1011
  if ( ! empty( $submissions_data ) ) {
1012
  foreach ( $submissions_data as $submissions ) {
1025
  $file_url = ! empty( $meta_value ) ? $wpcf7s_url . '/' . $submissions->ID . '/' . $meta_value : '';
1026
  $data_value = array(
1027
  'file' => array(
1028
+ 'success' => true,
1029
+ 'file_url' => $file_url,
1030
  'file_path' => '',
1031
+ ),
1032
  );
1033
  }
1034
 
1132
  if ( strpos( $value, 'upload' ) !== false ) {
1133
  $data_value = array(
1134
  'file' => array(
1135
+ 'success' => true,
1136
+ 'file_url' => $submissions[ $key ],
1137
  'file_path' => '',
1138
+ ),
1139
  );
1140
  }
1141
  if ( strpos( $value, 'checkbox' ) !== false ||
1142
+ strpos( $value, 'select' ) !== false ) {
1143
  $data_value = explode( '<br />', nl2br( $submissions[ $key ] ) );
1144
  $data_value = array_map( 'trim', $data_value );
1145
  }
1218
 
1219
  return $condition;
1220
  }
1221
+ }
admin/classes/thirdparty-importers/class-importer-gravity.php CHANGED
@@ -12,6 +12,7 @@ class Forminator_Admin_Import_Gravity extends Forminator_Import_Mediator {
12
 
13
  /**
14
  * Plugin instance
 
15
  * @since 1.7
16
  * @access private
17
  * @var null
@@ -38,20 +39,22 @@ class Forminator_Admin_Import_Gravity extends Forminator_Import_Mediator {
38
  * @return array Form import message
39
  */
40
  public function import_form( $id ) {
41
- $form = GFAPI::get_form( $id );
42
- $form_fields = $form['fields'];
43
- $notifications = $form['notifications'];
44
- $confirmations = $form['confirmations'];
45
- $data = array();
46
- $new_fields = array();
47
- $settings = array();
48
- $tags = array();
49
-
50
- // fields import
51
  foreach ( $form_fields as $mkey => $field ) {
52
 
53
  $type = $this->get_thirdparty_field_type( $field['type'] );
54
- if ( '' === $type ) continue;
 
 
55
 
56
  if ( isset( $count[ $type ] ) && $count[ $type ] > 0 ) {
57
  $count[ $type ] = $count[ $type ] + 1;
@@ -59,69 +62,69 @@ class Forminator_Admin_Import_Gravity extends Forminator_Import_Mediator {
59
  $count[ $type ] = 1;
60
  }
61
 
62
- $options = $field['choices'];
63
  $field_options = array();
64
- $wrapper = 'wrapper-' . $this->random_wrapper_int() . '-' . $this->random_wrapper_int();
65
 
66
- if ( !empty( $options ) ) {
67
- foreach ( $options as $key => $option) {
68
  $field_options[] = array(
69
- 'label' => esc_html( $option['text'] ),
70
  'value' => esc_html( $option['value'] ),
71
- 'limit' => ''
72
  );
73
  }
74
  }
75
 
76
- $new_fields[$mkey] = array(
77
- 'field_label' => esc_html( $field['label'] ),
78
- 'type' => esc_html( $type ),
79
- 'element_id' => esc_html( $type . '-' . $count[ $type ] ),
80
- 'cols' => 12,
81
- 'wrapper_id' => $wrapper,
82
- 'options' => $field_options,
83
- 'required' => filter_var( $field['isRequired'], FILTER_VALIDATE_BOOLEAN ),
84
- 'custom-class' => $field['cssClass'],
85
- 'description' => $field['description'],
86
- 'placeholder' => esc_html( $field['placeholder'] ),
87
  );
88
 
89
  if ( 'address' === $type ) {
90
  foreach ( $field['inputs'] as $key => $input ) {
91
- if( '4.1' === $input['id'] ) {
92
- $new_fields[$mkey]['street_address'] = ! isset ( $input['isHidden'] );
93
  } elseif ( '4.2' === $input['id'] ) {
94
- $new_fields[$mkey]['address_line'] = ! isset ( $input['isHidden'] );
95
  } elseif ( '4.3' === $input['id'] ) {
96
- $new_fields[$mkey]['address_city'] = ! isset ( $input['isHidden'] );
97
  } elseif ( '4.4' === $input['id'] ) {
98
- $new_fields[$mkey]['address_state'] = ! isset ( $input['isHidden'] );
99
  } elseif ( '4.5' === $input['id'] ) {
100
- $new_fields[$mkey]['address_zip'] = ! isset ( $input['isHidden'] );
101
  } elseif ( '4.6' === $input['id'] ) {
102
- $new_fields[$mkey]['address_country'] = ! isset ( $input['isHidden'] );
103
  }
104
  }
105
  }
106
 
107
  if ( 'multiselect' === $field['type'] ) {
108
- $new_fields[$mkey]['value_type'] = 'multiselect';
109
  }
110
 
111
  if ( 'page' === $field['type'] ) {
112
- $new_fields[$mkey]['btn_left'] = $field['previousButton']['text'];
113
- $new_fields[$mkey]['btn_right'] = $field['nextButton']['text'];
114
  }
115
 
116
- $tag_key = $field['label'] . ':' . $field['id'];
117
- $tags["{$tag_key}"] = $new_fields[$mkey]['element_id'];
118
 
119
  }//endforeach fields import
120
 
121
  $settings['use-admin-email'] = false;
122
  $settings['use-user-email'] = false;
123
 
124
- //form actions
125
  if ( ! empty( $notifications ) ) {
126
 
127
  foreach ( $notifications as $key => $action ) {
@@ -129,23 +132,23 @@ class Forminator_Admin_Import_Gravity extends Forminator_Import_Mediator {
129
  if ( 'email' === $action['toType'] ) {
130
 
131
  if ( isset( $action['to'] ) && '{admin_email}' === $action['to'] && false === $settings['use-admin-email'] ) {
132
- $settings['use-admin-email'] = true;
133
- $settings['admin-email-title'] = ( isset( $action['subject'] ) ? $this->replace_invalid_tags( $action['subject'], $tags ) : '' );
134
- $settings['admin-email-editor'] = ( isset( $action['message'] ) ? $this->replace_invalid_tags( $action['message'], $tags ) : '' );
135
- $settings['admin-email-from-name'] = ( isset( $action['fromName'] ) ? $this->replace_invalid_tags( $action['fromName'], $tags ) : '' );
136
- $settings['admin-email-recipients'] = get_bloginfo( 'admin_email' );
137
- $settings['admin-email-bcc-address'] = ( isset( $action['bcc'] ) ? $this->replace_invalid_tags( $action['bcc'], $tags ) : '' );
138
- $settings['admin-email-cc-address'] = ( isset( $action['cc'] ) ? $this->replace_invalid_tags( $action['cc'], $tags ) : '' );
139
- $settings['admin-email-reply-to-address'] = ( isset( $action['replyTo'] ) ? $this->replace_invalid_tags( $action['replyTo'], $tags ) : '' );
140
  } elseif ( isset( $action['to'] ) && '{admin_email}' !== $action['to'] && false === $settings['use-user-email'] ) {
141
- $settings['use-user-email'] = true;
142
- $settings['user-email-title'] = ( isset( $action['subject'] ) ? $this->replace_invalid_tags( $action['subject'], $tags ) : '' );
143
- $settings['user-email-editor'] = ( isset( $action['message'] ) ? $this->replace_invalid_tags( $action['message'], $tags ) : '' );
144
- $settings['user-email-from-name'] = ( isset( $action['fromName'] ) ? $this->replace_invalid_tags( $action['fromName'], $tags ) : '' );
145
- $settings['user-email-recipients'] = ( isset( $action['to'] ) ? $this->replace_invalid_tags( $action['to'], $tags ) : '' );
146
- $settings['user-email-bcc-address'] = ( isset( $action['bcc'] ) ? $this->replace_invalid_tags( $action['bcc'], $tags ) : '' );
147
- $settings['user-email-cc-address'] = ( isset( $action['cc'] ) ? $this->replace_invalid_tags( $action['cc'], $tags ) : '' );
148
- $settings['user-email-reply-to-address'] = ( isset( $action['replyTo'] ) ? $this->replace_invalid_tags( $action['replyTo'], $tags ) : '' );
149
  }
150
  }
151
  }
@@ -157,32 +160,31 @@ class Forminator_Admin_Import_Gravity extends Forminator_Import_Mediator {
157
  switch ( $action['type'] ) {
158
  case 'page':
159
  case 'redirect':
160
- $settings['submission-behaviour'] = 'behaviour-redirect';
161
- $url = ( isset( $action['pageid'] ) ? get_permalink( $action['pageid'] ) : $action['url'] );
162
- $settings['redirect-url'] = esc_url( $url );
163
- break;
164
  case 'message':
165
- $settings['submission-behaviour'] = 'behaviour-thankyou';
166
- $settings['thankyou-message'] = $action['message'];
167
  break;
168
  default:
169
  break;
170
  }
171
-
172
  }
173
 
174
- //final settings
175
- $settings['formName'] = esc_html( $form['title'] );
176
- $settings['custom-submit-text'] = esc_html( $form['button']['text'] );
177
 
178
- //form data
179
- $data['status'] = 'publish';
180
- $data['version'] = FORMINATOR_VERSION;
181
- $data['type'] = 'form';
182
- $data['data']['fields'] = $new_fields;
183
- $data['data']['settings'] = $settings;
184
 
185
- $data = apply_filters( 'forminator_gravity_form_import_data', $data );
186
  $import = $this->try_form_import( $data );
187
 
188
  return $import;
12
 
13
  /**
14
  * Plugin instance
15
+ *
16
  * @since 1.7
17
  * @access private
18
  * @var null
39
  * @return array Form import message
40
  */
41
  public function import_form( $id ) {
42
+ $form = GFAPI::get_form( $id );
43
+ $form_fields = $form['fields'];
44
+ $notifications = $form['notifications'];
45
+ $confirmations = $form['confirmations'];
46
+ $data = array();
47
+ $new_fields = array();
48
+ $settings = array();
49
+ $tags = array();
50
+
51
+ // fields import.
52
  foreach ( $form_fields as $mkey => $field ) {
53
 
54
  $type = $this->get_thirdparty_field_type( $field['type'] );
55
+ if ( '' === $type ) {
56
+ continue;
57
+ }
58
 
59
  if ( isset( $count[ $type ] ) && $count[ $type ] > 0 ) {
60
  $count[ $type ] = $count[ $type ] + 1;
62
  $count[ $type ] = 1;
63
  }
64
 
65
+ $options = $field['choices'];
66
  $field_options = array();
67
+ $wrapper = 'wrapper-' . $this->random_wrapper_int() . '-' . $this->random_wrapper_int();
68
 
69
+ if ( ! empty( $options ) ) {
70
+ foreach ( $options as $key => $option ) {
71
  $field_options[] = array(
72
+ 'label' => esc_html( $option['text'] ),
73
  'value' => esc_html( $option['value'] ),
74
+ 'limit' => '',
75
  );
76
  }
77
  }
78
 
79
+ $new_fields[ $mkey ] = array(
80
+ 'field_label' => esc_html( $field['label'] ),
81
+ 'type' => esc_html( $type ),
82
+ 'element_id' => esc_html( $type . '-' . $count[ $type ] ),
83
+ 'cols' => 12,
84
+ 'wrapper_id' => $wrapper,
85
+ 'options' => $field_options,
86
+ 'required' => filter_var( $field['isRequired'], FILTER_VALIDATE_BOOLEAN ),
87
+ 'custom-class' => $field['cssClass'],
88
+ 'description' => $field['description'],
89
+ 'placeholder' => esc_html( $field['placeholder'] ),
90
  );
91
 
92
  if ( 'address' === $type ) {
93
  foreach ( $field['inputs'] as $key => $input ) {
94
+ if ( '4.1' === $input['id'] ) {
95
+ $new_fields[ $mkey ]['street_address'] = ! isset( $input['isHidden'] );
96
  } elseif ( '4.2' === $input['id'] ) {
97
+ $new_fields[ $mkey ]['address_line'] = ! isset( $input['isHidden'] );
98
  } elseif ( '4.3' === $input['id'] ) {
99
+ $new_fields[ $mkey ]['address_city'] = ! isset( $input['isHidden'] );
100
  } elseif ( '4.4' === $input['id'] ) {
101
+ $new_fields[ $mkey ]['address_state'] = ! isset( $input['isHidden'] );
102
  } elseif ( '4.5' === $input['id'] ) {
103
+ $new_fields[ $mkey ]['address_zip'] = ! isset( $input['isHidden'] );
104
  } elseif ( '4.6' === $input['id'] ) {
105
+ $new_fields[ $mkey ]['address_country'] = ! isset( $input['isHidden'] );
106
  }
107
  }
108
  }
109
 
110
  if ( 'multiselect' === $field['type'] ) {
111
+ $new_fields[ $mkey ]['value_type'] = 'multiselect';
112
  }
113
 
114
  if ( 'page' === $field['type'] ) {
115
+ $new_fields[ $mkey ]['btn_left'] = $field['previousButton']['text'];
116
+ $new_fields[ $mkey ]['btn_right'] = $field['nextButton']['text'];
117
  }
118
 
119
+ $tag_key = $field['label'] . ':' . $field['id'];
120
+ $tags[ "{$tag_key}" ] = $new_fields[ $mkey ]['element_id'];
121
 
122
  }//endforeach fields import
123
 
124
  $settings['use-admin-email'] = false;
125
  $settings['use-user-email'] = false;
126
 
127
+ // form actions.
128
  if ( ! empty( $notifications ) ) {
129
 
130
  foreach ( $notifications as $key => $action ) {
132
  if ( 'email' === $action['toType'] ) {
133
 
134
  if ( isset( $action['to'] ) && '{admin_email}' === $action['to'] && false === $settings['use-admin-email'] ) {
135
+ $settings['use-admin-email'] = true;
136
+ $settings['admin-email-title'] = ( isset( $action['subject'] ) ? $this->replace_invalid_tags( $action['subject'], $tags ) : '' );
137
+ $settings['admin-email-editor'] = ( isset( $action['message'] ) ? $this->replace_invalid_tags( $action['message'], $tags ) : '' );
138
+ $settings['admin-email-from-name'] = ( isset( $action['fromName'] ) ? $this->replace_invalid_tags( $action['fromName'], $tags ) : '' );
139
+ $settings['admin-email-recipients'] = get_bloginfo( 'admin_email' );
140
+ $settings['admin-email-bcc-address'] = ( isset( $action['bcc'] ) ? $this->replace_invalid_tags( $action['bcc'], $tags ) : '' );
141
+ $settings['admin-email-cc-address'] = ( isset( $action['cc'] ) ? $this->replace_invalid_tags( $action['cc'], $tags ) : '' );
142
+ $settings['admin-email-reply-to-address'] = ( isset( $action['replyTo'] ) ? $this->replace_invalid_tags( $action['replyTo'], $tags ) : '' );
143
  } elseif ( isset( $action['to'] ) && '{admin_email}' !== $action['to'] && false === $settings['use-user-email'] ) {
144
+ $settings['use-user-email'] = true;
145
+ $settings['user-email-title'] = ( isset( $action['subject'] ) ? $this->replace_invalid_tags( $action['subject'], $tags ) : '' );
146
+ $settings['user-email-editor'] = ( isset( $action['message'] ) ? $this->replace_invalid_tags( $action['message'], $tags ) : '' );
147
+ $settings['user-email-from-name'] = ( isset( $action['fromName'] ) ? $this->replace_invalid_tags( $action['fromName'], $tags ) : '' );
148
+ $settings['user-email-recipients'] = ( isset( $action['to'] ) ? $this->replace_invalid_tags( $action['to'], $tags ) : '' );
149
+ $settings['user-email-bcc-address'] = ( isset( $action['bcc'] ) ? $this->replace_invalid_tags( $action['bcc'], $tags ) : '' );
150
+ $settings['user-email-cc-address'] = ( isset( $action['cc'] ) ? $this->replace_invalid_tags( $action['cc'], $tags ) : '' );
151
+ $settings['user-email-reply-to-address'] = ( isset( $action['replyTo'] ) ? $this->replace_invalid_tags( $action['replyTo'], $tags ) : '' );
152
  }
153
  }
154
  }
160
  switch ( $action['type'] ) {
161
  case 'page':
162
  case 'redirect':
163
+ $settings['submission-behaviour'] = 'behaviour-redirect';
164
+ $url = ( isset( $action['pageid'] ) ? get_permalink( $action['pageid'] ) : $action['url'] );
165
+ $settings['redirect-url'] = esc_url( $url );
166
+ break;
167
  case 'message':
168
+ $settings['submission-behaviour'] = 'behaviour-thankyou';
169
+ $settings['thankyou-message'] = $action['message'];
170
  break;
171
  default:
172
  break;
173
  }
 
174
  }
175
 
176
+ // final settings.
177
+ $settings['formName'] = esc_html( $form['title'] );
178
+ $settings['custom-submit-text'] = esc_html( $form['button']['text'] );
179
 
180
+ // form data.
181
+ $data['status'] = 'publish';
182
+ $data['version'] = FORMINATOR_VERSION;
183
+ $data['type'] = 'form';
184
+ $data['data']['fields'] = $new_fields;
185
+ $data['data']['settings'] = $settings;
186
 
187
+ $data = apply_filters( 'forminator_gravity_form_import_data', $data );
188
  $import = $this->try_form_import( $data );
189
 
190
  return $import;
admin/classes/thirdparty-importers/class-importer-ninja.php CHANGED
@@ -12,6 +12,7 @@ class Forminator_Admin_Import_Ninja extends Forminator_Import_Mediator {
12
 
13
  /**
14
  * Plugin instance
 
15
  * @since 1.7
16
  * @access private
17
  * @var null
@@ -39,19 +40,20 @@ class Forminator_Admin_Import_Ninja extends Forminator_Import_Mediator {
39
  * @return bool
40
  */
41
  public function ninja_multipart() {
42
- if ( class_exists( 'NF_MultiPart' ) )
43
  return true;
 
44
 
45
  return false;
46
-
47
  }
48
  public function insert_pagination( $array, $insert, $position ) {
49
- /*
50
- $array : The initial array i want to modify
51
- $insert : the new array i want to add, eg array('key' => 'value') or array('value')
52
- $position : the position where the new array will be inserted into. Please mind that arrays start at 0
53
- */
54
- return array_slice( $array, 0, $position, true ) + $insert + array_slice( $array, $position, null, true );
55
  }
56
  /**
57
  * Insert form data
@@ -60,32 +62,34 @@ class Forminator_Admin_Import_Ninja extends Forminator_Import_Mediator {
60
  * @return array Form import message
61
  */
62
  public function import_form( $id ) {
63
- $form = Ninja_Forms()->form( $id );
64
- $form_fields = $form->get_fields();
65
- $actions = $form->get_actions();
66
- $pagination = ( ! empty( $form->get()->get_setting( 'formContentData' ) ) ? $form->get()->get_setting( 'formContentData' ) : array() );
67
- $data = array();
68
- $new_fields = array();
69
- $settings = array();
70
- $tags = array();
71
- $count = array();
72
- $page_total = 0;
73
- $mkey = 0;
74
-
75
- //multipart
76
  if ( $this->ninja_multipart() && isset( $pagination[0]['formContentData'] ) ) {
77
  $page_total = count( $pagination );
78
- foreach ($pagination as $key => $value) {
79
- $page_key = call_user_func( 'end', array_values( $value['formContentData'] ) );
80
- $page[ "{$page_key}" ] = $value['order'] + 1;
81
  }
82
  }
83
 
84
- // fields import
85
  foreach ( $form_fields as $key => $field ) {
86
 
87
  $type = $this->get_thirdparty_field_type( $field->get_setting( 'type' ) );
88
- if ( '' === $type ) continue;
 
 
89
 
90
  if ( 'submit' === $type ) {
91
  $submit_label = esc_html( $field->get_setting( 'label' ) );
@@ -96,67 +100,67 @@ class Forminator_Admin_Import_Ninja extends Forminator_Import_Mediator {
96
  $count[ $type ] = 1;
97
  }
98
 
99
- $options = $field->get_setting('options');
100
  $field_options = array();
101
- $wrapper = 'wrapper-' . $this->random_wrapper_int() . '-' . $this->random_wrapper_int();
102
 
103
- if ( !empty( $options ) ) {
104
- foreach ( $options as $key => $option) {
105
  $field_options[] = array(
106
- 'label' => esc_html( $option['label'] ),
107
  'value' => esc_html( $option['value'] ),
108
- 'limit' => ''
109
  );
110
  }
111
  }
112
 
113
- $new_fields[$mkey] = array(
114
- 'field_label' => esc_html( $field->get_setting( 'label' ) ),
115
- 'type' => esc_html( $type ),
116
- 'element_id' => esc_html( $type . '-' . $count[ $type ] ),
117
- 'cols' => 12,
118
- 'wrapper_id' => $wrapper,
119
- 'options' => $field_options,
120
- 'required' => filter_var( $field->get_setting( 'required' ), FILTER_VALIDATE_BOOLEAN ),
121
- 'custom-class' => $field->get_setting( 'element_class' ),
122
- 'description' => ( !empty( $field->get_setting( 'desc_text' ) ) ? $field->get_setting( 'desc_text' ) : '' ),
123
- 'placeholder' => $field->get_setting( 'placeholder' ),
124
  );
125
 
126
  if ( 'address' === $type ) {
127
- if ( 'address' === $field->get_setting('type') ) {
128
- $new_fields[$mkey]['street_address'] = true;
129
- $new_fields[$mkey]['address_city'] = true;
130
- $new_fields[$mkey]['address_state'] = true;
131
- $new_fields[$mkey]['address_zip'] = true;
132
- $new_fields[$mkey]['address_country'] = true;
133
- $new_fields[$mkey]['address_line'] = true;
134
- } elseif ( 'city' === $field->get_setting('type') ) {
135
- $new_fields[$mkey]['address_city'] = true;
136
- } elseif ( 'zip' === $field->get_setting('type') ) {
137
- $new_fields[$mkey]['address_zip'] = true;
138
- } elseif ( 'country' === $field->get_setting('type') ) {
139
- $new_fields[$mkey]['address_country'] = true;
140
  }
141
  }
142
 
143
  if ( 'multiselect' === $type ) {
144
- $new_fields[$mkey]['value_type'] = 'multiselect';
145
  }
146
  }
147
 
148
- $tag_key = $field->get_setting('key');
149
- $tags["{$tag_key}"] = "{$new_fields[$mkey]['element_id']}";
150
 
151
- if ( isset( $page["{$tag_key}"] ) && $page["{$tag_key}"] < $page_total ) {
152
  $mkey++;
153
- $element_key = $page["{$tag_key}"];
154
 
155
- $new_fields[$mkey] = array(
156
- 'type' => 'pagination',
157
- 'element_id' => esc_html( 'pagination-' . $element_key ),
158
- 'cols' => 12,
159
- 'wrapper_id' => 'wrapper-' . $this->random_wrapper_int() . '-' . $this->random_wrapper_int(),
160
  );
161
  }
162
 
@@ -164,55 +168,57 @@ class Forminator_Admin_Import_Ninja extends Forminator_Import_Mediator {
164
  }//endforeach fields import
165
 
166
  $settings['use-admin-email'] = false;
167
- $settings['use-user-email'] = false;
168
 
169
- //form actions
170
  foreach ( $actions as $key => $action ) {
171
  $action = $action->get_settings();
172
  $active = filter_var( $action['active'], FILTER_VALIDATE_BOOLEAN );
173
 
174
- if ( false === $active ) continue;
 
 
175
 
176
  if ( 'email' === $action['type'] ) {
177
 
178
- //admin email detection.
179
- if ( isset( $action['to'] ) && '{system:admin_email}' === $action['to'] && false === $settings['use-admin-email'] ) {
180
- $settings['use-admin-email'] = true;
181
- $settings['admin-email-title'] = $this->replace_invalid_tags( $action['email_subject'], $tags );
182
- $settings['admin-email-editor'] = $this->replace_invalid_tags( $action['email_message'], $tags );
183
- $settings['admin-email-from-name'] = $this->replace_invalid_tags( $action['reply_to'], $tags );
184
- $settings['admin-email-recipients'] = get_bloginfo( 'admin_email' );
185
  }
186
 
187
- //get the first user notification action
188
  if ( isset( $action['to'] ) && '{system:admin_email}' !== $action['to'] && false === $settings['use-user-email'] ) {
189
- $settings['use-user-email'] = true;
190
- $settings['user-email-title'] = $this->replace_invalid_tags( $action['email_subject'], $tags );
191
- $settings['user-email-editor'] = $this->replace_invalid_tags( $action['email_message'], $tags );
192
- $settings['user-email-from-name'] = $this->replace_invalid_tags( $action['reply_to'], $tags );
193
- $settings['user-email-recipients'] = $this->replace_invalid_tags( $action['to'], $tags );
194
  }
195
  } elseif ( 'redirect' === $action['type'] ) {
196
- $settings['submission-behaviour'] = 'behaviour-redirect';
197
- $settings['redirect-url'] = $action['redirect_url'];
198
  } elseif ( 'successmessage' === $action['type'] && ! isset( $settings['submission-behaviour'] ) ) {
199
- $settings['submission-behaviour'] = 'behaviour-thankyou';
200
- $settings['thankyou-message'] = $action['message'];
201
  } elseif ( 'save' === $action['type'] ) {
202
- $settings['store'] = $action['active'];
203
  }
204
  }//endforeach form actions
205
 
206
- //final settings
207
- $settings['formName'] = esc_html( $form->get()->get_setting( 'title' ) );
208
- $settings['custom-submit-text'] = isset( $submit_label ) ? $submit_label : '' ;
209
 
210
- //form data
211
- $data['status'] = 'publish';
212
- $data['version'] = FORMINATOR_VERSION;
213
- $data['type'] = 'form';
214
- $data['data']['fields'] = $new_fields;
215
- $data['data']['settings'] = $settings;
216
 
217
  $data = apply_filters( 'forminator_ninja_form_import_data', $data );
218
 
12
 
13
  /**
14
  * Plugin instance
15
+ *
16
  * @since 1.7
17
  * @access private
18
  * @var null
40
  * @return bool
41
  */
42
  public function ninja_multipart() {
43
+ if ( class_exists( 'NF_MultiPart' ) ) {
44
  return true;
45
+ }
46
 
47
  return false;
48
+
49
  }
50
  public function insert_pagination( $array, $insert, $position ) {
51
+ /*
52
+ $array : The initial array i want to modify
53
+ $insert : the new array i want to add, eg array('key' => 'value') or array('value')
54
+ $position : the position where the new array will be inserted into. Please mind that arrays start at 0
55
+ */
56
+ return array_slice( $array, 0, $position, true ) + $insert + array_slice( $array, $position, null, true );
57
  }
58
  /**
59
  * Insert form data
62
  * @return array Form import message
63
  */
64
  public function import_form( $id ) {
65
+ $form = Ninja_Forms()->form( $id );
66
+ $form_fields = $form->get_fields();
67
+ $actions = $form->get_actions();
68
+ $pagination = ( ! empty( $form->get()->get_setting( 'formContentData' ) ) ? $form->get()->get_setting( 'formContentData' ) : array() );
69
+ $data = array();
70
+ $new_fields = array();
71
+ $settings = array();
72
+ $tags = array();
73
+ $count = array();
74
+ $page_total = 0;
75
+ $mkey = 0;
76
+
77
+ // multipart.
78
  if ( $this->ninja_multipart() && isset( $pagination[0]['formContentData'] ) ) {
79
  $page_total = count( $pagination );
80
+ foreach ( $pagination as $key => $value ) {
81
+ $page_key = call_user_func( 'end', array_values( $value['formContentData'] ) );
82
+ $page[ "{$page_key}" ] = $value['order'] + 1;
83
  }
84
  }
85
 
86
+ // fields import.
87
  foreach ( $form_fields as $key => $field ) {
88
 
89
  $type = $this->get_thirdparty_field_type( $field->get_setting( 'type' ) );
90
+ if ( '' === $type ) {
91
+ continue;
92
+ }
93
 
94
  if ( 'submit' === $type ) {
95
  $submit_label = esc_html( $field->get_setting( 'label' ) );
100
  $count[ $type ] = 1;
101
  }
102
 
103
+ $options = $field->get_setting( 'options' );
104
  $field_options = array();
105
+ $wrapper = 'wrapper-' . $this->random_wrapper_int() . '-' . $this->random_wrapper_int();
106
 
107
+ if ( ! empty( $options ) ) {
108
+ foreach ( $options as $key => $option ) {
109
  $field_options[] = array(
110
+ 'label' => esc_html( $option['label'] ),
111
  'value' => esc_html( $option['value'] ),
112
+ 'limit' => '',
113
  );
114
  }
115
  }
116
 
117
+ $new_fields[ $mkey ] = array(
118
+ 'field_label' => esc_html( $field->get_setting( 'label' ) ),
119
+ 'type' => esc_html( $type ),
120
+ 'element_id' => esc_html( $type . '-' . $count[ $type ] ),
121
+ 'cols' => 12,
122
+ 'wrapper_id' => $wrapper,
123
+ 'options' => $field_options,
124
+ 'required' => filter_var( $field->get_setting( 'required' ), FILTER_VALIDATE_BOOLEAN ),
125
+ 'custom-class' => $field->get_setting( 'element_class' ),
126
+ 'description' => ( ! empty( $field->get_setting( 'desc_text' ) ) ? $field->get_setting( 'desc_text' ) : '' ),
127
+ 'placeholder' => $field->get_setting( 'placeholder' ),
128
  );
129
 
130
  if ( 'address' === $type ) {
131
+ if ( 'address' === $field->get_setting( 'type' ) ) {
132
+ $new_fields[ $mkey ]['street_address'] = true;
133
+ $new_fields[ $mkey ]['address_city'] = true;
134
+ $new_fields[ $mkey ]['address_state'] = true;
135
+ $new_fields[ $mkey ]['address_zip'] = true;
136
+ $new_fields[ $mkey ]['address_country'] = true;
137
+ $new_fields[ $mkey ]['address_line'] = true;
138
+ } elseif ( 'city' === $field->get_setting( 'type' ) ) {
139
+ $new_fields[ $mkey ]['address_city'] = true;
140
+ } elseif ( 'zip' === $field->get_setting( 'type' ) ) {
141
+ $new_fields[ $mkey ]['address_zip'] = true;
142
+ } elseif ( 'country' === $field->get_setting( 'type' ) ) {
143
+ $new_fields[ $mkey ]['address_country'] = true;
144
  }
145
  }
146
 
147
  if ( 'multiselect' === $type ) {
148
+ $new_fields[ $mkey ]['value_type'] = 'multiselect';
149
  }
150
  }
151
 
152
+ $tag_key = $field->get_setting( 'key' );
153
+ $tags[ "{$tag_key}" ] = "{$new_fields[$mkey]['element_id']}";
154
 
155
+ if ( isset( $page[ "{$tag_key}" ] ) && $page[ "{$tag_key}" ] < $page_total ) {
156
  $mkey++;
157
+ $element_key = $page[ "{$tag_key}" ];
158
 
159
+ $new_fields[ $mkey ] = array(
160
+ 'type' => 'pagination',
161
+ 'element_id' => esc_html( 'pagination-' . $element_key ),
162
+ 'cols' => 12,
163
+ 'wrapper_id' => 'wrapper-' . $this->random_wrapper_int() . '-' . $this->random_wrapper_int(),
164
  );
165
  }
166
 
168
  }//endforeach fields import
169
 
170
  $settings['use-admin-email'] = false;
171
+ $settings['use-user-email'] = false;
172
 
173
+ // form actions.
174
  foreach ( $actions as $key => $action ) {
175
  $action = $action->get_settings();
176
  $active = filter_var( $action['active'], FILTER_VALIDATE_BOOLEAN );
177
 
178
+ if ( false === $active ) {
179
+ continue;
180
+ }
181
 
182
  if ( 'email' === $action['type'] ) {
183
 
184
+ // admin email detection.
185
+ if ( isset( $action['to'] ) && '{system:admin_email}' === $action['to'] && false === $settings['use-admin-email'] ) {
186
+ $settings['use-admin-email'] = true;
187
+ $settings['admin-email-title'] = $this->replace_invalid_tags( $action['email_subject'], $tags );
188
+ $settings['admin-email-editor'] = $this->replace_invalid_tags( $action['email_message'], $tags );
189
+ $settings['admin-email-from-name'] = $this->replace_invalid_tags( $action['reply_to'], $tags );
190
+ $settings['admin-email-recipients'] = get_bloginfo( 'admin_email' );
191
  }
192
 
193
+ // get the first user notification action.
194
  if ( isset( $action['to'] ) && '{system:admin_email}' !== $action['to'] && false === $settings['use-user-email'] ) {
195
+ $settings['use-user-email'] = true;
196
+ $settings['user-email-title'] = $this->replace_invalid_tags( $action['email_subject'], $tags );
197
+ $settings['user-email-editor'] = $this->replace_invalid_tags( $action['email_message'], $tags );
198
+ $settings['user-email-from-name'] = $this->replace_invalid_tags( $action['reply_to'], $tags );
199
+ $settings['user-email-recipients'] = $this->replace_invalid_tags( $action['to'], $tags );
200
  }
201
  } elseif ( 'redirect' === $action['type'] ) {
202
+ $settings['submission-behaviour'] = 'behaviour-redirect';
203
+ $settings['redirect-url'] = $action['redirect_url'];
204
  } elseif ( 'successmessage' === $action['type'] && ! isset( $settings['submission-behaviour'] ) ) {
205
+ $settings['submission-behaviour'] = 'behaviour-thankyou';
206
+ $settings['thankyou-message'] = $action['message'];
207
  } elseif ( 'save' === $action['type'] ) {
208
+ $settings['store'] = $action['active'];
209
  }
210
  }//endforeach form actions
211
 
212
+ // final settings.
213
+ $settings['formName'] = esc_html( $form->get()->get_setting( 'title' ) );
214
+ $settings['custom-submit-text'] = isset( $submit_label ) ? $submit_label : '';
215
 
216
+ // form data.
217
+ $data['status'] = 'publish';
218
+ $data['version'] = FORMINATOR_VERSION;
219
+ $data['type'] = 'form';
220
+ $data['data']['fields'] = $new_fields;
221
+ $data['data']['settings'] = $settings;
222
 
223
  $data = apply_filters( 'forminator_ninja_form_import_data', $data );
224
 
admin/locale.php CHANGED
@@ -1537,6 +1537,8 @@ $forminator_admin_locale = array(
1537
  "All Form Fields" => array( null, __("All Form Fields", "forminator" ), ), // src/settings/inputs/wp-editor.js:270
1538
  "All Non Empty Fields" => array( null, __("All Non Empty Fields", "forminator" ), ), // src/settings/inputs/wp-editor.js:280
1539
  "Add form data" => array( null, __("Add form data", "forminator" ), ), // src/settings/inputs/wp-editor.js:343
 
 
1540
  "Don't Miss Out On Subscription / Recurring Payment Support" => array( null, __("Don't Miss Out On Subscription / Recurring Payment Support", "forminator" ), ), // src/shared/discount.js:21
1541
  "Don't worry, only admin users can see this message" => array( null, __("Don't worry, only admin users can see this message", "forminator" ), ), // src/shared/discount.js:22
1542
  "Get 35% OFF Forminator Pro" => array( null, __("Get 35% OFF Forminator Pro", "forminator" ), ), // src/shared/discount.js:27
1537
  "All Form Fields" => array( null, __("All Form Fields", "forminator" ), ), // src/settings/inputs/wp-editor.js:270
1538
  "All Non Empty Fields" => array( null, __("All Non Empty Fields", "forminator" ), ), // src/settings/inputs/wp-editor.js:280
1539
  "Add form data" => array( null, __("Add form data", "forminator" ), ), // src/settings/inputs/wp-editor.js:343
1540
+ "{{strong}}Black Friday Offer!{{/strong}} Get 11 Pro plugins on unlimited sites and much more with 50% OFF WPMU DEV Agency plan FOREVER" => array( null, __("{{strong}}Black Friday Offer!{{/strong}} Get 11 Pro plugins on unlimited sites and much more with 50% OFF WPMU DEV Agency plan FOREVER", "forminator" ), ), // src/shared/black-friday.js:34
1541
+ "*Only admin users can see this message" => array( null, __("*Only admin users can see this message", "forminator" ), ), // src/shared/black-friday.js:45
1542
  "Don't Miss Out On Subscription / Recurring Payment Support" => array( null, __("Don't Miss Out On Subscription / Recurring Payment Support", "forminator" ), ), // src/shared/discount.js:21
1543
  "Don't worry, only admin users can see this message" => array( null, __("Don't worry, only admin users can see this message", "forminator" ), ), // src/shared/discount.js:22
1544
  "Get 35% OFF Forminator Pro" => array( null, __("Get 35% OFF Forminator Pro", "forminator" ), ), // src/shared/discount.js:27
admin/pages/entries-page.php CHANGED
@@ -19,7 +19,7 @@ class Forminator_Entries_Page extends Forminator_Admin_Page {
19
  private $modules = array();
20
 
21
  /**
22
- * Merged default parameter with $_REQUEST
23
  *
24
  * @since 1.0.5
25
  * @var array
@@ -70,12 +70,10 @@ class Forminator_Entries_Page extends Forminator_Admin_Page {
70
  * @since 1.0.5
71
  */
72
  public function populate_screen_params() {
73
- $screen_params = array(
74
- 'form_type' => 'forminator_forms',
75
- 'form_id' => 0,
76
  );
77
-
78
- $this->screen_params = array_merge( $screen_params, $_REQUEST );//phpcs:ignore -- data without nonce verification
79
  }
80
 
81
  /**
@@ -117,9 +115,9 @@ class Forminator_Entries_Page extends Forminator_Admin_Page {
117
  */
118
  private function prepare_entries_page() {
119
  $this->form_model = $this->get_form_model();
120
- // Form not found
121
  if ( ! $this->form_model instanceof Forminator_Base_Form_Model ) {
122
- // if form_id available remove it from request, and redirect
123
  if ( $this->get_current_form_id() ) {
124
  $url = remove_query_arg( 'form_id' );
125
  if ( wp_safe_redirect( $url ) ) {
@@ -144,7 +142,7 @@ class Forminator_Entries_Page extends Forminator_Admin_Page {
144
 
145
  if ( $entries_renderer instanceof Forminator_Admin_Page ) {
146
  ob_start();
147
- // render the entries page
148
  $entries_renderer->render_page_content();
149
  $this->entries_page = ob_get_clean();
150
  }
@@ -189,11 +187,9 @@ class Forminator_Entries_Page extends Forminator_Admin_Page {
189
  * Render Form switcher / select based on current form_type
190
  *
191
  * @since 1.0.5
192
- *
193
- * @return string
194
  */
195
  public function render_form_switcher( $form_type = 'forminator_forms', $form_id = 0 ) {
196
- $html = '<select name="form_id" data-allow-search="1" data-minimum-results-for-search="0" class="sui-select sui-select-sm sui-select-inline">';
197
 
198
  $empty_option = __( 'Choose Form', 'forminator' );
199
  $method = 'get_forms';
@@ -206,7 +202,7 @@ class Forminator_Entries_Page extends Forminator_Admin_Page {
206
  $method = 'get_quizzes';
207
  }
208
 
209
- $html .= '<option value="" ' . selected( 0, $form_id, false ) . '>' . $empty_option . '</option>';
210
 
211
  $forms = Forminator_API::$method( null, 1, 999 );
212
 
@@ -215,12 +211,10 @@ class Forminator_Entries_Page extends Forminator_Admin_Page {
215
  foreach ( $forms as $form ) {
216
  /**@var Forminator_Base_Form_Model $form */
217
  $title = ! empty( $form->settings['formName'] ) ? $form->settings['formName'] : $form->raw->post_title;
218
- $html .= '<option value="' . $form->id . '" ' . selected( $form->id, $form_id, false ) . '>' . $title . '</option>';
219
  }
220
 
221
- $html .= '</select>';
222
-
223
- return $html;
224
  }
225
 
226
  /**
@@ -251,17 +245,10 @@ class Forminator_Entries_Page extends Forminator_Admin_Page {
251
  * @since 1.5.4
252
  */
253
  public function enqueue_entries_scripts() {
254
- wp_enqueue_script(
255
- 'forminator-entries-moment',
256
- forminator_plugin_url() . 'assets/js/library/moment.min.js',
257
- array( 'jquery' ),
258
- '2.22.2',
259
- true
260
- );
261
  wp_enqueue_script(
262
  'forminator-entries-datepicker-range',
263
  forminator_plugin_url() . 'assets/js/library/daterangepicker.min.js',
264
- array( 'forminator-entries-moment' ),
265
  '3.0.3',
266
  true
267
  );
@@ -272,7 +259,7 @@ class Forminator_Entries_Page extends Forminator_Admin_Page {
272
  array( 'jquery' ),
273
  FORMINATOR_VERSION,
274
  false
275
- ); // inputmask
276
 
277
  wp_enqueue_script(
278
  'forminator-jquery-inputmask',
@@ -280,7 +267,7 @@ class Forminator_Entries_Page extends Forminator_Admin_Page {
280
  array( 'jquery' ),
281
  FORMINATOR_VERSION,
282
  false
283
- ); // jquery inputmask
284
 
285
  wp_enqueue_script(
286
  'forminator-inputmask-binding',
@@ -288,9 +275,10 @@ class Forminator_Entries_Page extends Forminator_Admin_Page {
288
  array( 'jquery' ),
289
  FORMINATOR_VERSION,
290
  false
291
- ); // inputmask binding
292
 
293
- // use inline script to allow hooking into this
 
294
  $daterangepicker_ranges
295
  = sprintf(
296
  "
19
  private $modules = array();
20
 
21
  /**
22
+ * Merged default parameter with superglobal REQUEST
23
  *
24
  * @since 1.0.5
25
  * @var array
70
  * @since 1.0.5
71
  */
72
  public function populate_screen_params() {
73
+ $this->screen_params = array(
74
+ 'form_type' => Forminator_Core::sanitize_text_field( 'form_type', 'forminator_forms' ),
75
+ 'form_id' => Forminator_Core::sanitize_text_field( 'form_id', 0 ),
76
  );
 
 
77
  }
78
 
79
  /**
115
  */
116
  private function prepare_entries_page() {
117
  $this->form_model = $this->get_form_model();
118
+ // Form not found.
119
  if ( ! $this->form_model instanceof Forminator_Base_Form_Model ) {
120
+ // if form_id available remove it from request, and redirect.
121
  if ( $this->get_current_form_id() ) {
122
  $url = remove_query_arg( 'form_id' );
123
  if ( wp_safe_redirect( $url ) ) {
142
 
143
  if ( $entries_renderer instanceof Forminator_Admin_Page ) {
144
  ob_start();
145
+ // render the entries page.
146
  $entries_renderer->render_page_content();
147
  $this->entries_page = ob_get_clean();
148
  }
187
  * Render Form switcher / select based on current form_type
188
  *
189
  * @since 1.0.5
 
 
190
  */
191
  public function render_form_switcher( $form_type = 'forminator_forms', $form_id = 0 ) {
192
+ echo '<select name="form_id" data-allow-search="1" data-minimum-results-for-search="0" class="sui-select sui-select-sm sui-select-inline">';
193
 
194
  $empty_option = __( 'Choose Form', 'forminator' );
195
  $method = 'get_forms';
202
  $method = 'get_quizzes';
203
  }
204
 
205
+ echo '<option value="" ' . selected( 0, $form_id, false ) . '>' . esc_html( $empty_option ) . '</option>';
206
 
207
  $forms = Forminator_API::$method( null, 1, 999 );
208
 
211
  foreach ( $forms as $form ) {
212
  /**@var Forminator_Base_Form_Model $form */
213
  $title = ! empty( $form->settings['formName'] ) ? $form->settings['formName'] : $form->raw->post_title;
214
+ echo '<option value="' . esc_attr( $form->id ) . '" ' . selected( $form->id, $form_id, false ) . '>' . esc_html( $title ) . '</option>';
215
  }
216
 
217
+ echo '</select>';
 
 
218
  }
219
 
220
  /**
245
  * @since 1.5.4
246
  */
247
  public function enqueue_entries_scripts() {
 
 
 
 
 
 
 
248
  wp_enqueue_script(
249
  'forminator-entries-datepicker-range',
250
  forminator_plugin_url() . 'assets/js/library/daterangepicker.min.js',
251
+ array( 'moment' ),
252
  '3.0.3',
253
  true
254
  );
259
  array( 'jquery' ),
260
  FORMINATOR_VERSION,
261
  false
262
+ ); // inputmask.
263
 
264
  wp_enqueue_script(
265
  'forminator-jquery-inputmask',
267
  array( 'jquery' ),
268
  FORMINATOR_VERSION,
269
  false
270
+ ); // jquery inputmask.
271
 
272
  wp_enqueue_script(
273
  'forminator-inputmask-binding',
275
  array( 'jquery' ),
276
  FORMINATOR_VERSION,
277
  false
278
+ ); // inputmask binding.
279
 
280
+ // TODO - Deprecation warning fix: Need to add value to moment() in ISO or RFC format.
281
+ // use inline script to allow hooking into this.
282
  $daterangepicker_ranges
283
  = sprintf(
284
  "
admin/pages/integrations-page.php CHANGED
@@ -35,7 +35,7 @@ class Forminator_Integrations_Page extends Forminator_Admin_Page {
35
  * @since 1.2 add extra section for addon
36
  */
37
  public function before_render() {
38
- // cleanup addons on integrations page
39
  Forminator_Addon_Loader::get_instance()->cleanup_activated_addons();
40
 
41
  $this->addons_list = forminator_get_registered_addons_list();
@@ -64,7 +64,7 @@ class Forminator_Integrations_Page extends Forminator_Admin_Page {
64
  */
65
  protected function render_page_content() {
66
  if ( ! empty( $this->addon_page ) ) {
67
- // html output here are expected
68
  echo $this->addon_page['output'];// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
69
  } else {
70
  parent::render_page_content();
@@ -114,13 +114,12 @@ class Forminator_Integrations_Page extends Forminator_Admin_Page {
114
  * @return bool
115
  */
116
  public function validate_addon_page() {
117
- if ( isset( $_GET['nonce'] ) ) {
118
- if ( ! wp_verify_nonce( $_GET['nonce'], self::$addon_nonce_page_action ) ) {
119
- return false;
120
- }
121
  }
122
  $query_args = $_GET;
123
- // main component
124
  /**
125
  * - slug : addon slug (eg. trello)
126
  * - nonce: nonce validation
@@ -144,7 +143,7 @@ class Forminator_Integrations_Page extends Forminator_Admin_Page {
144
  }
145
  $section = $query_args['section'];
146
  unset( $query_args['section'] );
147
- $callback = $addon->get_integration_section_callback( $section );// returned callback must be an array
148
 
149
  if ( ! is_array( $callback ) ) {
150
  return false;
35
  * @since 1.2 add extra section for addon
36
  */
37
  public function before_render() {
38
+ // cleanup addons on integrations page.
39
  Forminator_Addon_Loader::get_instance()->cleanup_activated_addons();
40
 
41
  $this->addons_list = forminator_get_registered_addons_list();
64
  */
65
  protected function render_page_content() {
66
  if ( ! empty( $this->addon_page ) ) {
67
+ // html output here are expected.
68
  echo $this->addon_page['output'];// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
69
  } else {
70
  parent::render_page_content();
114
  * @return bool
115
  */
116
  public function validate_addon_page() {
117
+ $nonce = filter_input( INPUT_GET, 'nonce' );
118
+ if ( $nonce && ! wp_verify_nonce( $nonce, self::$addon_nonce_page_action ) ) {
119
+ return false;
 
120
  }
121
  $query_args = $_GET;
122
+ // main component.
123
  /**
124
  * - slug : addon slug (eg. trello)
125
  * - nonce: nonce validation
143
  }
144
  $section = $query_args['section'];
145
  unset( $query_args['section'] );
146
+ $callback = $addon->get_integration_section_callback( $section );// returned callback must be an array.
147
 
148
  if ( ! is_array( $callback ) ) {
149
  return false;
admin/pages/settings-page.php CHANGED
@@ -34,7 +34,7 @@ class Forminator_Settings_Page extends Forminator_Admin_Page {
34
  }
35
 
36
  private function prepare_addons() {
37
- // cleanup activated addons
38
  Forminator_Addon_Loader::get_instance()->cleanup_activated_addons();
39
 
40
  Forminator_Addon_Admin_Ajax::get_instance()->generate_nonce();
@@ -50,16 +50,17 @@ class Forminator_Settings_Page extends Forminator_Admin_Page {
50
  }
51
 
52
  public function process_request() {
53
- if ( ! isset( $_POST['forminatorNonce'] ) ) {
 
54
  return;
55
  }
56
 
57
- if ( ! wp_verify_nonce( $_POST['forminatorNonce'], 'forminatorSettingsRequest' ) ) {
58
  return;
59
  }
60
 
61
  $is_redirect = true;
62
- $action = isset( $_POST['forminator_action'] ) ? $_POST['forminator_action'] : '';
63
  switch ( $action ) {
64
  case 'reset_plugin_settings':
65
  forminator_reset_settings();
34
  }
35
 
36
  private function prepare_addons() {
37
+ // cleanup activated addons.
38
  Forminator_Addon_Loader::get_instance()->cleanup_activated_addons();
39
 
40
  Forminator_Addon_Admin_Ajax::get_instance()->generate_nonce();
50
  }
51
 
52
  public function process_request() {
53
+ $nonce = filter_input( INPUT_POST, 'forminatorNonce' );
54
+ if ( ! $nonce ) {
55
  return;
56
  }
57
 
58
+ if ( ! wp_verify_nonce( $nonce, 'forminatorSettingsRequest' ) ) {
59
  return;
60
  }
61
 
62
  $is_redirect = true;
63
+ $action = Forminator_Core::sanitize_text_field( 'forminator_action' );
64
  switch ( $action ) {
65
  case 'reset_plugin_settings':
66
  forminator_reset_settings();
admin/pages/upgrade-page.php CHANGED
@@ -15,7 +15,7 @@ class Forminator_Upgrade_Page extends Forminator_Admin_Page {
15
  $this->template(
16
  'upgrade/upgrade-content',
17
  array(
18
- 'modules' => $modules
19
  )
20
  );
21
  }
15
  $this->template(
16
  'upgrade/upgrade-content',
17
  array(
18
+ 'modules' => $modules,
19
  )
20
  );
21
  }
admin/views/addons/action-button.php CHANGED
@@ -5,61 +5,66 @@ $class .= isset( $color ) ? ' sui-button-' . $color : '';
5
  $class .= ( isset( $ghost ) && true === is_bool( $ghost ) ) ? ' sui-button-ghost' : '';
6
  ?>
7
 
8
- <?php if ( isset( $compound ) && true === is_bool( $compound ) ) {
 
9
  $class .= ' sui-button-compound';
10
  ?>
11
 
12
  <button
13
- class="<?php echo $class; ?>"
14
- <?php if ( isset( $attrs ) ) {
15
- foreach( $attrs as $data => $val ) {
16
- echo $data . '="' . $val . '"';
 
17
  }
18
  }
19
  if ( isset( $disabled ) && $disabled ) {
20
- echo 'disabled="' . $disabled . '"';
21
- } ?>
 
22
  >
23
 
24
  <span class="sui-loading-text" aria-hidden="true">
25
 
26
  <span class="sui-compound-desktop">
27
- <i class="sui-icon-<?php echo $icon; ?>"></i>
28
- <?php echo $label; ?>
29
  </span>
30
 
31
  <span class="sui-compound-mobile">
32
- <span class="sui-icon-<?php echo $icon; ?>"></span>
33
  </span>
34
 
35
  </span>
36
 
37
  <span class="sui-icon-loader sui-loading" aria-hidden="true"></span>
38
 
39
- <span class="sui-screen-reader-text"><?php echo $label; ?></span>
40
 
41
  </button>
42
 
43
  <?php } else { ?>
44
 
45
  <button
46
- class="<?php echo $class; ?>"
47
- <?php if ( isset( $attrs ) ) {
48
- foreach( $attrs as $data => $val ) {
49
- echo $data . '="' . $val . '"';
 
50
  }
51
  }
52
  if ( isset( $disabled ) && $disabled ) {
53
- echo 'disabled="' . $disabled . '"';
54
- } ?>
 
55
  >
56
 
57
  <span class="sui-loading-text">
58
  <?php
59
  if ( isset( $icon ) && '' !== trim( $icon ) ) {
60
- echo '<i class="sui-icon-' . $icon . '" aria-hidden="true"></i> ' . $label;
61
  } else {
62
- echo $label;
63
  }
64
  ?>
65
  </span>
@@ -68,4 +73,4 @@ $class .= ( isset( $ghost ) && true === is_bool( $ghost ) ) ? ' sui-button-ghost
68
 
69
  </button>
70
 
71
- <?php } ?>
5
  $class .= ( isset( $ghost ) && true === is_bool( $ghost ) ) ? ' sui-button-ghost' : '';
6
  ?>
7
 
8
+ <?php
9
+ if ( isset( $compound ) && true === is_bool( $compound ) ) {
10
  $class .= ' sui-button-compound';
11
  ?>
12
 
13
  <button
14
+ class="<?php echo esc_attr( $class ); ?>"
15
+ <?php
16
+ if ( isset( $attrs ) ) {
17
+ foreach ( $attrs as $data => $val ) {
18
+ echo esc_attr( $data ) . '="' . esc_attr( $val ) . '"';
19
  }
20
  }
21
  if ( isset( $disabled ) && $disabled ) {
22
+ echo 'disabled="' . esc_attr( $disabled ) . '"';
23
+ }
24
+ ?>
25
  >
26
 
27
  <span class="sui-loading-text" aria-hidden="true">
28
 
29
  <span class="sui-compound-desktop">
30
+ <i class="sui-icon-<?php echo esc_attr( $icon ); ?>"></i>
31
+ <?php echo esc_html( $label ); ?>
32
  </span>
33
 
34
  <span class="sui-compound-mobile">
35
+ <span class="sui-icon-<?php echo esc_attr( $icon ); ?>"></span>
36
  </span>
37
 
38
  </span>
39
 
40
  <span class="sui-icon-loader sui-loading" aria-hidden="true"></span>
41
 
42
+ <span class="sui-screen-reader-text"><?php echo esc_html( $label ); ?></span>
43
 
44
  </button>
45
 
46
  <?php } else { ?>
47
 
48
  <button
49
+ class="<?php echo esc_attr( $class ); ?>"
50
+ <?php
51
+ if ( isset( $attrs ) ) {
52
+ foreach ( $attrs as $data => $val ) {
53
+ echo esc_attr( $data ) . '="' . esc_attr( $val ) . '"';
54
  }
55
  }
56
  if ( isset( $disabled ) && $disabled ) {
57
+ echo 'disabled="' . esc_attr( $disabled ) . '"';
58
+ }
59
+ ?>
60
  >
61
 
62
  <span class="sui-loading-text">
63
  <?php
64
  if ( isset( $icon ) && '' !== trim( $icon ) ) {
65
+ echo '<i class="sui-icon-' . esc_attr( $icon ) . '" aria-hidden="true"></i> ' . esc_html( $label );
66
  } else {
67
+ echo esc_html( $label );
68
  }
69
  ?>
70
  </span>
73
 
74
  </button>
75
 
76
+ <?php } ?>
admin/views/addons/addon-details.php CHANGED
@@ -23,7 +23,7 @@ $features = array(
23
  0 => array(),
24
  1 => array(),
25
  );
26
- // chunk feature into 2
27
  if ( is_array( $res->features ) && ! empty( $res->features ) ) {
28
  $has_features = true;
29
  $chunk_size = ceil( count( $res->features ) / 2 );
@@ -32,253 +32,261 @@ if ( is_array( $res->features ) && ! empty( $res->features ) ) {
32
  ?>
33
 
34
  <div
35
- tabindex="-1"
36
- id="forminator-modal-addons-details-<?php echo esc_attr( $pid ); ?>"
37
- class="sui-dialog"
38
- aria-hidden="true"
39
  >
40
 
41
- <div
42
- class="sui-dialog-content sui-fade-in"
43
- aria-labelledby="dialogTitle"
44
- aria-describedby="dialogDescription"
45
- role="dialog"
46
- >
47
-
48
- <div class="sui-box" role="document">
49
-
50
- <div class="sui-box-header">
51
-
52
- <button
53
- class="sui-dialog-close"
54
- data-addon="<?php echo esc_attr( $res->pid ); ?>"
55
- data-element="forminator-modal-addons-details"
56
- aria-label="Close this dialog window"
57
- ></button>
58
-
59
- <div class="forminator-details-header">
60
-
61
- <?php if ( forminator_is_show_branding() ) : ?>
62
- <div class="forminator-details-header--image" style="background-image: url(<?php echo esc_url( $res->url->thumbnail ); ?>);" aria-hidden="true"></div>
63
- <?php endif; ?>
64
-
65
- <div class="forminator-details-header--data">
66
-
67
- <h3 class="forminator-details-header--title">
68
- <?php echo esc_html( $res->name ); ?>
69
- <?php if ( ! FORMINATOR_PRO ) {
70
- echo '<span class="sui-tag sui-tag-purple sui-tag-sm">' . esc_html__( 'PRO', 'forminator' ) . '</span>';
71
- } ?>
72
- </h3>
73
-
74
- <div class="forminator-details-header--tags">
75
-
76
- <?php
77
- if ( FORMINATOR_PRO ) {
78
- /* translators: Plugin latest version */
79
- echo '<span class="sui-tag sui-tag-sm addons-version">' . sprintf( esc_html__( 'Version %s', 'forminator' ), esc_html( $res->version_installed ) ) . '</span>';
80
-
81
- if ( $res->is_installed && $res->has_update ) {
82
- /* translators: Plugin latest version */
83
- echo '<span class="sui-tag sui-tag-sm sui-tag-yellow addons-update-tag">' . sprintf( esc_html__( 'v%s update available', 'forminator' ), esc_html( $res->version_latest ) ) . '</span>';
84
- }
85
-
86
- if ( $res->is_installed && $res->is_active ) {
87
- echo '<span class="sui-tag sui-tag-sm sui-tag-blue">' . esc_html__( 'Active', 'forminator' ) . '</span>';
88
- }
89
- }
90
- ?>
91
-
92
- </div>
93
-
94
- <?php if ( FORMINATOR_PRO && $res->is_installed && $res->has_update ) {
95
- Forminator_Admin_Addons_page::get_instance()->render_template(
96
- 'admin/views/addons/action-button',
97
- array(
98
- 'label' => esc_html__( 'Update', 'forminator' ),
99
- 'icon' => 'update',
100
- 'color' => 'blue',
101
- 'class' => 'addons-actions',
102
- 'attrs' => array(
103
- 'data-action' => 'addons-update',
104
- 'data-addon' => esc_attr( $res->pid ),
105
- 'data-nonce' => esc_attr( wp_create_nonce( 'forminator_popup_addons_actions' ) ),
106
- 'data-version' => sprintf( esc_html__( 'Version %s', 'forminator' ), esc_html( $res->version_latest ) ),
107
- )
108
- )
109
- );
110
- } ?>
111
-
112
- <?php if ( ! FORMINATOR_PRO ) { ?>
113
- <a
114
- href="https://wpmudev.com/project/forminator-pro/?coupon=FORMINATOR-SUBSCRIPTIONS&checkout=0&utm_source=forminator&utm_medium=plugin&utm_campaign=forminator_stripe-addon"
115
- target="_blank"
116
- class="sui-button sui-button-purple"
117
- >
118
- <?php esc_html_e( 'Try Pro For 35% Off', 'forminator' ); ?>
119
- </a>
120
- <?php } ?>
121
- </div>
122
- </div>
123
-
124
- </div>
125
-
126
- <div class="sui-box-body">
127
-
128
- <div class="sui-tabs sui-tabs-flushed">
129
-
130
- <div role="tablist" class="sui-tabs-menu">
131
-
132
- <button
133
- type="button"
134
- role="tab"
135
- id="tab-details-<?php echo esc_attr( $pid ); ?>"
136
- class="sui-tab-item active"
137
- aria-controls="tab-content-details-<?php echo esc_attr( $pid ); ?>"
138
- aria-selected="true"
139
- >
140
- <?php esc_html_e( 'Details', 'forminator' ); ?>
141
- </button>
142
-
143
- <button
144
- type="button"
145
- role="tab"
146
- id="tab-features-<?php echo esc_attr( $pid ); ?>"
147
- class="sui-tab-item"
148
- aria-controls="tab-content-features-<?php echo esc_attr( $pid ); ?>"
149
- aria-selected="false"
150
- tabindex="-1"
151
- >
152
- <?php esc_html_e( 'Features', 'forminator' ); ?>
153
- </button>
154
-
155
- <button
156
- type="button"
157
- role="tab"
158
- id="tab-changelog-<?php echo esc_attr( $pid ); ?>"
159
- class="sui-tab-item"
160
- aria-controls="tab-content-changelog-<?php echo esc_attr( $pid ); ?>"
161
- aria-selected="false"
162
- tabindex="-1"
163
- >
164
- <?php esc_html_e( 'Changelog', 'forminator' ); ?>
165
- </button>
166
-
167
- </div>
168
-
169
- <div class="sui-tabs-content">
170
-
171
- <div
172
- role="tabpanel"
173
- tabindex="0"
174
- id="tab-content-details-<?php echo esc_attr( $pid ); ?>"
175
- class="sui-tab-content active"
176
- aria-labelledby="tab-details-<?php echo esc_attr( $pid ); ?>"
177
- >
178
-
179
- <h4><?php esc_html_e( 'Description', 'forminator' ); ?></h4>
180
-
181
- <p><?php echo isset( $res->info ) ? esc_html( $res->info ) : ''; ?></p>
182
-
183
- </div>
184
-
185
- <div
186
- role="tabpanel"
187
- tabindex="0"
188
- id="tab-content-features-<?php echo esc_attr( $pid ); ?>"
189
- class="sui-tab-content"
190
- aria-labelledby="tab-features-<?php echo esc_attr( $pid ); ?>"
191
- hidden
192
- >
193
-
194
- <?php foreach ( $features as $group => $feature ) : ?>
195
-
196
- <ul>
197
-
198
- <?php foreach ( $feature as $item ) : ?>
199
-
200
- <li>
201
- <span class="sui-icon-check sui-sm" aria-hidden="true"></span>
 
 
 
 
202
  <?php echo esc_html( $item ); ?>
203
- </li>
204
 
205
  <?php endforeach; ?>
206
 
207
- </ul>
208
 
209
- <?php endforeach; ?>
210
 
211
- </div>
212
 
213
- <div
214
- role="tabpanel"
215
- tabindex="0"
216
- id="tab-content-changelog-<?php echo esc_attr( $pid ); ?>"
217
- class="sui-tab-content"
218
- aria-labelledby="tab-changelog-<?php echo esc_attr( $pid ); ?>"
219
- hidden
220
- >
221
 
222
- <?php foreach( $res->changelog as $idx => $log ) {
223
- if ( isset( $log['version'] ) ) { ?>
224
-
225
- <div class="forminator-addon-changelog">
226
 
227
- <div class="forminator-addon-changelog--header">
228
 
229
- <?php
230
- $title = '<h4>';
231
- /* translators: Log version */
232
- $title .= '<span class="sui-tag sui-tag-sm sui-tag-purple">' . sprintf( esc_html__( 'Version %s', 'forminator' ), esc_attr( $log['version'] ) ) . '</span>';
233
- if ( $log['version'] === $res->version_latest ) {
234
- $title .= '<span class="sui-tag sui-tag-sm">' . esc_html__( 'Current', 'forminator' ) . '</span>';
235
- }
236
- $title .= '</h4>';
237
-
238
- echo $title;
239
- ?>
240
 
241
- <p><?php echo date( 'F j, Y', $log['time'] ); ?></p>
 
 
 
 
 
 
 
242
 
243
- </div>
 
244
 
245
- <div class="forminator-addon-changelog--body">
246
- <?php echo $log['log']; ?>
247
- </div>
248
 
249
- </div>
250
 
251
- <?php }
252
- } ?>
 
253
 
254
- </div>
255
 
256
- </div>
 
 
 
257
 
258
- </div>
259
 
260
- </div>
261
 
262
- <div class="sui-box-footer">
263
- <a
264
- href="https://wpmudev.com/docs/wpmu-dev-plugins/forminator/?utm_source=forminator&utm_medium=plugin&utm_campaign=forminator_stripe-addon_docs#add-ons"
265
- target="_blank"
266
- class="sui-button sui-button-ghost"
267
- >
268
- <?php esc_html_e( 'Documentation', 'forminator' ); ?>
269
- </a>
270
 
271
- <button
272
- class="sui-button addons-modal-close"
273
- data-addon="<?php echo esc_attr( $res->pid ); ?>"
274
- data-element="forminator-modal-addons-details"
275
- >
276
- <?php esc_html_e( 'Close', 'forminator' ); ?>
277
- </button>
278
- </div>
279
 
280
- </div><!-- END .sui-box -->
 
 
 
 
 
 
 
281
 
282
- </div><!-- END .sui-dialog-content -->
 
 
 
 
 
 
 
 
 
 
 
283
 
284
  </div><!-- END .sui-dialog -->
23
  0 => array(),
24
  1 => array(),
25
  );
26
+ // chunk feature into 2.
27
  if ( is_array( $res->features ) && ! empty( $res->features ) ) {
28
  $has_features = true;
29
  $chunk_size = ceil( count( $res->features ) / 2 );
32
  ?>
33
 
34
  <div
35
+ tabindex="-1"
36
+ id="forminator-modal-addons-details-<?php echo esc_attr( $pid ); ?>"
37
+ class="sui-dialog"
38
+ aria-hidden="true"
39
  >
40
 
41
+ <div
42
+ class="sui-dialog-content sui-fade-in"
43
+ aria-labelledby="dialogTitle"
44
+ aria-describedby="dialogDescription"
45
+ role="dialog"
46
+ >
47
+
48
+ <div class="sui-box" role="document">
49
+
50
+ <div class="sui-box-header">
51
+
52
+ <button
53
+ class="sui-dialog-close"
54
+ data-addon="<?php echo esc_attr( $res->pid ); ?>"
55
+ data-element="forminator-modal-addons-details"
56
+ aria-label="Close this dialog window"
57
+ ></button>
58
+
59
+ <div class="forminator-details-header">
60
+
61
+ <?php if ( forminator_is_show_branding() ) : ?>
62
+ <div class="forminator-details-header--image" style="background-image: url(<?php echo esc_url( $res->url->thumbnail ); ?>);" aria-hidden="true"></div>
63
+ <?php endif; ?>
64
+
65
+ <div class="forminator-details-header--data">
66
+
67
+ <h3 class="forminator-details-header--title">
68
+ <?php echo esc_html( $res->name ); ?>
69
+ <?php
70
+ if ( ! FORMINATOR_PRO ) {
71
+ echo '<span class="sui-tag sui-tag-purple sui-tag-sm">' . esc_html__( 'PRO', 'forminator' ) . '</span>';
72
+ }
73
+ ?>
74
+ </h3>
75
+
76
+ <div class="forminator-details-header--tags">
77
+
78
+ <?php
79
+ if ( FORMINATOR_PRO ) {
80
+ /* translators: Plugin latest version */
81
+ echo '<span class="sui-tag sui-tag-sm addons-version">' . sprintf( esc_html__( 'Version %s', 'forminator' ), esc_html( $res->version_installed ) ) . '</span>';
82
+
83
+ if ( $res->is_installed && $res->has_update ) {
84
+ /* translators: Plugin latest version */
85
+ echo '<span class="sui-tag sui-tag-sm sui-tag-yellow addons-update-tag">' . sprintf( esc_html__( 'v%s update available', 'forminator' ), esc_html( $res->version_latest ) ) . '</span>';
86
+ }
87
+
88
+ if ( $res->is_installed && $res->is_active ) {
89
+ echo '<span class="sui-tag sui-tag-sm sui-tag-blue">' . esc_html__( 'Active', 'forminator' ) . '</span>';
90
+ }
91
+ }
92
+ ?>
93
+
94
+ </div>
95
+
96
+ <?php
97
+ if ( FORMINATOR_PRO && $res->is_installed && $res->has_update ) {
98
+ Forminator_Admin_Addons_page::get_instance()->render_template(
99
+ 'admin/views/addons/action-button',
100
+ array(
101
+ 'label' => esc_html__( 'Update', 'forminator' ),
102
+ 'icon' => 'update',
103
+ 'color' => 'blue',
104
+ 'class' => 'addons-actions',
105
+ 'attrs' => array(
106
+ 'data-action' => 'addons-update',
107
+ 'data-addon' => esc_attr( $res->pid ),
108
+ 'data-nonce' => esc_attr( wp_create_nonce( 'forminator_popup_addons_actions' ) ),
109
+ 'data-version' => sprintf( esc_html__( 'Version %s', 'forminator' ), esc_html( $res->version_latest ) ),
110
+ ),
111
+ )
112
+ );
113
+ }
114
+ ?>
115
+
116
+ <?php if ( ! FORMINATOR_PRO ) { ?>
117
+ <a
118
+ href="https://wpmudev.com/project/forminator-pro/?coupon=FORMINATOR-SUBSCRIPTIONS&checkout=0&utm_source=forminator&utm_medium=plugin&utm_campaign=forminator_stripe-addon"
119
+ target="_blank"
120
+ class="sui-button sui-button-purple"
121
+ >
122
+ <?php esc_html_e( 'Try Pro For 35% Off', 'forminator' ); ?>
123
+ </a>
124
+ <?php } ?>
125
+ </div>
126
+ </div>
127
+
128
+ </div>
129
+
130
+ <div class="sui-box-body">
131
+
132
+ <div class="sui-tabs sui-tabs-flushed">
133
+
134
+ <div role="tablist" class="sui-tabs-menu">
135
+
136
+ <button
137
+ type="button"
138
+ role="tab"
139
+ id="tab-details-<?php echo esc_attr( $pid ); ?>"
140
+ class="sui-tab-item active"
141
+ aria-controls="tab-content-details-<?php echo esc_attr( $pid ); ?>"
142
+ aria-selected="true"
143
+ >
144
+ <?php esc_html_e( 'Details', 'forminator' ); ?>
145
+ </button>
146
+
147
+ <button
148
+ type="button"
149
+ role="tab"
150
+ id="tab-features-<?php echo esc_attr( $pid ); ?>"
151
+ class="sui-tab-item"
152
+ aria-controls="tab-content-features-<?php echo esc_attr( $pid ); ?>"
153
+ aria-selected="false"
154
+ tabindex="-1"
155
+ >
156
+ <?php esc_html_e( 'Features', 'forminator' ); ?>
157
+ </button>
158
+
159
+ <button
160
+ type="button"
161
+ role="tab"
162
+ id="tab-changelog-<?php echo esc_attr( $pid ); ?>"
163
+ class="sui-tab-item"
164
+ aria-controls="tab-content-changelog-<?php echo esc_attr( $pid ); ?>"
165
+ aria-selected="false"
166
+ tabindex="-1"
167
+ >
168
+ <?php esc_html_e( 'Changelog', 'forminator' ); ?>
169
+ </button>
170
+
171
+ </div>
172
+
173
+ <div class="sui-tabs-content">
174
+
175
+ <div
176
+ role="tabpanel"
177
+ tabindex="0"
178
+ id="tab-content-details-<?php echo esc_attr( $pid ); ?>"
179
+ class="sui-tab-content active"
180
+ aria-labelledby="tab-details-<?php echo esc_attr( $pid ); ?>"
181
+ >
182
+
183
+ <h4><?php esc_html_e( 'Description', 'forminator' ); ?></h4>
184
+
185
+ <p><?php echo isset( $res->info ) ? esc_html( $res->info ) : ''; ?></p>
186
+
187
+ </div>
188
+
189
+ <div
190
+ role="tabpanel"
191
+ tabindex="0"
192
+ id="tab-content-features-<?php echo esc_attr( $pid ); ?>"
193
+ class="sui-tab-content"
194
+ aria-labelledby="tab-features-<?php echo esc_attr( $pid ); ?>"
195
+ hidden
196
+ >
197
+
198
+ <?php foreach ( $features as $group => $feature ) : ?>
199
+
200
+ <ul>
201
+
202
+ <?php foreach ( $feature as $item ) : ?>
203
+
204
+ <li>
205
+ <span class="sui-icon-check sui-sm" aria-hidden="true"></span>
206
  <?php echo esc_html( $item ); ?>
207
+ </li>
208
 
209
  <?php endforeach; ?>
210
 
211
+ </ul>
212
 
213
+ <?php endforeach; ?>
214
 
215
+ </div>
216
 
217
+ <div
218
+ role="tabpanel"
219
+ tabindex="0"
220
+ id="tab-content-changelog-<?php echo esc_attr( $pid ); ?>"
221
+ class="sui-tab-content"
222
+ aria-labelledby="tab-changelog-<?php echo esc_attr( $pid ); ?>"
223
+ hidden
224
+ >
225
 
226
+ <?php
227
+ foreach ( $res->changelog as $idx => $log ) {
228
+ if ( isset( $log['version'] ) ) {
229
+ ?>
230
 
231
+ <div class="forminator-addon-changelog">
232
 
233
+ <div class="forminator-addon-changelog--header">
 
 
 
 
 
 
 
 
 
 
234
 
235
+ <?php
236
+ $title = '<h4>';
237
+ /* translators: Log version */
238
+ $title .= '<span class="sui-tag sui-tag-sm sui-tag-purple">' . sprintf( esc_html__( 'Version %s', 'forminator' ), esc_attr( $log['version'] ) ) . '</span>';
239
+ if ( $log['version'] === $res->version_latest ) {
240
+ $title .= '<span class="sui-tag sui-tag-sm">' . esc_html__( 'Current', 'forminator' ) . '</span>';
241
+ }
242
+ $title .= '</h4>';
243
 
244
+ echo wp_kses_post( $title );
245
+ ?>
246
 
247
+ <p><?php echo esc_html( date( 'F j, Y', $log['time'] ) ); ?></p>
 
 
248
 
249
+ </div>
250
 
251
+ <div class="forminator-addon-changelog--body">
252
+ <?php echo wp_kses_post( $log['log'] ); ?>
253
+ </div>
254
 
255
+ </div>
256
 
257
+ <?php
258
+ }
259
+ }
260
+ ?>
261
 
262
+ </div>
263
 
264
+ </div>
265
 
266
+ </div>
 
 
 
 
 
 
 
267
 
268
+ </div>
 
 
 
 
 
 
 
269
 
270
+ <div class="sui-box-footer">
271
+ <a
272
+ href="https://wpmudev.com/docs/wpmu-dev-plugins/forminator/?utm_source=forminator&utm_medium=plugin&utm_campaign=forminator_stripe-addon_docs#add-ons"
273
+ target="_blank"
274
+ class="sui-button sui-button-ghost"
275
+ >
276
+ <?php esc_html_e( 'Documentation', 'forminator' ); ?>
277
+ </a>
278
 
279
+ <button
280
+ class="sui-button addons-modal-close"
281
+ data-addon="<?php echo esc_attr( $res->pid ); ?>"
282
+ data-element="forminator-modal-addons-details"
283
+ >
284
+ <?php esc_html_e( 'Close', 'forminator' ); ?>
285
+ </button>
286
+ </div>
287
+
288
+ </div><!-- END .sui-box -->
289
+
290
+ </div><!-- END .sui-dialog-content -->
291
 
292
  </div><!-- END .sui-dialog -->
admin/views/addons/addons-activate-popup.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php if ( ! isset( $addons ) ) {
2
- return;
3
  } ?>
4
  <div
5
  tabindex="-1"
@@ -7,64 +7,64 @@
7
  class="sui-dialog sui-dialog-sm sui-dialog-alt fui-dialog-publish"
8
  aria-hidden="true"
9
  >
10
-
11
- <div
12
- class="sui-dialog-content sui-fade-in"
13
- aria-labelledby="fui-addons--install-title-<?php echo esc_attr( $addons->pid ); ?>"
14
- aria-describedby="fui-addons--install-description-<?php echo esc_attr( $addons->pid ); ?>"
15
- role="dialog"
16
- >
17
 
18
- <div role="document" class="sui-box">
 
 
 
 
 
19
 
20
- <div class="sui-box-header sui-block-content-center">
21
 
22
- <button
23
- class="sui-dialog-close"
24
- data-addon="<?php echo esc_attr( $addons->pid ); ?>"
25
- data-element="forminator-activate-popup"
26
- aria-label="Close this dialog window"
27
- ></button>
28
 
29
- <h3 id="fui-addons--install-title-<?php echo esc_attr( $addons->pid ); ?>" class="sui-box-title"><?php printf( esc_html__( '%s installed!', 'forminator' ), $addons->name ); ?></h3>
 
 
 
 
 
30
 
31
- <p id="fui-addons--install-description-<?php echo esc_attr( $addons->pid ); ?>" class="sui-description" style="margin-top: 15px;"><?php esc_html_e( 'Would you like to activate it now?', 'forminator' ); ?></p>
32
 
33
- </div>
34
 
35
- <div class="sui-box-footer sui-flatten sui-box-footer-center">
36
 
37
- <button
38
- class="sui-button addons-modal-close"
39
- data-addon="<?php echo esc_attr( $addons->pid ); ?>"
40
- data-element="forminator-activate-popup"
41
- >
42
- <?php esc_html_e( 'Close', 'forminator' ); ?>
43
- </button>
44
 
45
- <button
46
- class="sui-button sui-button-blue addons-actions"
47
- data-action="addons-activate"
48
- data-popup="true"
49
- data-nonce="<?php echo esc_attr( wp_create_nonce( 'forminator_popup_addons_actions' ) ); ?>"
50
- data-addon="<?php echo esc_attr( $addons->pid ); ?>"
51
- >
52
- <span class="sui-loading-text">
53
- <?php esc_html_e( 'Activate', 'forminator' ); ?>
54
- </span>
55
- <span class="sui-icon-loader sui-loading" aria-hidden="true"></span>
56
- </button>
57
 
58
- </div><!-- END .sui-box -->
 
 
 
 
 
 
 
 
 
 
 
59
 
60
- <img
61
- src="<?php echo esc_url( forminator_plugin_url() . 'assets/images/forminator-prompt.png' ); ?>"
62
- srcset="<?php echo esc_url( forminator_plugin_url() . 'assets/images/forminator-prompt.png' ); ?> 1x, <?php echo esc_url( forminator_plugin_url() . 'assets/images/forminator-prompt@2x.png' ); ?> 2x"
63
- class="sui-image sui-image-center"
64
- style="margin-top: 20px;"
65
- />
66
 
67
- </div><!-- END .sui-box -->
 
 
 
 
 
68
 
69
- </div><!-- END .sui-dialog-content -->
70
- </div><!-- END .sui-dialog -->
 
 
1
  <?php if ( ! isset( $addons ) ) {
2
+ return;
3
  } ?>
4
  <div
5
  tabindex="-1"
7
  class="sui-dialog sui-dialog-sm sui-dialog-alt fui-dialog-publish"
8
  aria-hidden="true"
9
  >
 
 
 
 
 
 
 
10
 
11
+ <div
12
+ class="sui-dialog-content sui-fade-in"
13
+ aria-labelledby="fui-addons--install-title-<?php echo esc_attr( $addons->pid ); ?>"
14
+ aria-describedby="fui-addons--install-description-<?php echo esc_attr( $addons->pid ); ?>"
15
+ role="dialog"
16
+ >
17
 
18
+ <div role="document" class="sui-box">
19
 
20
+ <div class="sui-box-header sui-block-content-center">
 
 
 
 
 
21
 
22
+ <button
23
+ class="sui-dialog-close"
24
+ data-addon="<?php echo esc_attr( $addons->pid ); ?>"
25
+ data-element="forminator-activate-popup"
26
+ aria-label="Close this dialog window"
27
+ ></button>
28
 
29
+ <h3 id="fui-addons--install-title-<?php echo esc_attr( $addons->pid ); ?>" class="sui-box-title"><?php echo esc_html( sprintf( __( '%s installed!', 'forminator' ), $addons->name ) ); ?></h3>
30
 
31
+ <p id="fui-addons--install-description-<?php echo esc_attr( $addons->pid ); ?>" class="sui-description" style="margin-top: 15px;"><?php esc_html_e( 'Would you like to activate it now?', 'forminator' ); ?></p>
32
 
33
+ </div>
34
 
35
+ <div class="sui-box-footer sui-flatten sui-box-footer-center">
 
 
 
 
 
 
36
 
37
+ <button
38
+ class="sui-button addons-modal-close"
39
+ data-addon="<?php echo esc_attr( $addons->pid ); ?>"
40
+ data-element="forminator-activate-popup"
41
+ >
42
+ <?php esc_html_e( 'Close', 'forminator' ); ?>
43
+ </button>
 
 
 
 
 
44
 
45
+ <button
46
+ class="sui-button sui-button-blue addons-actions"
47
+ data-action="addons-activate"
48
+ data-popup="true"
49
+ data-nonce="<?php echo esc_attr( wp_create_nonce( 'forminator_popup_addons_actions' ) ); ?>"
50
+ data-addon="<?php echo esc_attr( $addons->pid ); ?>"
51
+ >
52
+ <span class="sui-loading-text">
53
+ <?php esc_html_e( 'Activate', 'forminator' ); ?>
54
+ </span>
55
+ <span class="sui-icon-loader sui-loading" aria-hidden="true"></span>
56
+ </button>
57
 
58
+ </div><!-- END .sui-box -->
 
 
 
 
 
59
 
60
+ <img
61
+ src="<?php echo esc_url( forminator_plugin_url() . 'assets/images/forminator-prompt.png' ); ?>"
62
+ srcset="<?php echo esc_url( forminator_plugin_url() . 'assets/images/forminator-prompt.png' ); ?> 1x, <?php echo esc_url( forminator_plugin_url() . 'assets/images/forminator-prompt@2x.png' ); ?> 2x"
63
+ class="sui-image sui-image-center"
64
+ style="margin-top: 20px;"
65
+ />
66
 
67
+ </div><!-- END .sui-box -->
68
+
69
+ </div><!-- END .sui-dialog-content -->
70
+ </div><!-- END .sui-dialog -->
admin/views/addons/addons-list.php CHANGED
@@ -12,8 +12,8 @@ if ( 3953609 === $addons->pid ) {
12
  $is_network_active = $addons->is_network_admin && is_plugin_active_for_network( $addons->filename );
13
 
14
  $tags = array(
15
- 'label' => esc_html__( 'PRO', 'forminator' ),
16
- 'class' => 'sui-tag sui-tag-sm sui-tag-purple'
17
  );
18
 
19
  if ( FORMINATOR_PRO ) {
@@ -44,7 +44,7 @@ if ( FORMINATOR_PRO ) {
44
  'data' => array(
45
  'action' => 'addons-install',
46
  'addons' => $addons->pid,
47
- )
48
  );
49
  } else {
50
  if ( ! is_plugin_active( $addons->filename ) ) {
@@ -103,197 +103,199 @@ if ( FORMINATOR_PRO ) {
103
 
104
  <div class="sui-col-md-6 addons-<?php echo esc_attr( $addons->pid ); ?>">
105
 
106
- <div class="sui-box forminator-addon-card">
107
 
108
- <div class="forminator-addon-card--body">
109
 
110
- <?php if ( forminator_is_show_branding() ) : ?>
111
- <div class="forminator-addon-card--body-left" aria-hidden="true">
112
- <div class="forminator-addon-card--thumb" style="background-image: url(<?php echo esc_url( $addons->url->thumbnail ); ?>);"></div>
113
- </div>
114
  <?php endif; ?>
115
 
116
- <div class="forminator-addon-card--body-right">
117
-
118
- <div class="forminator-addon-card--title">
119
-
120
- <h3><?php echo esc_html( $addons->name ); ?></h3>
121
-
122
- <div class="forminator-addon-card--tags">
123
-
124
- <span class="<?php echo $tags['class']; ?>"><?php echo $tags['label'] ?></span>
125
-
126
- <?php if ( FORMINATOR_PRO && $addons->is_installed && $addons->has_update ) { ?>
127
- <?php /* translators: Plugin latest version */ ?>
128
- <span class="sui-tag sui-tag-yellow sui-tag-sm"><?php printf( esc_html__( 'v%s update available', 'forminator' ), esc_html( $addons->version_latest ) ); ?></span>
129
- <?php } ?>
130
-
131
- </div>
132
-
133
- </div>
134
-
135
- <p class="sui-description"><?php echo esc_html( $addons->info ); ?></p>
136
-
137
- </div>
138
-
139
- </div>
140
-
141
- <div class="forminator-addon-card--footer">
142
-
143
- <div class="forminator-addon-card--footer-left">
144
-
145
- <a
146
- role="button"
147
- class="forminator-pseudo-link addons-page-details"
148
- data-modal="addons_page_details"
149
- data-form-id="<?php echo esc_attr( $addons->pid ); ?>"
150
- data-modal-title="<?php echo esc_attr( $addons->name ); ?>"
151
- data-nonce="<?php echo esc_attr( wp_create_nonce( 'forminator_addons_page_details' ) ); ?>"
152
- >
153
- <?php esc_html_e( 'Details', 'forminator' ); ?>
154
- </a>
155
-
156
- </div>
157
-
158
- <div class="forminator-addon-card--footer-right">
159
-
160
- <?php if ( FORMINATOR_PRO ) { ?>
161
-
162
- <?php if ( $addons->is_installed ) { ?>
163
-
164
- <?php
165
- // BUTTON: Blue.
166
- if ( $addons->has_update ) {
167
- Forminator_Admin_Addons_page::get_instance()->render_template(
168
- 'admin/views/addons/action-button',
169
- array(
170
- 'compound' => true,
171
- 'label' => esc_html__( 'Update', 'forminator' ),
172
- 'icon' => 'update',
173
- 'color' => 'blue',
174
- 'class' => 'addons-actions',
175
- 'attrs' => array(
176
- 'data-action' => 'addons-update',
177
- 'data-addon' => esc_attr( $addons->pid ),
178
- 'data-nonce' => esc_attr( wp_create_nonce( 'forminator_popup_addons_actions' ) ),
179
- 'data-version' => sprintf( esc_html__( 'Version %s', 'forminator' ), esc_html( $addons->version_latest ) ),
180
- )
181
- )
182
- );
183
- }
184
-
185
- if ( is_plugin_active( $addons->filename ) ) {
186
-
187
- // BUTTON: Configure.
188
- Forminator_Admin_Addons_page::get_instance()->render_template(
189
- 'admin/views/addons/action-button',
190
- array(
191
- 'compound' => true,
192
- 'label' => esc_html__( 'Configure', 'forminator' ),
193
- 'icon' => 'wrench-tool',
194
- 'class' => 'addons-configure',
195
- 'attrs' => array(
196
- 'data-action' => esc_attr( $addons_slug . '-connect-modal' ),
197
- 'data-addon' => esc_attr( $addons->pid ),
198
- 'data-nonce' => esc_attr( wp_create_nonce( 'forminator_' . $addons_slug . '_settings_modal' ) ),
199
- 'data-modal-nonce' => esc_attr( wp_create_nonce( 'forminator_' . $addons_slug . '_settings_modal' ) ),
200
- 'data-modal-image' => esc_url( forminator_plugin_url() . 'assets/images/' . $addons_slug . '-logo.png' ),
201
- 'data-modal-image-x2' => esc_url( forminator_plugin_url() . 'assets/images/' . $addons_slug . '-logo@2x.png' ),
202
- 'data-modal-title' => esc_html( sprintf( __( 'Connect %s Account', 'forminator' ), ucfirst( $addons_slug ) ) ),
203
- )
204
- )
205
- );
206
-
207
- // BUTTON: Deactivate.
208
- Forminator_Admin_Addons_page::get_instance()->render_template(
209
- 'admin/views/addons/action-button',
210
- array(
211
- 'compound' => true,
212
- 'label' => ( $is_network_active ? __( 'Network Deactivate', 'forminator' ) : __( 'Deactivate', 'forminator' ) ),
213
- 'icon' => 'power-on-off',
214
- 'ghost' => true,
215
- 'class' => 'wpmudev-open-modal',
216
- 'attrs' => array(
217
- 'data-action' => 'addons-deactivate',
218
- 'data-addon' => esc_attr( $addons->pid ),
219
- 'data-nonce' => esc_attr( wp_create_nonce( 'forminator_popup_addons_actions' ) ),
220
- 'data-modal' => 'addons-deactivate',
221
- 'data-modal-title' => esc_html__( 'Deactivate Add-ons', 'forminator' ),
222
- 'data-modal-content' => sprintf( __( 'You are trying to deactivate <strong>%s</strong> which is being used by the following forms. This can break the functionality of the forms. Are you sure you want to proceed?', 'forminator' ), esc_html( $addons->name ) ),
223
- 'data-addon-slug' => esc_attr( $addons_slug ),
224
- ),
225
- 'disabled' => ( $is_network_active ),
226
- )
227
- );
228
- } else {
229
-
230
- // BUTTON: Activate.
231
- Forminator_Admin_Addons_page::get_instance()->render_template(
232
- 'admin/views/addons/action-button',
233
- array(
234
- 'compound' => true,
235
- 'label' => ( $is_network_active ? __( 'Network Activate', 'forminator' ) : __( 'Activate', 'forminator' ) ),
236
- 'icon' => 'power-on-off',
237
- 'color' => 'blue',
238
- 'class' => 'addons-actions',
239
- 'attrs' => array(
240
- 'data-action' => 'addons-activate',
241
- 'data-addon' => esc_attr( $addons->pid ),
242
- 'data-nonce' => esc_attr( wp_create_nonce( 'forminator_popup_addons_actions' ) )
243
- )
244
- )
245
- );
246
-
247
- // BUTTON: Delete.
248
- Forminator_Admin_Addons_page::get_instance()->render_template(
249
- 'admin/views/addons/action-button',
250
- array(
251
- 'compound' => true,
252
- 'label' => esc_html__( 'Delete', 'forminator' ),
253
- 'icon' => 'trash',
254
- 'ghost' => true,
255
- 'class' => 'addons-actions',
256
- 'attrs' => array(
257
- 'data-action' => 'addons-delete',
258
- 'data-addon' => esc_attr( $addons->pid ),
259
- 'data-nonce' => esc_attr( wp_create_nonce( 'forminator_popup_addons_actions' ) )
260
- )
261
- )
262
- );
263
- }
264
- ?>
265
- <?php } else {
266
-
267
- Forminator_Admin_Addons_page::get_instance()->render_template(
268
- 'admin/views/addons/action-button',
269
- array(
270
- 'label' => esc_html__( 'Install', 'forminator' ),
271
- 'icon' => 'download',
272
- 'color' => 'blue',
273
- 'class' => 'addons-actions',
274
- 'attrs' => array(
275
- 'data-action' => 'addons-install',
276
- 'data-addon' => esc_attr( $addons->pid ),
277
- 'data-nonce' => esc_attr( wp_create_nonce( 'forminator_popup_addons_actions' ) )
278
- )
279
- )
280
- );
281
-
282
- } ?>
283
- <?php } else { ?>
284
- <a
285
- href="https://wpmudev.com/project/forminator-pro/?coupon=FORMINATOR-SUBSCRIPTIONS&checkout=0&utm_source=forminator&utm_medium=plugin&utm_campaign=forminator_stripe-addon"
286
- target="_blank"
287
- class="sui-button sui-button-purple"
288
- >
289
- <?php esc_html_e( 'Try Pro for 35% Off', 'forminator' ); ?>
290
- </a>
291
- <?php } ?>
292
-
293
- </div>
294
-
295
- </div>
296
-
297
- </div>
 
 
298
 
299
  </div>
12
  $is_network_active = $addons->is_network_admin && is_plugin_active_for_network( $addons->filename );
13
 
14
  $tags = array(
15
+ 'label' => esc_html__( 'PRO', 'forminator' ),
16
+ 'class' => 'sui-tag sui-tag-sm sui-tag-purple',
17
  );
18
 
19
  if ( FORMINATOR_PRO ) {
44
  'data' => array(
45
  'action' => 'addons-install',
46
  'addons' => $addons->pid,
47
+ ),
48
  );
49
  } else {
50
  if ( ! is_plugin_active( $addons->filename ) ) {
103
 
104
  <div class="sui-col-md-6 addons-<?php echo esc_attr( $addons->pid ); ?>">
105
 
106
+ <div class="sui-box forminator-addon-card">
107
 
108
+ <div class="forminator-addon-card--body">
109
 
110
+ <?php if ( forminator_is_show_branding() ) : ?>
111
+ <div class="forminator-addon-card--body-left" aria-hidden="true">
112
+ <div class="forminator-addon-card--thumb" style="background-image: url(<?php echo esc_url( $addons->url->thumbnail ); ?>);"></div>
113
+ </div>
114
  <?php endif; ?>
115
 
116
+ <div class="forminator-addon-card--body-right">
117
+
118
+ <div class="forminator-addon-card--title">
119
+
120
+ <h3><?php echo esc_html( $addons->name ); ?></h3>
121
+
122
+ <div class="forminator-addon-card--tags">
123
+
124
+ <span class="<?php echo esc_attr( $tags['class'] ); ?>"><?php echo esc_html( $tags['label'] ); ?></span>
125
+
126
+ <?php if ( FORMINATOR_PRO && $addons->is_installed && $addons->has_update ) { ?>
127
+ <?php /* translators: Plugin latest version */ ?>
128
+ <span class="sui-tag sui-tag-yellow sui-tag-sm"><?php printf( esc_html__( 'v%s update available', 'forminator' ), esc_html( $addons->version_latest ) ); ?></span>
129
+ <?php } ?>
130
+
131
+ </div>
132
+
133
+ </div>
134
+
135
+ <p class="sui-description"><?php echo esc_html( $addons->info ); ?></p>
136
+
137
+ </div>
138
+
139
+ </div>
140
+
141
+ <div class="forminator-addon-card--footer">
142
+
143
+ <div class="forminator-addon-card--footer-left">
144
+
145
+ <a
146
+ role="button"
147
+ class="forminator-pseudo-link addons-page-details"
148
+ data-modal="addons_page_details"
149
+ data-form-id="<?php echo esc_attr( $addons->pid ); ?>"
150
+ data-modal-title="<?php echo esc_attr( $addons->name ); ?>"
151
+ data-nonce="<?php echo esc_attr( wp_create_nonce( 'forminator_addons_page_details' ) ); ?>"
152
+ >
153
+ <?php esc_html_e( 'Details', 'forminator' ); ?>
154
+ </a>
155
+
156
+ </div>
157
+
158
+ <div class="forminator-addon-card--footer-right">
159
+
160
+ <?php if ( FORMINATOR_PRO ) { ?>
161
+
162
+ <?php if ( $addons->is_installed ) { ?>
163
+
164
+ <?php
165
+ // BUTTON: Blue.
166
+ if ( $addons->has_update ) {
167
+ Forminator_Admin_Addons_page::get_instance()->render_template(
168
+ 'admin/views/addons/action-button',
169
+ array(
170
+ 'compound' => true,
171
+ 'label' => esc_html__( 'Update', 'forminator' ),
172
+ 'icon' => 'update',
173
+ 'color' => 'blue',
174
+ 'class' => 'addons-actions',
175
+ 'attrs' => array(
176
+ 'data-action' => 'addons-update',
177
+ 'data-addon' => esc_attr( $addons->pid ),
178
+ 'data-nonce' => esc_attr( wp_create_nonce( 'forminator_popup_addons_actions' ) ),
179
+ 'data-version' => sprintf( esc_html__( 'Version %s', 'forminator' ), esc_html( $addons->version_latest ) ),
180
+ ),
181
+ )
182
+ );
183
+ }
184
+
185
+ if ( is_plugin_active( $addons->filename ) ) {
186
+
187
+ // BUTTON: Configure.
188
+ Forminator_Admin_Addons_page::get_instance()->render_template(
189
+ 'admin/views/addons/action-button',
190
+ array(
191
+ 'compound' => true,
192
+ 'label' => esc_html__( 'Configure', 'forminator' ),
193
+ 'icon' => 'wrench-tool',
194
+ 'class' => 'addons-configure',
195
+ 'attrs' => array(
196
+ 'data-action' => esc_attr( $addons_slug . '-connect-modal' ),
197
+ 'data-addon' => esc_attr( $addons->pid ),
198
+ 'data-nonce' => esc_attr( wp_create_nonce( 'forminator_' . $addons_slug . '_settings_modal' ) ),
199
+ 'data-modal-nonce' => esc_attr( wp_create_nonce( 'forminator_' . $addons_slug . '_settings_modal' ) ),
200
+ 'data-modal-image' => esc_url( forminator_plugin_url() . 'assets/images/' . $addons_slug . '-logo.png' ),
201
+ 'data-modal-image-x2' => esc_url( forminator_plugin_url() . 'assets/images/' . $addons_slug . '-logo@2x.png' ),
202
+ 'data-modal-title' => esc_html( sprintf( __( 'Connect %s Account', 'forminator' ), ucfirst( $addons_slug ) ) ),
203
+ ),
204
+ )
205
+ );
206
+
207
+ // BUTTON: Deactivate.
208
+ Forminator_Admin_Addons_page::get_instance()->render_template(
209
+ 'admin/views/addons/action-button',
210
+ array(
211
+ 'compound' => true,
212
+ 'label' => ( $is_network_active ? __( 'Network Deactivate', 'forminator' ) : __( 'Deactivate', 'forminator' ) ),
213
+ 'icon' => 'power-on-off',
214
+ 'ghost' => true,
215
+ 'class' => 'wpmudev-open-modal',
216
+ 'attrs' => array(
217
+ 'data-action' => 'addons-deactivate',
218
+ 'data-addon' => esc_attr( $addons->pid ),
219
+ 'data-nonce' => esc_attr( wp_create_nonce( 'forminator_popup_addons_actions' ) ),
220
+ 'data-modal' => 'addons-deactivate',
221
+ 'data-modal-title' => esc_html__( 'Deactivate Add-ons', 'forminator' ),
222
+ 'data-modal-content' => sprintf( __( 'You are trying to deactivate <strong>%s</strong> which is being used by the following forms. This can break the functionality of the forms. Are you sure you want to proceed?', 'forminator' ), esc_html( $addons->name ) ),
223
+ 'data-addon-slug' => esc_attr( $addons_slug ),
224
+ ),
225
+ 'disabled' => ( $is_network_active ),
226
+ )
227
+ );
228
+ } else {
229
+
230
+ // BUTTON: Activate.
231
+ Forminator_Admin_Addons_page::get_instance()->render_template(
232
+ 'admin/views/addons/action-button',
233
+ array(
234
+ 'compound' => true,
235
+ 'label' => ( $is_network_active ? __( 'Network Activate', 'forminator' ) : __( 'Activate', 'forminator' ) ),
236
+ 'icon' => 'power-on-off',
237
+ 'color' => 'blue',
238
+ 'class' => 'addons-actions',
239
+ 'attrs' => array(
240
+ 'data-action' => 'addons-activate',
241
+ 'data-addon' => esc_attr( $addons->pid ),
242
+ 'data-nonce' => esc_attr( wp_create_nonce( 'forminator_popup_addons_actions' ) ),
243
+ ),
244
+ )
245
+ );
246
+
247
+ // BUTTON: Delete.
248
+ Forminator_Admin_Addons_page::get_instance()->render_template(
249
+ 'admin/views/addons/action-button',
250
+ array(
251
+ 'compound' => true,
252
+ 'label' => esc_html__( 'Delete', 'forminator' ),
253
+ 'icon' => 'trash',
254
+ 'ghost' => true,
255
+ 'class' => 'addons-actions',
256
+ 'attrs' => array(
257
+ 'data-action' => 'addons-delete',
258
+ 'data-addon' => esc_attr( $addons->pid ),
259
+ 'data-nonce' => esc_attr( wp_create_nonce( 'forminator_popup_addons_actions' ) ),
260
+ ),
261
+ )
262
+ );
263
+ }
264
+ ?>
265
+ <?php
266
+ } else {
267
+
268
+ Forminator_Admin_Addons_page::get_instance()->render_template(
269
+ 'admin/views/addons/action-button',
270
+ array(
271
+ 'label' => esc_html__( 'Install', 'forminator' ),
272
+ 'icon' => 'download',
273
+ 'color' => 'blue',
274
+ 'class' => 'addons-actions',
275
+ 'attrs' => array(
276
+ 'data-action' => 'addons-install',
277
+ 'data-addon' => esc_attr( $addons->pid ),
278
+ 'data-nonce' => esc_attr( wp_create_nonce( 'forminator_popup_addons_actions' ) ),
279
+ ),
280
+ )
281
+ );
282
+
283
+ }
284
+ ?>
285
+ <?php } else { ?>
286
+ <a
287
+ href="https://wpmudev.com/project/forminator-pro/?coupon=FORMINATOR-SUBSCRIPTIONS&checkout=0&utm_source=forminator&utm_medium=plugin&utm_campaign=forminator_stripe-addon"
288
+ target="_blank"
289
+ class="sui-button sui-button-purple"
290
+ >
291
+ <?php esc_html_e( 'Try Pro for 35% Off', 'forminator' ); ?>
292
+ </a>
293
+ <?php } ?>
294
+
295
+ </div>
296
+
297
+ </div>
298
+
299
+ </div>
300
 
301
  </div>
admin/views/addons/content-empty.php CHANGED
@@ -1,60 +1,61 @@
1
  <?php
2
- $can_browse = isset( $browse ) && is_bool( $browse ) === true;
3
  $can_refresh = isset( $refresh ) && is_bool( $refresh ) === true;
4
- $url_check = add_query_arg( 'action', 'check-updates' );
5
  ?>
6
 
7
  <div class="sui-box">
8
 
9
- <div class="sui-message">
10
-
11
- <?php if ( forminator_is_show_branding() ) : ?>
12
- <img
13
- src="<?php echo esc_url( forminator_plugin_url() . 'assets/images/forminator-smile.png' ); ?>"
14
- srcset="<?php echo esc_url( forminator_plugin_url() . 'assets/images/forminator-smile.png' ); ?> 1x, <?php echo esc_url( forminator_plugin_url() . 'assets/images/forminator-smile@2x.png' ); ?> 2x"
15
- alt="<?php esc_html_e( 'Forminator', 'forminator' ); ?>"
16
- class="sui-image"
17
- />
18
- <?php endif; ?>
19
-
20
- <div class="sui-message-content">
21
-
22
- <?php if ( isset( $title ) && '' !== trim( $title ) ) { ?>
23
- <h2><?php echo $title; ?></h2>
24
- <?php } ?>
25
-
26
- <?php if ( isset( $description ) && '' !== trim( $description ) ) { ?>
27
- <p><?php echo $description; ?></p>
28
- <?php } ?>
29
-
30
- <?php if ( $can_browse || $can_refresh ) { ?>
31
- <p>
32
- <?php
33
- // BUTTON: Browse Add-Ons.
34
- if ( $can_browse ) {
35
- Forminator_Admin_Addons_page::get_instance()->render_template(
36
- 'admin/views/addons/action-button',
37
- array(
38
- 'label' => esc_html__( 'Browse Add-Ons', 'forminator' ),
39
- )
40
- );
41
- }
42
-
43
- // BUTTON: Check Again.
44
- if ( $can_refresh ) { ?>
45
- <a href="<?php echo esc_url( $url_check ); ?>" class="sui-button sui-button-blue">
46
- <span class="sui-loading-text">
47
- <span class="sui-icon-refresh" aria-hidden="true"></span>
48
- <?php esc_html_e( 'Check Again', 'forminator' ); ?>
49
- </span>
50
- <span class="sui-icon-loader sui-loading" aria-hidden="true"></span>
51
- </a>
52
- <?php } ?>
53
- </p>
54
- <?php } ?>
55
-
56
- </div>
57
-
58
- </div>
59
-
60
- </div>
 
1
  <?php
2
+ $can_browse = isset( $browse ) && is_bool( $browse ) === true;
3
  $can_refresh = isset( $refresh ) && is_bool( $refresh ) === true;
4
+ $url_check = add_query_arg( 'action', 'check-updates' );
5
  ?>
6
 
7
  <div class="sui-box">
8
 
9
+ <div class="sui-message">
10
+
11
+ <?php if ( forminator_is_show_branding() ) : ?>
12
+ <img
13
+ src="<?php echo esc_url( forminator_plugin_url() . 'assets/images/forminator-smile.png' ); ?>"
14
+ srcset="<?php echo esc_url( forminator_plugin_url() . 'assets/images/forminator-smile.png' ); ?> 1x, <?php echo esc_url( forminator_plugin_url() . 'assets/images/forminator-smile@2x.png' ); ?> 2x"
15
+ alt="<?php esc_html_e( 'Forminator', 'forminator' ); ?>"
16
+ class="sui-image"
17
+ />
18
+ <?php endif; ?>
19
+
20
+ <div class="sui-message-content">
21
+
22
+ <?php if ( isset( $title ) && '' !== trim( $title ) ) { ?>
23
+ <h2><?php echo esc_html( $title ); ?></h2>
24
+ <?php } ?>
25
+
26
+ <?php if ( isset( $description ) && '' !== trim( $description ) ) { ?>
27
+ <p><?php echo esc_html( $description ); ?></p>
28
+ <?php } ?>
29
+
30
+ <?php if ( $can_browse || $can_refresh ) { ?>
31
+ <p>
32
+ <?php
33
+ // BUTTON: Browse Add-Ons.
34
+ if ( $can_browse ) {
35
+ Forminator_Admin_Addons_page::get_instance()->render_template(
36
+ 'admin/views/addons/action-button',
37
+ array(
38
+ 'label' => esc_html__( 'Browse Add-Ons', 'forminator' ),
39
+ )
40
+ );
41
+ }
42
+
43
+ // BUTTON: Check Again.
44
+ if ( $can_refresh ) {
45
+ ?>
46
+ <a href="<?php echo esc_url( $url_check ); ?>" class="sui-button sui-button-blue">
47
+ <span class="sui-loading-text">
48
+ <span class="sui-icon-refresh" aria-hidden="true"></span>
49
+ <?php esc_html_e( 'Check Again', 'forminator' ); ?>
50
+ </span>
51
+ <span class="sui-icon-loader sui-loading" aria-hidden="true"></span>
52
+ </a>
53
+ <?php } ?>
54
+ </p>
55
+ <?php } ?>
56
+
57
+ </div>
58
+
59
+ </div>
60
+
61
+ </div>
admin/views/addons/content.php CHANGED
@@ -5,201 +5,209 @@ $projects = $this->get_addons_by_action();
5
 
6
  <div id="forminator-addons" class="sui-tabs">
7
 
8
- <div role="tablist" class="sui-tabs-menu">
9
-
10
- <button
11
- type="button"
12
- role="tab"
13
- id="all-addons"
14
- class="sui-tab-item active"
15
- aria-controls="all-addons-content"
16
- aria-selected="true"
17
- >
18
  <?php esc_html_e( 'All', 'forminator' ); ?>
19
- </button>
20
-
21
- <?php
22
- // !!! WARNING
23
- // Enable when there are more than 2 add-ons.
24
- //
25
- // <button
26
- // type="button"
27
- // role="tab"
28
- // id="installed-addons"
29
- // class="sui-tab-item"
30
- // aria-controls="installed-addons-content"
31
- // aria-selected="false"
32
- // tabindex="-1"
33
- // >
34
- // Installed
35
- // </button>
36
-
37
- // <button
38
- // type="button"
39
- // role="tab"
40
- // id="available-addons"
41
- // class="sui-tab-item"
42
- // aria-controls="available-addons-content"
43
- // aria-selected="false"
44
- // tabindex="-1"
45
- // >
46
- // Available
47
- // </button>
48
- ?>
49
-
50
- <button
51
- type="button"
52
- role="tab"
53
- id="updates-addons"
54
- class="sui-tab-item"
55
- aria-controls="updates-addons-content"
56
- aria-selected="false"
57
- tabindex="-1"
58
- >
59
  <?php esc_html_e( 'Updates', 'forminator' ); ?>
60
- <?php if ( 0 === count( $projects['update'] ) ) { ?>
61
- <span class="sui-tag sui-tag-sm" style="pointer-events: none;"><?php echo esc_html( count( $projects['update'] ) ); ?></span>
62
- <?php } else { ?>
63
- <span class="sui-tag sui-tag-yellow sui-tag-sm" style="pointer-events: none;"><?php echo esc_html( count( $projects['update'] ) ); ?></span>
64
- <?php } ?>
65
- </button>
66
-
67
- <?php
68
- // !!! WARNING
69
- // Enable when there are more than 2 add-ons.
70
- //
71
- // <div class="sui-tab-search">
72
- // <div class="sui-control-with-icon">
73
- // <input
74
- // class="sui-form-control"
75
- // placeholder="Search"
76
- // />
77
- // <span class="sui-icon-magnifying-glass-search" aria-hidden="true"></span>
78
- // </div>
79
- // </div>
80
- ?>
81
-
82
- </div>
83
-
84
- <div class="sui-tabs-content">
85
-
86
- <div
87
- role="tabpanel"
88
- tabindex="0"
89
- id="all-addons-content"
90
- class="sui-tab-content active"
91
- aria-labelledby="all-addons"
92
- >
93
-
94
- <?php if ( empty( $projects['all'] ) ) {
95
- Forminator_Admin_Addons_page::get_instance()->render_template(
96
- 'admin/views/addons/content-empty',
97
- array(
98
- 'title' => esc_html__( 'No Add-Ons', 'forminator' ),
99
- 'description' => esc_html__( 'We couldn\'t find any add-on listed. Perhaps refresh the page and try again?', 'forminator' )
100
- )
101
- );
102
- } else { ?>
103
-
104
- <div class="sui-row">
105
-
106
- <?php foreach ( $projects['all'] as $idx => $addons ) {
107
- if ( ! empty( $addons ) ) {
108
- $idx ++;
109
-
110
- Forminator_Admin_Addons_page::get_instance()->addons_render( 'addons-list', $addons->pid, $addons );
111
-
112
- // !!! WARNING
113
- // Enable when there are more than 2 add-ons.
114
- //
115
- // Close current row and open a new one.
116
- // if ( 0 === $idx % 2 ) :
117
- // echo '</div><div class="sui-row">';
118
- // endif;
119
- }
120
- } ?>
121
-
122
- </div>
123
-
124
- <?php } ?>
125
-
126
- </div>
127
-
128
- <?php
129
- // !!! WARNING
130
- // Enable when there are more than 2 add-ons.
131
- //
132
- // <div
133
- // role="tabpanel"
134
- // tabindex="0"
135
- // id="installed-addons-content"
136
- // class="sui-tab-content"
137
- // aria-labelledby="installed-addons"
138
- // hidden
139
- // >Installed Add-ons</div>
140
-
141
- // <div
142
- // role="tabpanel"
143
- // tabindex="0"
144
- // id="available-addons-content"
145
- // class="sui-tab-content"
146
- // aria-labelledby="available-addons"
147
- // >Available Add-ons</div>
148
- ?>
149
-
150
- <div
151
- role="tabpanel"
152
- tabindex="0"
153
- id="updates-addons-content"
154
- class="sui-tab-content"
155
- aria-labelledby="updates-addons"
156
- >
157
-
158
- <?php if ( empty( $projects['update'] ) ) {
159
- Forminator_Admin_Addons_page::get_instance()->render_template(
160
- 'admin/views/addons/content-empty',
161
- array(
162
- 'title' => sprintf( esc_html__( 'All good, %s!', 'forminator' ), $current_user->display_name ),
163
- 'description' => esc_html__( 'No add-ons require an update at this time. Use the button below to check again.', 'forminator' ),
164
- 'refresh' => true,
165
- )
166
- );
167
- } else { ?>
168
-
169
- <div class="sui-row">
170
-
171
- <?php foreach ( $projects['update'] as $idx => $addons ) {
172
- if ( ! empty( $addons ) ) {
173
- $idx ++;
174
- Forminator_Admin_Addons_page::get_instance()->addons_render( 'addons-list', $addons->pid, $addons );
175
-
176
- // !!! WARNING
177
- // Enable when there are more than 2 add-ons.
178
- //
179
- // Close current row and open a new one.
180
- // if ( 0 === $idx % 2 ) :
181
- // echo '</div><div class="sui-row">';
182
- // endif;
183
- }
184
- } ?>
185
-
186
- </div>
187
-
188
- <?php } ?>
189
-
190
- </div>
191
-
192
- </div>
 
 
 
 
 
 
 
 
193
 
194
  </div>
195
 
196
  <?php
197
  if ( ! empty( $projects['all'] ) ) {
198
- foreach ( $projects['all'] as $slug => $addons ) {
199
- if ( ! empty( $addons ) ) {
200
- Forminator_Admin_Addons_page::get_instance()->addons_render( 'addons-activate-popup', $addons->pid, $addons );
201
- Forminator_Admin_Addons_page::get_instance()->addons_render( 'addon-details', $addons->pid, $addons );
202
- }
203
- }
204
  }
205
  ?>
5
 
6
  <div id="forminator-addons" class="sui-tabs">
7
 
8
+ <div role="tablist" class="sui-tabs-menu">
9
+
10
+ <button
11
+ type="button"
12
+ role="tab"
13
+ id="all-addons"
14
+ class="sui-tab-item active"
15
+ aria-controls="all-addons-content"
16
+ aria-selected="true"
17
+ >
18
  <?php esc_html_e( 'All', 'forminator' ); ?>
19
+ </button>
20
+
21
+ <?php
22
+ // !!! WARNING.
23
+ // Enable when there are more than 2 add-ons.
24
+ //
25
+ // <button.
26
+ // type="button".
27
+ // role="tab".
28
+ // id="installed-addons".
29
+ // class="sui-tab-item".
30
+ // aria-controls="installed-addons-content".
31
+ // aria-selected="false".
32
+ // tabindex="-1".
33
+ // >
34
+ // Installed.
35
+ // </button>.
36
+
37
+ // <button.
38
+ // type="button".
39
+ // role="tab".
40
+ // id="available-addons".
41
+ // class="sui-tab-item".
42
+ // aria-controls="available-addons-content".
43
+ // aria-selected="false".
44
+ // tabindex="-1".
45
+ // >
46
+ // Available.
47
+ // </button>.
48
+ ?>
49
+
50
+ <button
51
+ type="button"
52
+ role="tab"
53
+ id="updates-addons"
54
+ class="sui-tab-item"
55
+ aria-controls="updates-addons-content"
56
+ aria-selected="false"
57
+ tabindex="-1"
58
+ >
59
  <?php esc_html_e( 'Updates', 'forminator' ); ?>
60
+ <?php if ( 0 === count( $projects['update'] ) ) { ?>
61
+ <span class="sui-tag sui-tag-sm" style="pointer-events: none;"><?php echo esc_html( count( $projects['update'] ) ); ?></span>
62
+ <?php } else { ?>
63
+ <span class="sui-tag sui-tag-yellow sui-tag-sm" style="pointer-events: none;"><?php echo esc_html( count( $projects['update'] ) ); ?></span>
64
+ <?php } ?>
65
+ </button>
66
+
67
+ <?php
68
+ // !!! WARNING.
69
+ // Enable when there are more than 2 add-ons.
70
+ //
71
+ // <div class="sui-tab-search">.
72
+ // <div class="sui-control-with-icon">.
73
+ // <input.
74
+ // class="sui-form-control".
75
+ // placeholder="Search".
76
+ // >
77
+ // <span class="sui-icon-magnifying-glass-search" aria-hidden="true"></span>.
78
+ // </div>.
79
+ // </div>.
80
+ ?>
81
+
82
+ </div>
83
+
84
+ <div class="sui-tabs-content">
85
+
86
+ <div
87
+ role="tabpanel"
88
+ tabindex="0"
89
+ id="all-addons-content"
90
+ class="sui-tab-content active"
91
+ aria-labelledby="all-addons"
92
+ >
93
+
94
+ <?php
95
+ if ( empty( $projects['all'] ) ) {
96
+ Forminator_Admin_Addons_page::get_instance()->render_template(
97
+ 'admin/views/addons/content-empty',
98
+ array(
99
+ 'title' => esc_html__( 'No Add-Ons', 'forminator' ),
100
+ 'description' => esc_html__( 'We couldn\'t find any add-on listed. Perhaps refresh the page and try again?', 'forminator' ),
101
+ )
102
+ );
103
+ } else {
104
+ ?>
105
+
106
+ <div class="sui-row">
107
+
108
+ <?php
109
+ foreach ( $projects['all'] as $idx => $addons ) {
110
+ if ( ! empty( $addons ) ) {
111
+ $idx ++;
112
+
113
+ Forminator_Admin_Addons_page::get_instance()->addons_render( 'addons-list', $addons->pid, $addons );
114
+
115
+ // !!! WARNING.
116
+ // Enable when there are more than 2 add-ons.
117
+ //
118
+ // Close current row and open a new one.
119
+ // if ( 0 === $idx % 2 ) :.
120
+ // echo '</div><div class="sui-row">';.
121
+ // endif;.
122
+ }
123
+ }
124
+ ?>
125
+
126
+ </div>
127
+
128
+ <?php } ?>
129
+
130
+ </div>
131
+
132
+ <?php
133
+ // !!! WARNING.
134
+ // Enable when there are more than 2 add-ons.
135
+ //
136
+ // <div.
137
+ // role="tabpanel".
138
+ // tabindex="0".
139
+ // id="installed-addons-content".
140
+ // class="sui-tab-content".
141
+ // aria-labelledby="installed-addons".
142
+ // hidden.
143
+ // >Installed Add-ons</div>.
144
+
145
+ // <div.
146
+ // role="tabpanel".
147
+ // tabindex="0".
148
+ // id="available-addons-content".
149
+ // class="sui-tab-content".
150
+ // aria-labelledby="available-addons".
151
+ // >Available Add-ons</div>.
152
+ ?>
153
+
154
+ <div
155
+ role="tabpanel"
156
+ tabindex="0"
157
+ id="updates-addons-content"
158
+ class="sui-tab-content"
159
+ aria-labelledby="updates-addons"
160
+ >
161
+
162
+ <?php
163
+ if ( empty( $projects['update'] ) ) {
164
+ Forminator_Admin_Addons_page::get_instance()->render_template(
165
+ 'admin/views/addons/content-empty',
166
+ array(
167
+ 'title' => sprintf( esc_html__( 'All good, %s!', 'forminator' ), $current_user->display_name ),
168
+ 'description' => esc_html__( 'No add-ons require an update at this time. Use the button below to check again.', 'forminator' ),
169
+ 'refresh' => true,
170
+ )
171
+ );
172
+ } else {
173
+ ?>
174
+
175
+ <div class="sui-row">
176
+
177
+ <?php
178
+ foreach ( $projects['update'] as $idx => $addons ) {
179
+ if ( ! empty( $addons ) ) {
180
+ $idx ++;
181
+ Forminator_Admin_Addons_page::get_instance()->addons_render( 'addons-list', $addons->pid, $addons );
182
+
183
+ // !!! WARNING.
184
+ // Enable when there are more than 2 add-ons.
185
+ //
186
+ // Close current row and open a new one.
187
+ // if ( 0 === $idx % 2 ) :.
188
+ // echo '</div><div class="sui-row">';.
189
+ // endif;.
190
+ }
191
+ }
192
+ ?>
193
+
194
+ </div>
195
+
196
+ <?php } ?>
197
+
198
+ </div>
199
+
200
+ </div>
201
 
202
  </div>
203
 
204
  <?php
205
  if ( ! empty( $projects['all'] ) ) {
206
+ foreach ( $projects['all'] as $slug => $addons ) {
207
+ if ( ! empty( $addons ) ) {
208
+ Forminator_Admin_Addons_page::get_instance()->addons_render( 'addons-activate-popup', $addons->pid, $addons );
209
+ Forminator_Admin_Addons_page::get_instance()->addons_render( 'addon-details', $addons->pid, $addons );
210
+ }
211
+ }
212
  }
213
  ?>
admin/views/addons/header.php CHANGED
@@ -10,4 +10,4 @@
10
  </div>
11
  <?php endif; ?>
12
 
13
- </div>
10
  </div>
11
  <?php endif; ?>
12
 
13
+ </div>
admin/views/common/dashboard/widget.php CHANGED
@@ -23,7 +23,7 @@ if ( 0 === $num_recent ) {
23
  }
24
 
25
  $method = 'get_' . forminator_get_prefix( $module_slug, '', false, true );
26
- $modules = Forminator_API::$method( null, 1, $num_recent, $statuses );
27
  ?>
28
 
29
  <div class="sui-box">
@@ -69,11 +69,11 @@ $modules = Forminator_API::$method( null, 1, $num_recent, $statuses );
69
  <tbody>
70
 
71
  <?php
72
- foreach ( $modules as $index => $module ) {
73
- $module = (array) $module;
74
- $module['name'] = forminator_get_form_name( $module['id'] );
75
- $page = ceil( ( $index + 1 ) / $_per_page );
76
- ?>
77
 
78
  <tr>
79
 
@@ -81,18 +81,18 @@ $modules = Forminator_API::$method( null, 1, $num_recent, $statuses );
81
 
82
  <td class="fui-col-status">
83
 
84
- <?php
85
- if ( 'publish' === $module['status'] ) {
86
- $status_class = 'published';
87
- $status_text = esc_html__( 'Published', 'forminator' );
88
- } else {
89
- $status_class = 'draft';
90
- $status_text = esc_html__( 'Draft', 'forminator' );
91
- }
92
- // For Quizzes.
93
- $has_leads = isset( $module['has_leads'] ) ? $module['has_leads'] : false;
94
- $leads_id = isset( $module['leads_id'] ) ? $module['leads_id'] : 0;
95
- ?>
96
 
97
  <span
98
  class="sui-status-dot sui-<?php echo esc_html( $status_class ); ?> sui-tooltip"
@@ -117,7 +117,7 @@ $modules = Forminator_API::$method( null, 1, $num_recent, $statuses );
117
 
118
  <ul>
119
  <li>
120
- <?php $wizard_page_prefix = 'quiz' !== $module_type ? $module_type : ( 'nowrong' === $module['quiz_type'] ? $module['quiz_type'] : 'knowledge' ); ?>
121
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=forminator-' . $wizard_page_prefix . '-wizard&id=' . $module['id'] ) ); ?>">
122
  <i class="sui-icon-pencil" aria-hidden="true"></i> <?php esc_html_e( 'Edit', 'forminator' ); ?>
123
  </a>
@@ -125,7 +125,7 @@ $modules = Forminator_API::$method( null, 1, $num_recent, $statuses );
125
 
126
  <li><button class="wpmudev-open-modal"
127
  data-modal="<?php echo esc_attr( $preview_dialog ); ?>"
128
- data-modal-title="<?php echo sprintf( '%s - %s', esc_html( $preview_title ), htmlspecialchars( htmlspecialchars( $module['name'] ) ) ); // phpcs:ignore ?>"
129
  data-nonce-preview="<?php echo esc_attr( wp_create_nonce( 'forminator_load_module' ) ); ?>"
130
  data-form-id="<?php echo esc_attr( $module['id'] ); ?>"
131
  data-has-leads="<?php echo esc_attr( $has_leads ); ?>"
@@ -144,17 +144,17 @@ $modules = Forminator_API::$method( null, 1, $num_recent, $statuses );
144
  <input type="hidden" name="forminator_action" value="clone">
145
  <input type="hidden" name="form_type" value="<?php echo esc_attr( forminator_get_prefix( $module_slug, 'custom-' ) ); ?>">
146
  <input type="hidden" name="id" value="<?php echo esc_attr( $module['id'] ); ?>"/>
147
- <?php
148
- $clone_nonce = esc_attr( 'forminator-nonce-clone-' . $module['id'] );
149
- wp_nonce_field( $clone_nonce, 'forminatorNonce' );
150
- ?>
151
- <?php if ( $has_leads ): ?>
152
  <button type="submit" disabled="disabled" class="fui-button-with-tag sui-tooltip sui-tooltip-left sui-constrained" data-tooltip="<?php esc_html_e( 'Duplicate isn\'t supported at the moment for the quizzes with lead capturing enabled.', 'forminator' ); ?>">
153
  <span class="sui-icon-page-multiple" aria-hidden="true"></span>
154
  <span class="fui-button-label"><?php esc_html_e( 'Duplicate', 'forminator' ); ?></span>
155
  <span class="sui-tag sui-tag-blue sui-tag-sm"><?php echo esc_html__( 'Coming soon', 'forminator' ); ?></span>
156
  </button>
157
- <?php else: ?>
158
  <button type="submit">
159
  <i class="sui-icon-page-multiple" aria-hidden="true"></i> <?php esc_html_e( 'Duplicate', 'forminator' ); ?>
160
  </button>
@@ -163,14 +163,14 @@ $modules = Forminator_API::$method( null, 1, $num_recent, $statuses );
163
 
164
  <?php if ( Forminator::is_import_export_feature_enabled() ) : ?>
165
 
166
- <?php if ( $has_leads ): ?>
167
  <li aria-hidden="true"><a href="#" class="fui-button-with-tag sui-tooltip sui-tooltip-left"
168
  data-tooltip="<?php esc_html_e( 'Export isn\'t supported at the moment for the quizzes with lead capturing enabled.', 'forminator' ); ?>">
169
  <span class="sui-icon-cloud-migration" aria-hidden="true"></span>
170
  <span class="fui-button-label"><?php esc_html_e( 'Export', 'forminator' ); ?></span>
171
  <span class="sui-tag sui-tag-blue sui-tag-sm"><?php echo esc_html__( 'Coming soon', 'forminator' ); ?></span>
172
  </a></li>
173
- <?php else: ?>
174
  <li><a href="#"
175
  class="wpmudev-open-modal"
176
  data-modal="<?php echo esc_attr( $export_dialog ); ?>"
@@ -216,11 +216,11 @@ $modules = Forminator_API::$method( null, 1, $num_recent, $statuses );
216
  </button>
217
 
218
  <div class="sui-actions-right">
219
- <p class="sui-description"><a href="<?php echo admin_url( 'admin.php?page=forminator-' . $module_type ); // phpcs:ignore ?>" class="sui-link-gray"><?php echo esc_html( $view_all ); ?></a></p>
220
  </div>
221
 
222
  </div>
223
 
224
  <?php } ?>
225
 
226
- </div>
23
  }
24
 
25
  $method = 'get_' . forminator_get_prefix( $module_slug, '', false, true );
26
+ $modules = Forminator_API::$method( null, 1, $num_recent, $statuses );
27
  ?>
28
 
29
  <div class="sui-box">
69
  <tbody>
70
 
71
  <?php
72
+ foreach ( $modules as $index => $module ) {
73
+ $module = (array) $module;
74
+ $module['name'] = forminator_get_form_name( $module['id'] );
75
+ $page = ceil( ( $index + 1 ) / $_per_page );
76
+ ?>
77
 
78
  <tr>
79
 
81
 
82
  <td class="fui-col-status">
83
 
84
+ <?php
85
+ if ( 'publish' === $module['status'] ) {
86
+ $status_class = 'published';
87
+ $status_text = esc_html__( 'Published', 'forminator' );
88
+ } else {
89
+ $status_class = 'draft';
90
+ $status_text = esc_html__( 'Draft', 'forminator' );
91
+ }
92
+ // For Quizzes.
93
+ $has_leads = isset( $module['has_leads'] ) ? $module['has_leads'] : false;
94
+ $leads_id = isset( $module['leads_id'] ) ? $module['leads_id'] : 0;
95
+ ?>
96
 
97
  <span
98
  class="sui-status-dot sui-<?php echo esc_html( $status_class ); ?> sui-tooltip"
117
 
118
  <ul>
119
  <li>
120
+ <?php $wizard_page_prefix = 'quiz' !== $module_type ? $module_type : ( 'nowrong' === $module['quiz_type'] ? $module['quiz_type'] : 'knowledge' ); ?>
121
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=forminator-' . $wizard_page_prefix . '-wizard&id=' . $module['id'] ) ); ?>">
122
  <i class="sui-icon-pencil" aria-hidden="true"></i> <?php esc_html_e( 'Edit', 'forminator' ); ?>
123
  </a>
125
 
126
  <li><button class="wpmudev-open-modal"
127
  data-modal="<?php echo esc_attr( $preview_dialog ); ?>"
128
+ data-modal-title="<?php echo sprintf( '%s - %s', esc_html( $preview_title ), esc_attr( htmlspecialchars( htmlspecialchars( $module['name'] ) ) ) ); ?>"
129
  data-nonce-preview="<?php echo esc_attr( wp_create_nonce( 'forminator_load_module' ) ); ?>"
130
  data-form-id="<?php echo esc_attr( $module['id'] ); ?>"
131
  data-has-leads="<?php echo esc_attr( $has_leads ); ?>"
144
  <input type="hidden" name="forminator_action" value="clone">
145
  <input type="hidden" name="form_type" value="<?php echo esc_attr( forminator_get_prefix( $module_slug, 'custom-' ) ); ?>">
146
  <input type="hidden" name="id" value="<?php echo esc_attr( $module['id'] ); ?>"/>
147
+ <?php
148
+ $clone_nonce = esc_attr( 'forminator-nonce-clone-' . $module['id'] );
149
+ wp_nonce_field( $clone_nonce, 'forminatorNonce' );
150
+ ?>
151
+ <?php if ( $has_leads ) : ?>
152
  <button type="submit" disabled="disabled" class="fui-button-with-tag sui-tooltip sui-tooltip-left sui-constrained" data-tooltip="<?php esc_html_e( 'Duplicate isn\'t supported at the moment for the quizzes with lead capturing enabled.', 'forminator' ); ?>">
153
  <span class="sui-icon-page-multiple" aria-hidden="true"></span>
154
  <span class="fui-button-label"><?php esc_html_e( 'Duplicate', 'forminator' ); ?></span>
155
  <span class="sui-tag sui-tag-blue sui-tag-sm"><?php echo esc_html__( 'Coming soon', 'forminator' ); ?></span>
156
  </button>
157
+ <?php else : ?>
158
  <button type="submit">
159
  <i class="sui-icon-page-multiple" aria-hidden="true"></i> <?php esc_html_e( 'Duplicate', 'forminator' ); ?>
160
  </button>
163
 
164
  <?php if ( Forminator::is_import_export_feature_enabled() ) : ?>
165
 
166
+ <?php if ( $has_leads ) : ?>
167
  <li aria-hidden="true"><a href="#" class="fui-button-with-tag sui-tooltip sui-tooltip-left"
168
  data-tooltip="<?php esc_html_e( 'Export isn\'t supported at the moment for the quizzes with lead capturing enabled.', 'forminator' ); ?>">
169
  <span class="sui-icon-cloud-migration" aria-hidden="true"></span>
170
  <span class="fui-button-label"><?php esc_html_e( 'Export', 'forminator' ); ?></span>
171
  <span class="sui-tag sui-tag-blue sui-tag-sm"><?php echo esc_html__( 'Coming soon', 'forminator' ); ?></span>
172
  </a></li>
173
+ <?php else : ?>
174
  <li><a href="#"
175
  class="wpmudev-open-modal"
176
  data-modal="<?php echo esc_attr( $export_dialog ); ?>"
216
  </button>
217
 
218
  <div class="sui-actions-right">
219
+ <p class="sui-description"><a href="<?php echo esc_url( admin_url( 'admin.php?page=forminator-' . $module_type ) ); ?>" class="sui-link-gray"><?php echo esc_html( $view_all ); ?></a></p>
220
  </div>
221
 
222
  </div>
223
 
224
  <?php } ?>
225
 
226
+ </div>
admin/views/common/entries/active_filters_row.php CHANGED
@@ -91,4 +91,4 @@
91
 
92
  </div>
93
 
94
- </div>
91
 
92
  </div>
93
 
94
+ </div>
admin/views/common/entries/content-none.php CHANGED
@@ -1,15 +1,14 @@
1
  <?php
2
  $none_title = esc_html__( 'Submissions', 'forminator' );
3
  $none_text = esc_html__( 'You haven’t received any form, poll or quiz submissions yet. When you do, you’ll be able to view all the data here.', 'forminator' );
4
-
5
- if ( isset( $_GET[ 'form_id' ] ) ) {
6
-
7
- $none_title = esc_html( forminator_get_form_name( $_GET[ 'form_id' ] ) );
8
- $none_text = sprintf(
9
- esc_html__( 'You haven’t received any submissions for this %s yet. When you do, you’ll be able to view all the data here.', 'forminator' ),
10
- esc_html( forminator_get_form_type_helper( true ) )
11
- );
12
- }
13
  ?>
14
  <div class="sui-box sui-message">
15
 
1
  <?php
2
  $none_title = esc_html__( 'Submissions', 'forminator' );
3
  $none_text = esc_html__( 'You haven’t received any form, poll or quiz submissions yet. When you do, you’ll be able to view all the data here.', 'forminator' );
4
+ $form_id = filter_input( INPUT_GET, 'form_id', FILTER_VALIDATE_INT );
5
+ if ( $form_id ) {
6
+ $none_title = esc_html( forminator_get_form_name( $form_id ) );
7
+ $none_text = sprintf(
8
+ esc_html__( 'You haven’t received any submissions for this %s yet. When you do, you’ll be able to view all the data here.', 'forminator' ),
9
+ esc_html( forminator_get_form_type_helper( true ) )
10
+ );
11
+ }
 
12
  ?>
13
  <div class="sui-box sui-message">
14
 
admin/views/common/entries/content.php CHANGED
@@ -1,22 +1,21 @@
1
  <?php
2
  $count = Forminator_Form_Entry_Model::count_all_entries();
3
- ?>
4
 
5
- <?php if ( $count > 0 ) { ?>
 
6
 
7
- <?php
8
- $markup = $this->render_entries();
9
-
10
- if ( ! empty( $_GET[ 'form_type' ] ) ) {
11
- update_option( 'forminator_submissions_form_type', sanitize_text_field( $_GET[ 'form_type' ] ) );
12
- }
13
- if ( ! empty( $_GET[ 'form_id' ] ) ) {
14
- update_option( 'forminator_submissions_form_id', sanitize_text_field( $_GET[ 'form_id' ] ) );
15
- }
16
-
17
- $form_type = get_option( 'forminator_submissions_form_type' );
18
- $form_id = get_option( 'forminator_submissions_form_id' );
19
- ?>
20
 
21
  <form method="get"
22
  name="bulk-action-form"
@@ -34,13 +33,13 @@ $count = Forminator_Form_Entry_Model::count_all_entries();
34
  class="sui-select-sm"
35
  >
36
 
37
- <?php foreach ( $this->get_form_types() as $post_type => $name ) { // phpcs:ignore ?>
38
- <option value="<?php echo esc_attr( $post_type ); ?>" <?php echo selected( $post_type, $form_type ); ?>><?php echo esc_html( $name ); ?></option>
39
  <?php } ?>
40
 
41
  </select>
42
 
43
- <?php echo $this->render_form_switcher( $form_type, $form_id ); // phpcs:ignore ?>
44
 
45
  </div>
46
 
@@ -56,7 +55,7 @@ $count = Forminator_Form_Entry_Model::count_all_entries();
56
 
57
  <?php if ( $markup ) : ?>
58
 
59
- <?php echo $markup; // phpcs:ignore ?>
60
 
61
  <?php else : ?>
62
 
1
  <?php
2
  $count = Forminator_Form_Entry_Model::count_all_entries();
 
3
 
4
+ if ( $count > 0 ) {
5
+ $markup = $this->render_entries();
6
 
7
+ $form_type = Forminator_Core::sanitize_text_field( 'form_type' );
8
+ if ( $form_type ) {
9
+ update_option( 'forminator_submissions_form_type', $form_type );
10
+ }
11
+ $form_id = filter_input( INPUT_GET, 'form_id', FILTER_VALIDATE_INT );
12
+ if ( $form_id ) {
13
+ update_option( 'forminator_submissions_form_id', $form_id );
14
+ }
15
+
16
+ $form_type = get_option( 'forminator_submissions_form_type' );
17
+ $form_id = get_option( 'forminator_submissions_form_id' );
18
+ ?>
 
19
 
20
  <form method="get"
21
  name="bulk-action-form"
33
  class="sui-select-sm"
34
  >
35
 
36
+ <?php foreach ( $this->get_form_types() as $_post_type => $name ) { ?>
37
+ <option value="<?php echo esc_attr( $_post_type ); ?>" <?php echo selected( $_post_type, $form_type ); ?>><?php echo esc_html( $name ); ?></option>
38
  <?php } ?>
39
 
40
  </select>
41
 
42
+ <?php $this->render_form_switcher( $form_type, $form_id ); ?>
43
 
44
  </div>
45
 
55
 
56
  <?php if ( $markup ) : ?>
57
 
58
+ <?php echo $markup; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
59
 
60
  <?php else : ?>
61
 
admin/views/common/entries/filter.php CHANGED
@@ -9,8 +9,8 @@ $count = $this->filtered_total_entries();
9
  $date_range = '';
10
  $date_created = isset( $this->filters['date_created'] ) ? $this->filters['date_created'] : '';
11
  if ( is_array( $date_created ) && isset( $date_created[0] ) && isset( $date_created[1] ) ) {
12
- $date_created[0] = date( 'm/d/Y', strtotime( $date_created[0] ) );// phpcs:ignore
13
- $date_created[1] = date( 'm/d/Y', strtotime( $date_created[1] ) );// phpcs:ignore
14
  $date_range = implode( ' - ', $date_created );
15
  }
16
  $search_filter = isset( $this->filters['search'] ) ? $this->filters['search'] : '';
@@ -125,7 +125,7 @@ $is_registration = ! empty( $args['is_registration'] );
125
 
126
  <label for="forminator-forms-filter--sort-by" class="sui-label"><?php esc_html_e( 'Sort by', 'forminator' ); ?></label>
127
  <select id="forminator-forms-filter--sort-by" name="order_by">
128
- <!-- <option value="">--><?php //esc_html_e( 'ID', 'forminator' ); ?><!--</option>-->
129
  <option value="entries.date_created" <?php selected( 'entries.date_created', $order_by ); ?> ><?php esc_html_e( 'Submissions Date', 'forminator' ); ?></option>
130
  </select>
131
 
9
  $date_range = '';
10
  $date_created = isset( $this->filters['date_created'] ) ? $this->filters['date_created'] : '';
11
  if ( is_array( $date_created ) && isset( $date_created[0] ) && isset( $date_created[1] ) ) {
12
+ $date_created[0] = date( 'm/d/Y', strtotime( $date_created[0] ) );
13
+ $date_created[1] = date( 'm/d/Y', strtotime( $date_created[1] ) );
14
  $date_range = implode( ' - ', $date_created );
15
  }
16
  $search_filter = isset( $this->filters['search'] ) ? $this->filters['search'] : '';
125
 
126
  <label for="forminator-forms-filter--sort-by" class="sui-label"><?php esc_html_e( 'Sort by', 'forminator' ); ?></label>
127
  <select id="forminator-forms-filter--sort-by" name="order_by">
128
+ <!-- <option value="">--><?php // esc_html_e( 'ID', 'forminator' ); ?><!--</option>-->
129
  <option value="entries.date_created" <?php selected( 'entries.date_created', $order_by ); ?> ><?php esc_html_e( 'Submissions Date', 'forminator' ); ?></option>
130
  </select>
131
 
admin/views/common/entries/prompt.php CHANGED
@@ -17,9 +17,9 @@ if ( ! FORMINATOR_PRO ) {
17
  <?php
18
  if ( empty( $args['notice'] ) ) {
19
  $milestone = ( 100 >= $submission ) ? $min_submissions : 100;
20
- printf( esc_html__( "Hey, we noticed you just crossed %1\$s submissions%2\$s on this %3\$s - that's awesome! We have spent countless hours developing this free plugin for you, and we would really appreciate it if you could drop us a rating on wp.org to help us spread the word and boost our motivation.", 'forminator' ), '<strong> ' . $milestone, '</strong>', static::$module_slug );
21
  } else {
22
- echo $args['notice'];
23
  }
24
  ?>
25
  </p>
@@ -39,7 +39,7 @@ if ( ! FORMINATOR_PRO ) {
39
 
40
  </div>
41
  <script type="text/javascript">
42
- var ajaxUrl = '<?php echo forminator_ajax_url(); ?>';
43
  jQuery('.forminator-rating-notice a').on('click', function (e) {
44
  e.preventDefault();
45
 
@@ -72,7 +72,7 @@ if ( ! FORMINATOR_PRO ) {
72
  {
73
  action: 'forminator_later_notification',
74
  prop: prop,
75
- form_id: <?php echo $form_id; ?>,
76
  _ajax_nonce: $notice.data('nonce')
77
  }
78
  ).always(function () {
@@ -80,6 +80,7 @@ if ( ! FORMINATOR_PRO ) {
80
  });
81
  });
82
  </script>
83
- <?php }
 
84
  }
85
- }
17
  <?php
18
  if ( empty( $args['notice'] ) ) {
19
  $milestone = ( 100 >= $submission ) ? $min_submissions : 100;
20
+ printf( esc_html__( "Hey, we noticed you just crossed %1\$s submissions%2\$s on this %3\$s - that's awesome! We have spent countless hours developing this free plugin for you, and we would really appreciate it if you could drop us a rating on wp.org to help us spread the word and boost our motivation.", 'forminator' ), '<strong> ' . (int) $milestone, '</strong>', esc_html( static::$module_slug ) );
21
  } else {
22
+ echo wp_kses_post( $args['notice'] );
23
  }
24
  ?>
25
  </p>
39
 
40
  </div>
41
  <script type="text/javascript">
42
+ var ajaxUrl = '<?php echo esc_url( forminator_ajax_url() ); ?>';
43
  jQuery('.forminator-rating-notice a').on('click', function (e) {
44
  e.preventDefault();
45
 
72
  {
73
  action: 'forminator_later_notification',
74
  prop: prop,
75
+ form_id: <?php echo (int) $form_id; ?>,
76
  _ajax_nonce: $notice.data('nonce')
77
  }
78
  ).always(function () {
80
  });
81
  });
82
  </script>
83
+ <?php
84
+ }
85
  }
86
+ }
admin/views/common/list/chart_script.php CHANGED
@@ -4,9 +4,9 @@ $default_array = array();
4
 
5
  for ( $h = 30; $h >= 0; $h-- ) {
6
  $time = strtotime( '-' . $h . ' days' );
7
- $date = date( 'Y-m-d', $time );//phpcs:ignore
8
  $default_array[ $date ] = 0;
9
- $days_array[] = date( 'M j, Y', $time );//phpcs:ignore
10
  }
11
 
12
  foreach ( $this->getModules() as $module ) {
@@ -19,17 +19,17 @@ foreach ( $this->getModules() as $module ) {
19
  $submissions_data = array_merge( $default_array, array_intersect_key( $submissions_array, $default_array ) );
20
  }
21
 
22
- // Get highest value
23
  $highest_submission = max( $submissions_data );
24
 
25
- // Calculate canvas top spacing
26
  $canvas_top_spacing = $highest_submission + 8;
27
  ?>
28
  <script>
29
 
30
- var ctx = document.getElementById( 'forminator-module-<?php echo $module['id']; // phpcs:ignore ?>-stats' );
31
- var monthDays = [ '<?php echo implode( "', '", $days_array ); // phpcs:ignore ?>' ],
32
- submissions = [ <?php echo implode( ', ', $submissions_data ); // phpcs:ignore ?> ];
33
 
34
  var chartData = {
35
  labels: monthDays,
@@ -87,7 +87,7 @@ foreach ( $this->getModules() as $module ) {
87
  tooltips: {
88
  custom: function( tooltip ) {
89
  if ( ! tooltip ) return;
90
- // disable displaying the color box;
91
  tooltip.displayColors = false;
92
  },
93
  callbacks: {
@@ -97,7 +97,7 @@ foreach ( $this->getModules() as $module ) {
97
  label: function( tooltipItem, data ) {
98
  return tooltipItem.xLabel;
99
  },
100
- // Set label text color
101
  labelTextColor:function( tooltipItem, chart ) {
102
  return '#AAAAAA';
103
  }
@@ -143,10 +143,10 @@ foreach ( $this->getModules() as $module ) {
143
  $canvas_top_spacing = $highest_submission + 8;
144
  ?>
145
  <script>
146
- var ctx = document.getElementById( 'forminator-module-<?php echo $module['leads_id']; // phpcs:ignore ?>-stats' );
147
 
148
- var monthDays = [ '<?php echo implode( "', '", $days_array ); // phpcs:ignore ?>' ],
149
- submissions = [ <?php echo implode( ', ', $submissions_data ); // phpcs:ignore ?> ];
150
 
151
  var chartData = {
152
  labels: monthDays,
@@ -204,7 +204,7 @@ foreach ( $this->getModules() as $module ) {
204
  tooltips: {
205
  custom: function( tooltip ) {
206
  if ( ! tooltip ) return;
207
- // disable displaying the color box;
208
  tooltip.displayColors = false;
209
  },
210
  callbacks: {
@@ -214,7 +214,7 @@ foreach ( $this->getModules() as $module ) {
214
  label: function( tooltipItem, data ) {
215
  return tooltipItem.xLabel;
216
  },
217
- // Set label text color
218
  labelTextColor:function( tooltipItem, chart ) {
219
  return '#AAAAAA';
220
  }
4
 
5
  for ( $h = 30; $h >= 0; $h-- ) {
6
  $time = strtotime( '-' . $h . ' days' );
7
+ $date = date( 'Y-m-d', $time );
8
  $default_array[ $date ] = 0;
9
+ $days_array[] = date( 'M j, Y', $time );
10
  }
11
 
12
  foreach ( $this->getModules() as $module ) {
19
  $submissions_data = array_merge( $default_array, array_intersect_key( $submissions_array, $default_array ) );
20
  }
21
 
22
+ // Get highest value.
23
  $highest_submission = max( $submissions_data );
24
 
25
+ // Calculate canvas top spacing.
26
  $canvas_top_spacing = $highest_submission + 8;
27
  ?>
28
  <script>
29
 
30
+ var ctx = document.getElementById( 'forminator-module-<?php echo esc_attr( $module['id'] ); ?>-stats' );
31
+ var monthDays = [ '<?php echo wp_kses_post( implode( "', '", $days_array ) ); ?>' ],
32
+ submissions = [ <?php echo esc_attr( implode( ', ', $submissions_data ) ); ?> ];
33
 
34
  var chartData = {
35
  labels: monthDays,
87
  tooltips: {
88
  custom: function( tooltip ) {
89
  if ( ! tooltip ) return;
90
+ // disable displaying the color box;.
91
  tooltip.displayColors = false;
92
  },
93
  callbacks: {
97
  label: function( tooltipItem, data ) {
98
  return tooltipItem.xLabel;
99
  },
100
+ // Set label text color.
101
  labelTextColor:function( tooltipItem, chart ) {
102
  return '#AAAAAA';
103
  }
143
  $canvas_top_spacing = $highest_submission + 8;
144
  ?>
145
  <script>
146
+ var ctx = document.getElementById( 'forminator-module-<?php echo esc_attr( $module['leads_id'] ); ?>-stats' );
147
 
148
+ var monthDays = [ '<?php echo wp_kses_post( implode( "', '", $days_array ) ); ?>' ],
149
+ submissions = [ <?php echo esc_attr( implode( ', ', $submissions_data ) ); ?> ];
150
 
151
  var chartData = {
152
  labels: monthDays,
204
  tooltips: {
205
  custom: function( tooltip ) {
206
  if ( ! tooltip ) return;
207
+ // disable displaying the color box;.
208
  tooltip.displayColors = false;
209
  },
210
  callbacks: {
214
  label: function( tooltipItem, data ) {
215
  return tooltipItem.xLabel;
216
  },
217
+ // Set label text color.
218
  labelTextColor:function( tooltipItem, chart ) {
219
  return '#AAAAAA';
220
  }
admin/views/common/list/empty_content.php CHANGED
@@ -25,7 +25,7 @@ $search_empty2x = forminator_plugin_url() . 'assets/images/forminator-no-result@
25
  class="sui-image sui-image-center"
26
  aria-hidden="true"/>
27
 
28
- <?php else: ?>
29
 
30
  <img src="<?php echo esc_url( $search_empty ); ?>"
31
  srcset="<?php echo esc_url( $search_empty2x ); ?> 1x, <?php echo esc_url( $search_empty2x ); ?> 2x"
@@ -64,17 +64,19 @@ $search_empty2x = forminator_plugin_url() . 'assets/images/forminator-no-result@
64
 
65
  <?php endif; ?>
66
 
67
- <?php else: // Search no-result message ?>
68
 
69
- <h2><?php
 
70
  echo sprintf(
71
- '%s "%s"',
72
- esc_html__( 'No results for', 'forminator' ),
73
- esc_html( $search_keyword )
74
- );
75
- ?></h2>
76
-
77
- <p><?php printf( esc_html__( "We couldn't find any %s matching your search keyword. Perhaps try again?", 'forminator' ), forminator_get_prefix( $module_slug, '', false, true ) ); ?></p>
 
78
 
79
  <?php endif; ?>
80
 
25
  class="sui-image sui-image-center"
26
  aria-hidden="true"/>
27
 
28
+ <?php else : ?>
29
 
30
  <img src="<?php echo esc_url( $search_empty ); ?>"
31
  srcset="<?php echo esc_url( $search_empty2x ); ?> 1x, <?php echo esc_url( $search_empty2x ); ?> 2x"
64
 
65
  <?php endif; ?>
66
 
67
+ <?php else : // Search no-result message. ?>
68
 
69
+ <h2>
70
+ <?php
71
  echo sprintf(
72
+ '%s "%s"',
73
+ esc_html__( 'No results for', 'forminator' ),
74
+ esc_html( $search_keyword )
75
+ );
76
+ ?>
77
+ </h2>
78
+
79
+ <p><?php echo esc_html( sprintf( __( "We couldn't find any %s matching your search keyword. Perhaps try again?", 'forminator' ), forminator_get_prefix( $module_slug, '', false, true ) ) ); ?></p>
80
 
81
  <?php endif; ?>
82
 
admin/views/common/list/main_content.php CHANGED
@@ -61,8 +61,8 @@
61
 
62
  <div class="sui-accordion sui-accordion-block" id="forminator-modules-list">
63
  <?php
64
- if ( empty( $search_keyword ) ) {
65
- Forminator_Admin_Module_Edit_Page::show_modules( $modules, static::$module_slug, $preview_dialog, $preview_title, $export_dialog, $post_type, $soon, $sql_month_start_date, $wizard_page );
66
- }
67
  ?>
68
  </div>
61
 
62
  <div class="sui-accordion sui-accordion-block" id="forminator-modules-list">
63
  <?php
64
+ if ( empty( $search_keyword ) ) {
65
+ Forminator_Admin_Module_Edit_Page::show_modules( $modules, static::$module_slug, $preview_dialog, $preview_title, $export_dialog, $post_type, $soon, $sql_month_start_date, $wizard_page );
66
+ }
67
  ?>
68
  </div>
admin/views/common/list/summary.php CHANGED
@@ -23,10 +23,18 @@ if ( $count > 0 || $is_search ) {
23
 
24
  <span class="sui-summary-large"><?php echo esc_html( $count_active ); ?></span>
25
 
26
- <span class="sui-summary-sub"><?php echo esc_html( _n(
 
 
 
27
  sprintf( 'Active %s', forminator_get_prefix( static::$module_slug, '', true ) ),
28
  sprintf( 'Active %s', forminator_get_prefix( static::$module_slug, '', true, true ) ),
29
- esc_html( $count_active ), 'forminator' ) ); ?></span>
 
 
 
 
 
30
 
31
  <form id="forminator-search-modules" class="forminator-search-modules" data-searched="false">
32
 
@@ -38,7 +46,7 @@ if ( $count > 0 || $is_search ) {
38
 
39
  <div class="sui-control-with-icon">
40
  <button class="forminator-search-submit"><i class="sui-icon-magnifying-glass-search"></i></button>
41
- <input type="text" name="search" value="<?php echo esc_attr( $search_keyword ); ?>" placeholder="<?php printf( esc_attr__( 'Search %s...', 'forminator' ), static::$module_slug ); ?>" id="forminator-module-search" class="sui-form-control">
42
  </div>
43
  <button role="button" class="search-reset sui-button-icon" title="<?php esc_attr_e( 'Reset search', 'forminator' ); ?>">
44
  <span class="sui-icon-cross-close" aria-hidden="true"></span>
@@ -60,7 +68,7 @@ if ( $count > 0 || $is_search ) {
60
  <input type="hidden" name="export_dialog" value="<?php echo esc_attr( $export_dialog ); ?>" />
61
  <input type="hidden" name="post_type" value="<?php echo esc_attr( $post_type ); ?>" />
62
  <input type="hidden" name="soon" value="<?php echo esc_attr( $soon ); ?>" />
63
- <input type="hidden" name="page" value="<?php echo filter_input( INPUT_GET, 'page', FILTER_SANITIZE_STRING ); ?>" />
64
  <?php
65
  wp_nonce_field( $search_module_nonce, $search_module_nonce, false );
66
  ?>
@@ -89,7 +97,7 @@ if ( $count > 0 || $is_search ) {
89
  <span class="sui-list-label"><?php esc_html_e( 'Most submissions', 'forminator' ); ?></span>
90
  <span class="sui-list-detail">
91
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=' . $wizard_page . '&id=' . $most_entry->form_id ) ); ?>">
92
- <?php echo forminator_get_form_name( $most_entry->form_id ); ?>
93
  </a>
94
  </span>
95
  </li>
@@ -100,7 +108,7 @@ if ( $count > 0 || $is_search ) {
100
 
101
  </div>
102
 
103
- <?php
104
- // Call the css here to prevent search icon from flashing above the search form while the page is loading...
105
- $this->template( 'common/list/temp_css' );
106
  }
23
 
24
  <span class="sui-summary-large"><?php echo esc_html( $count_active ); ?></span>
25
 
26
+ <span class="sui-summary-sub">
27
+ <?php
28
+ echo esc_html(
29
+ _n(
30
  sprintf( 'Active %s', forminator_get_prefix( static::$module_slug, '', true ) ),
31
  sprintf( 'Active %s', forminator_get_prefix( static::$module_slug, '', true, true ) ),
32
+ esc_html( $count_active ),
33
+ 'forminator'
34
+ )
35
+ );
36
+ ?>
37
+ </span>
38
 
39
  <form id="forminator-search-modules" class="forminator-search-modules" data-searched="false">
40
 
46
 
47
  <div class="sui-control-with-icon">
48
  <button class="forminator-search-submit"><i class="sui-icon-magnifying-glass-search"></i></button>
49
+ <input type="text" name="search" value="<?php echo esc_attr( $search_keyword ); ?>" placeholder="<?php echo esc_attr( sprintf( __( 'Search %s...', 'forminator' ), static::$module_slug ) ); ?>" id="forminator-module-search" class="sui-form-control">
50
  </div>
51
  <button role="button" class="search-reset sui-button-icon" title="<?php esc_attr_e( 'Reset search', 'forminator' ); ?>">
52
  <span class="sui-icon-cross-close" aria-hidden="true"></span>
68
  <input type="hidden" name="export_dialog" value="<?php echo esc_attr( $export_dialog ); ?>" />
69
  <input type="hidden" name="post_type" value="<?php echo esc_attr( $post_type ); ?>" />
70
  <input type="hidden" name="soon" value="<?php echo esc_attr( $soon ); ?>" />
71
+ <input type="hidden" name="page" value="<?php echo esc_attr( (string) filter_input( INPUT_GET, 'page' ) ); ?>" />
72
  <?php
73
  wp_nonce_field( $search_module_nonce, $search_module_nonce, false );
74
  ?>
97
  <span class="sui-list-label"><?php esc_html_e( 'Most submissions', 'forminator' ); ?></span>
98
  <span class="sui-list-detail">
99
  <a href="<?php echo esc_url( admin_url( 'admin.php?page=' . $wizard_page . '&id=' . $most_entry->form_id ) ); ?>">
100
+ <?php echo esc_html( forminator_get_form_name( $most_entry->form_id ) ); ?>
101
  </a>
102
  </span>
103
  </li>
108
 
109
  </div>
110
 
111
+ <?php
112
+ // Call the css here to prevent search icon from flashing above the search form while the page is loading...
113
+ $this->template( 'common/list/temp_css' );
114
  }
admin/views/common/popup/export.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- $form_id = $_POST['id'];// phpcs:ignore -- varified on admin ajax
3
  $slug = $args['slug'];
4
  $_page = 'forminator-' . forminator_get_prefix( $slug, 'c' );
5
  $nonce = wp_create_nonce( 'forminator_' . $slug . '_request' );
@@ -24,12 +24,12 @@ $text_area_id = uniqid( 'export-text-' );
24
  <?php
25
  echo(
26
  sprintf(
27
- __( 'You can import this %1$s in Forminator %2$s%3$s%4$s or above. The %5$s may break on a version lower than your install.', 'forminator' ), //phpcs:ignore
28
- $slug,//phpcs:ignore
29
  '<strong>',
30
- FORMINATOR_VERSION,//phpcs:ignore
31
  '</strong>',
32
- $slug
33
  )
34
  );
35
  ?>
@@ -55,7 +55,7 @@ $text_area_id = uniqid( 'export-text-' );
55
 
56
  </div>
57
 
58
- <?php // using jquery to avoid html escape on popup ajax load ?>
59
  <script type="text/javascript">
60
  jQuery('#<?php echo esc_attr( $text_area_id ); ?>').val(JSON.stringify(<?php echo wp_json_encode( $exportable ); ?>));
61
  </script>
1
  <?php
2
+ $form_id = filter_input( INPUT_POST, 'id', FILTER_VALIDATE_INT );
3
  $slug = $args['slug'];
4
  $_page = 'forminator-' . forminator_get_prefix( $slug, 'c' );
5
  $nonce = wp_create_nonce( 'forminator_' . $slug . '_request' );
24
  <?php
25
  echo(
26
  sprintf(
27
+ esc_html__( 'You can import this %1$s in Forminator %2$s%3$s%4$s or above. The %5$s may break on a version lower than your install.', 'forminator' ),
28
+ esc_html( $slug ),
29
  '<strong>',
30
+ esc_html( FORMINATOR_VERSION ),
31
  '</strong>',
32
+ esc_html( $slug )
33
  )
34
  );
35
  ?>
55
 
56
  </div>
57
 
58
+ <?php // using jquery to avoid html escape on popup ajax load. ?>
59
  <script type="text/javascript">
60
  jQuery('#<?php echo esc_attr( $text_area_id ); ?>').val(JSON.stringify(<?php echo wp_json_encode( $exportable ); ?>));
61
  </script>
admin/views/common/popup/import.php CHANGED
@@ -11,7 +11,7 @@ $nonce = wp_create_nonce( 'forminator_save_import_' . $slug );
11
 
12
  <textarea class="sui-form-control" rows="10" name="importable"></textarea>
13
 
14
- <span class="sui-description"><?php printf( esc_html__( 'Paste exported %s above.', 'forminator' ), $slug ); ?></span>
15
 
16
  </div>
17
 
11
 
12
  <textarea class="sui-form-control" rows="10" name="importable"></textarea>
13
 
14
+ <span class="sui-description"><?php echo esc_html( sprintf( __( 'Paste exported %s above.', 'forminator' ), $slug ) ); ?></span>
15
 
16
  </div>
17
 
admin/views/custom-form/entries/content.php CHANGED
@@ -24,7 +24,7 @@ if ( $this->error_message() ) : ?>
24
 
25
  <span class="sui-notice sui-notice-error"><p><?php echo esc_html( $this->error_message() ); ?></p></span>
26
 
27
- <?php
28
  endif;
29
 
30
  if ( $this->total_entries() > 0 ) :
@@ -78,7 +78,8 @@ if ( $this->total_entries() > 0 ) :
78
  <tbody>
79
 
80
  <?php
81
- $url_entry_id = ( isset( $_GET['entry_id'] ) && ! empty( $_GET['entry_id'] ) ) ? ( int ) sanitize_text_field( $_GET['entry_id'] ) : 0;//phpcs:ignore
 
82
  foreach ( $this->entries_iterator() as $entries ) {
83
 
84
  $entry_id = $entries['id'];
@@ -91,8 +92,8 @@ if ( $this->total_entries() > 0 ) :
91
  $detail_items = $detail['items'];
92
 
93
  $accordion_classes = '';
94
- //Open entry tab by received submission link
95
- if ( $url_entry_id === ( int ) $db_entry_id ) {
96
  $accordion_classes .= ' sui-accordion-item--open';
97
  }
98
 
@@ -102,7 +103,7 @@ if ( $this->total_entries() > 0 ) :
102
  }
103
  ?>
104
 
105
- <tr class="sui-accordion-item <?php echo esc_attr( $accordion_classes ); ?>" data-entry-id="<?php echo esc_attr( $db_entry_id ); ?>">
106
 
107
  <?php foreach ( $summary_items as $key => $summary_item ) { ?>
108
 
@@ -132,9 +133,9 @@ if ( $this->total_entries() > 0 ) :
132
  echo '<span aria-hidden="true"></span>';
133
 
134
  echo '<span class="sui-screen-reader-text">' . sprintf(/* translators: ... */
135
- esc_html__( 'Select entry number %s', 'forminator' ),
136
- esc_html( $db_entry_id )
137
- ) . '</span>';
138
 
139
  echo '</label>';
140
 
@@ -172,9 +173,9 @@ if ( $this->total_entries() > 0 ) :
172
 
173
  echo '<td>';
174
  echo '' . sprintf(/* translators: ... */
175
- esc_html__( '+ %s other fields', 'forminator' ),
176
- esc_html( $summary['num_fields_left'] )
177
- ) . '';
178
  echo '<span class="sui-accordion-open-indicator">';
179
  echo '<i class="sui-icon-chevron-down"></i>';
180
  echo '</span>';
@@ -204,13 +205,14 @@ if ( $this->total_entries() > 0 ) :
204
  <?php
205
  if ( isset( $detail_item['type'] ) && ( 'stripe' === $detail_item['type'] || 'paypal' === $detail_item['type'] ) ) {
206
 
207
- if ( ! empty( $sub_entries ) ) { ?>
 
208
 
209
  <div class="sui-box-settings-col-2">
210
 
211
  <span class="sui-settings-label sui-dark sui-sm"><?php echo esc_html( $detail_item['label'] ); ?></span>
212
 
213
- <table id="fui-table-<?php echo $detail_item['type']; ?>" class="sui-table sui-accordion fui-table-details">
214
 
215
  <thead>
216
 
@@ -221,16 +223,16 @@ if ( $this->total_entries() > 0 ) :
221
 
222
  $sub_key++;
223
 
224
- if ( 'stripe' === $detail_item['type'] && 5 < $sub_key ) {
225
 
226
  continue;
227
  }
228
 
229
- if ( 'stripe' === $detail_item['type'] && 5 === $sub_key ) {
230
 
231
  echo '<th colspan="2"></th>';
232
 
233
- } else if ( $sub_key === $end ) {
234
 
235
  echo '<th colspan="2">' . esc_html( $sub_entry['label'] ) . '</th>';
236
 
@@ -248,12 +250,12 @@ if ( $this->total_entries() > 0 ) :
248
 
249
  <tbody>
250
 
251
- <tr class="<?php echo 'stripe' === $detail_item['type'] ? 'sui-accordion-item' : ''; ?>">
252
 
253
  <?php
254
  $end = count( $sub_entries );
255
  $subscription_id = array_search( 'subscription_id', array_column( $sub_entries, 'key', 'value' ), true );
256
- if ( class_exists( 'Forminator_Stripe_Subscription' ) && 'stripe' === $detail_item['type'] && empty( $subscription_id ) ) {
257
  $keys = $key = array_search( 'subscription_id', array_column( $sub_entries, 'key' ), true );
258
  unset( $sub_entries[ $keys ] );
259
  }
@@ -261,25 +263,25 @@ if ( $this->total_entries() > 0 ) :
261
 
262
  $sub_key++;
263
 
264
- if ( 'stripe' === $detail_item['type'] && 5 < $sub_key ) {
265
 
266
  continue;
267
  }
268
 
269
- if ( 'stripe' === $detail_item['type'] && 5 === $sub_key ) {
270
  $sub_count = count( $sub_entries ) - 4;
271
  echo '<td colspan="2" style="padding-top: 5px; padding-bottom: 5px;">';
272
  echo '' . sprintf(/* translators: ... */
273
- esc_html__( '+ %s other fields', 'forminator' ),
274
- esc_html( $sub_count )
275
- ) . '';
276
  echo '<span class="sui-accordion-open-indicator">';
277
  echo '<i class="sui-icon-chevron-down"></i>';
278
  echo '</span>';
279
  echo '</td>';
280
- } else if ( $sub_key === $end ) {
281
- // No escape for Stripe & PayPal transaction links because we generate it ourselves above
282
- echo '<td colspan="2" style="padding-top: 5px; padding-bottom: 5px;">' . $sub_entry['value'] . '</td>';//phpcs:ignore -- html output intended
283
 
284
  } else {
285
 
@@ -303,13 +305,13 @@ if ( $this->total_entries() > 0 ) :
303
  <?php
304
  foreach ( $sub_entries as $sub_key => $sub_entry ) {
305
 
306
- $html = '';
307
  $html .= '<div class="fui-col">';
308
  $html .= '<h5 class="col-label">' . esc_html( $sub_entry['label'] ) . '</h5>';
309
  $html .= '<p class="col-value">' . $sub_entry['value'] . '</p>';
310
  $html .= '</div>';
311
 
312
- echo $html;
313
  }
314
  ?>
315
  </div>
@@ -342,18 +344,20 @@ if ( $this->total_entries() > 0 ) :
342
 
343
  <?php if ( 'textarea' === $detail_item['type'] && ( isset( $detail_item['rich'] ) && 'true' === $detail_item['rich'] ) ) { ?>
344
 
345
- <div class="fui-rich-textarea"><?php echo ( $detail_item['value'] );//phpcs:ignore -- html output intended ?></div>
346
 
347
- <?php } else if ( 'number' === $detail_item['type'] || 'currency' === $detail_item['type'] || 'calculation' === $detail_item['type'] ) {
 
348
  $separator = isset( $detail_item['separator'] ) ? $detail_item['separator'] : '';
349
  $point = isset( $detail_item['point'] ) ? $detail_item['point'] : '';
350
- $precision = isset( $detail_item['precision'] ) ? $detail_item['precision'] : 0; ?>
 
351
 
352
- <span class="sui-description" data-inputmask="'alias': 'decimal','rightAlign': false, 'digitsOptional': false, 'groupSeparator': '<?php echo esc_attr( $separator ); ?>', 'radixPoint': '<?php echo esc_attr( $point ); ?>', 'digits': '<?php echo esc_attr( $precision ); ?>'"><?php echo ( $detail_item['value'] );//phpcs:ignore -- html output intended ?></span>
353
 
354
  <?php } else { ?>
355
 
356
- <span class="sui-description"><?php echo ( $detail_item['value'] );//phpcs:ignore -- html output intended ?></span>
357
 
358
  <?php } ?>
359
 
@@ -363,7 +367,7 @@ if ( $this->total_entries() > 0 ) :
363
 
364
  <div class="sui-form-field">
365
  <span class="sui-settings-label"><?php echo esc_html( $sub_entry['label'] ); ?></span>
366
- <span class="sui-description"><?php echo ( $sub_entry['value'] );//phpcs:ignore -- html output intended ?></span>
367
  </div>
368
 
369
  <?php } ?>
@@ -385,16 +389,18 @@ if ( $this->total_entries() > 0 ) :
385
  <button
386
  type="button"
387
  class="sui-button sui-button-ghost sui-button-red wpmudev-open-modal"
388
- <?php if ( isset( $entries['activation_key'] ) ) {
389
- $button_title = esc_html( 'Delete Submission & User', 'forminator' );
 
390
  $is_activation_key = true;
391
  ?>
392
- data-activation-key="<?php echo $entries['activation_key']; ?>"
393
  data-modal="delete-unconfirmed-user-module"
394
  data-entry-id="<?php echo esc_attr( $db_entry_id ); ?>"
395
  data-form-id="<?php echo esc_attr( $this->model->id ); ?>"
396
- <?php } else {
397
- $button_title = esc_html( 'Delete', 'forminator' );
 
398
  $is_activation_key = false;
399
  ?>
400
  data-modal="delete-module"
@@ -404,10 +410,10 @@ if ( $this->total_entries() > 0 ) :
404
  data-modal-content="<?php esc_attr_e( 'Are you sure you wish to permanently delete this submission?', 'forminator' ); ?>"
405
  data-nonce="<?php echo esc_attr( wp_create_nonce( 'forminatorFormEntries' ) ); ?>"
406
  >
407
- <i class="sui-icon-trash" aria-hidden="true"></i> <?php echo $button_title; ?>
408
  </button>
409
 
410
- <?php if ( isset( $entries['activation_method'] ) && 'manual' === $entries['activation_method'] && $is_activation_key ) { ?>
411
 
412
  <div class="sui-actions-right">
413
  <button
@@ -418,7 +424,7 @@ if ( $this->total_entries() > 0 ) :
418
  data-modal-content="<?php esc_attr_e( 'Are you sure you want to approve and activate this user?', 'forminator' ); ?>"
419
  data-form-id="<?php echo esc_attr( $db_entry_id ); ?>"
420
  data-activation-key="<?php echo esc_attr( $entries['activation_key'] ); ?>"
421
- data-nonce="<?php echo wp_create_nonce( 'forminatorFormEntries' ); // WPCS: XSS ok. ?>"
422
  >
423
  <?php esc_html_e( 'Approve User', 'forminator' ); ?>
424
  </button>
@@ -428,21 +434,21 @@ if ( $this->total_entries() > 0 ) :
428
 
429
  <?php if ( ( isset( $entries['activation_method'] ) && 'email' === $entries['activation_method'] ) && isset( $entries['activation_key'] ) ) { ?>
430
 
431
- <div class="sui-actions-right">
432
  <button
433
  role="button"
434
  class="sui-button sui-button-ghost resend-activation-btn"
435
  data-activation-key="<?php echo esc_attr( $entries['activation_key'] ); ?>"
436
- data-nonce="<?php echo wp_create_nonce( 'forminatorResendActivation' ); // WPCS: XSS ok. ?>"
437
  >
438
  <span class="sui-icon-undo" aria-hidden="true"></span>
439
  <?php esc_html_e( 'Resend activation link', 'forminator' ); ?>
440
  </button>
441
- </div>
442
 
443
  <?php } ?>
444
 
445
- </div>
446
 
447
  </div>
448
 
@@ -473,5 +479,5 @@ if ( $this->total_entries() > 0 ) :
473
  <?php else : ?>
474
 
475
  <?php include_once forminator_plugin_dir() . 'admin/views/common/entries/content-none.php'; ?>
476
- <?php
477
  endif;
24
 
25
  <span class="sui-notice sui-notice-error"><p><?php echo esc_html( $this->error_message() ); ?></p></span>
26
 
27
+ <?php
28
  endif;
29
 
30
  if ( $this->total_entries() > 0 ) :
78
  <tbody>
79
 
80
  <?php
81
+ $url_entry_id = filter_input( INPUT_GET, 'entry_id', FILTER_VALIDATE_INT );
82
+ $url_entry_id = $url_entry_id ? $url_entry_id : 0;
83
  foreach ( $this->entries_iterator() as $entries ) {
84
 
85
  $entry_id = $entries['id'];
92
  $detail_items = $detail['items'];
93
 
94
  $accordion_classes = '';
95
+ // Open entry tab by received submission link.
96
+ if ( $url_entry_id === (int) $db_entry_id ) {
97
  $accordion_classes .= ' sui-accordion-item--open';
98
  }
99
 
103
  }
104
  ?>
105
 
106
+ <tr class="sui-accordion-item <?php echo esc_attr( $accordion_classes ); ?>" data-entry-id="<?php echo esc_attr( $db_entry_id ); ?>">
107
 
108
  <?php foreach ( $summary_items as $key => $summary_item ) { ?>
109
 
133
  echo '<span aria-hidden="true"></span>';
134
 
135
  echo '<span class="sui-screen-reader-text">' . sprintf(/* translators: ... */
136
+ esc_html__( 'Select entry number %s', 'forminator' ),
137
+ esc_html( $db_entry_id )
138
+ ) . '</span>';
139
 
140
  echo '</label>';
141
 
173
 
174
  echo '<td>';
175
  echo '' . sprintf(/* translators: ... */
176
+ esc_html__( '+ %s other fields', 'forminator' ),
177
+ esc_html( $summary['num_fields_left'] )
178
+ ) . '';
179
  echo '<span class="sui-accordion-open-indicator">';
180
  echo '<i class="sui-icon-chevron-down"></i>';
181
  echo '</span>';
205
  <?php
206
  if ( isset( $detail_item['type'] ) && ( 'stripe' === $detail_item['type'] || 'paypal' === $detail_item['type'] ) ) {
207
 
208
+ if ( ! empty( $sub_entries ) ) {
209
+ ?>
210
 
211
  <div class="sui-box-settings-col-2">
212
 
213
  <span class="sui-settings-label sui-dark sui-sm"><?php echo esc_html( $detail_item['label'] ); ?></span>
214
 
215
+ <table id="fui-table-<?php echo esc_attr( $detail_item['type'] ); ?>" class="sui-table sui-accordion fui-table-details">
216
 
217
  <thead>
218
 
223
 
224
  $sub_key++;
225
 
226
+ if ( 'stripe' === $detail_item['type'] && 5 < $sub_key ) {
227
 
228
  continue;
229
  }
230
 
231
+ if ( 'stripe' === $detail_item['type'] && 5 === $sub_key ) {
232
 
233
  echo '<th colspan="2"></th>';
234
 
235
+ } elseif ( $sub_key === $end ) {
236
 
237
  echo '<th colspan="2">' . esc_html( $sub_entry['label'] ) . '</th>';
238
 
250
 
251
  <tbody>
252
 
253
+ <tr class="<?php echo 'stripe' === $detail_item['type'] ? 'sui-accordion-item' : ''; ?>">
254
 
255
  <?php
256
  $end = count( $sub_entries );
257
  $subscription_id = array_search( 'subscription_id', array_column( $sub_entries, 'key', 'value' ), true );
258
+ if ( class_exists( 'Forminator_Stripe_Subscription' ) && 'stripe' === $detail_item['type'] && empty( $subscription_id ) ) {
259
  $keys = $key = array_search( 'subscription_id', array_column( $sub_entries, 'key' ), true );
260
  unset( $sub_entries[ $keys ] );
261
  }
263
 
264
  $sub_key++;
265
 
266
+ if ( 'stripe' === $detail_item['type'] && 5 < $sub_key ) {
267
 
268
  continue;
269
  }
270
 
271
+ if ( 'stripe' === $detail_item['type'] && 5 === $sub_key ) {
272
  $sub_count = count( $sub_entries ) - 4;
273
  echo '<td colspan="2" style="padding-top: 5px; padding-bottom: 5px;">';
274
  echo '' . sprintf(/* translators: ... */
275
+ esc_html__( '+ %s other fields', 'forminator' ),
276
+ esc_html( $sub_count )
277
+ ) . '';
278
  echo '<span class="sui-accordion-open-indicator">';
279
  echo '<i class="sui-icon-chevron-down"></i>';
280
  echo '</span>';
281
  echo '</td>';
282
+ } elseif ( $sub_key === $end ) {
283
+ // No escape for Stripe & PayPal transaction links because we generate it ourselves above.
284
+ echo '<td colspan="2" style="padding-top: 5px; padding-bottom: 5px;">' . wp_kses_post( $sub_entry['value'] ) . '</td>';
285
 
286
  } else {
287
 
305
  <?php
306
  foreach ( $sub_entries as $sub_key => $sub_entry ) {
307
 
308
+ $html = '';
309
  $html .= '<div class="fui-col">';
310
  $html .= '<h5 class="col-label">' . esc_html( $sub_entry['label'] ) . '</h5>';
311
  $html .= '<p class="col-value">' . $sub_entry['value'] . '</p>';
312
  $html .= '</div>';
313
 
314
+ echo wp_kses_post( $html );
315
  }
316
  ?>
317
  </div>
344
 
345
  <?php if ( 'textarea' === $detail_item['type'] && ( isset( $detail_item['rich'] ) && 'true' === $detail_item['rich'] ) ) { ?>
346
 
347
+ <div class="fui-rich-textarea"><?php echo wp_kses_post( $detail_item['value'] ); ?></div>
348
 
349
+ <?php
350
+ } elseif ( 'number' === $detail_item['type'] || 'currency' === $detail_item['type'] || 'calculation' === $detail_item['type'] ) {
351
  $separator = isset( $detail_item['separator'] ) ? $detail_item['separator'] : '';
352
  $point = isset( $detail_item['point'] ) ? $detail_item['point'] : '';
353
+ $precision = isset( $detail_item['precision'] ) ? $detail_item['precision'] : 0;
354
+ ?>
355
 
356
+ <span class="sui-description" data-inputmask="'alias': 'decimal','rightAlign': false, 'digitsOptional': false, 'groupSeparator': '<?php echo esc_attr( $separator ); ?>', 'radixPoint': '<?php echo esc_attr( $point ); ?>', 'digits': '<?php echo esc_attr( $precision ); ?>'"><?php echo wp_kses_post( $detail_item['value'] ); ?></span>
357
 
358
  <?php } else { ?>
359
 
360
+ <span class="sui-description"><?php echo wp_kses_post( $detail_item['value'] ); ?></span>
361
 
362
  <?php } ?>
363
 
367
 
368
  <div class="sui-form-field">
369
  <span class="sui-settings-label"><?php echo esc_html( $sub_entry['label'] ); ?></span>
370
+ <span class="sui-description"><?php echo wp_kses_post( $sub_entry['value'] ); ?></span>
371
  </div>
372
 
373
  <?php } ?>
389
  <button
390
  type="button"
391
  class="sui-button sui-button-ghost sui-button-red wpmudev-open-modal"
392
+ <?php
393
+ if ( isset( $entries['activation_key'] ) ) {
394
+ $button_title = esc_html( 'Delete Submission & User', 'forminator' );
395
  $is_activation_key = true;
396
  ?>
397
+ data-activation-key="<?php echo esc_attr( $entries['activation_key'] ); ?>"
398
  data-modal="delete-unconfirmed-user-module"
399
  data-entry-id="<?php echo esc_attr( $db_entry_id ); ?>"
400
  data-form-id="<?php echo esc_attr( $this->model->id ); ?>"
401
+ <?php
402
+ } else {
403
+ $button_title = esc_html( 'Delete', 'forminator' );
404
  $is_activation_key = false;
405
  ?>
406
  data-modal="delete-module"
410
  data-modal-content="<?php esc_attr_e( 'Are you sure you wish to permanently delete this submission?', 'forminator' ); ?>"
411
  data-nonce="<?php echo esc_attr( wp_create_nonce( 'forminatorFormEntries' ) ); ?>"
412
  >
413
+ <i class="sui-icon-trash" aria-hidden="true"></i> <?php echo wp_kses_post( $button_title ); ?>
414
  </button>
415
 
416
+ <?php if ( isset( $entries['activation_method'] ) && 'manual' === $entries['activation_method'] && $is_activation_key ) { ?>
417
 
418
  <div class="sui-actions-right">
419
  <button
424
  data-modal-content="<?php esc_attr_e( 'Are you sure you want to approve and activate this user?', 'forminator' ); ?>"
425
  data-form-id="<?php echo esc_attr( $db_entry_id ); ?>"
426
  data-activation-key="<?php echo esc_attr( $entries['activation_key'] ); ?>"
427
+ data-nonce="<?php echo esc_attr( wp_create_nonce( 'forminatorFormEntries' ) ); ?>"
428
  >
429
  <?php esc_html_e( 'Approve User', 'forminator' ); ?>
430
  </button>
434
 
435
  <?php if ( ( isset( $entries['activation_method'] ) && 'email' === $entries['activation_method'] ) && isset( $entries['activation_key'] ) ) { ?>
436
 
437
+ <div class="sui-actions-right">
438
  <button
439
  role="button"
440
  class="sui-button sui-button-ghost resend-activation-btn"
441
  data-activation-key="<?php echo esc_attr( $entries['activation_key'] ); ?>"
442
+ data-nonce="<?php echo esc_attr( wp_create_nonce( 'forminatorResendActivation' ) ); ?>"
443
  >
444
  <span class="sui-icon-undo" aria-hidden="true"></span>
445
  <?php esc_html_e( 'Resend activation link', 'forminator' ); ?>
446
  </button>
447
+ </div>
448
 
449
  <?php } ?>
450
 
451
+ </div>
452
 
453
  </div>
454
 
479
  <?php else : ?>
480
 
481
  <?php include_once forminator_plugin_dir() . 'admin/views/common/entries/content-none.php'; ?>
482
+ <?php
483
  endif;
admin/views/custom-form/list/content.php CHANGED
@@ -1,23 +1,19 @@
1
  <?php
2
  /** @var Forminator_CForm_Page $this */
3
 
4
- // Search keyword
5
- $search_keyword = null;
6
- $is_search = false;
7
  $search_module_nonce = esc_attr( 'forminator-nonce-search-module' );
8
- if ( isset( $_GET['module-search'] ) && strlen( trim( $_GET['module-search'] ) ) ) {
9
- $search_keyword = sanitize_text_field( $_GET['module-search'] );
10
- $is_search = true;
11
- }
12
 
13
- // Get modules
14
  $modules = $this->getModules();
15
 
16
- // Count total forms
17
- $count = ! $is_search ? $this->countModules() : count( $modules );
18
 
19
- // Start date for retrieving the information of the last 30 days in sql format
20
- $sql_month_start_date = date( 'Y-m-d H:i:s', strtotime( '-30 days midnight' ) );// phpcs:ignore
21
 
22
  $entry_type = 'custom-forms';
23
  $wizard_page = 'forminator-cform-wizard';
1
  <?php
2
  /** @var Forminator_CForm_Page $this */
3
 
4
+ // Search keyword.
5
+ $search_keyword = Forminator_Core::sanitize_text_field( 'module-search' );
6
+ $is_search = (bool) $search_keyword;
7
  $search_module_nonce = esc_attr( 'forminator-nonce-search-module' );
 
 
 
 
8
 
9
+ // Get modules.
10
  $modules = $this->getModules();
11
 
12
+ // Count total forms.
13
+ $count = ! $is_search ? $this->countModules() : count( $modules );
14
 
15
+ // Start date for retrieving the information of the last 30 days in sql format.
16
+ $sql_month_start_date = date( 'Y-m-d H:i:s', strtotime( '-30 days midnight' ) );
17
 
18
  $entry_type = 'custom-forms';
19
  $wizard_page = 'forminator-cform-wizard';
admin/views/custom-form/popup/import-cf7.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  $is_addons = false;
3
- $nonce = wp_create_nonce( 'forminator_save_import_custom_form_cf7' );
4
- $forms = forminator_list_thirdparty_contact_forms('cf7');
5
 
6
- // Empty message
7
  $image_empty = forminator_plugin_url() . 'assets/images/forminator-summary.png';
8
  $image_empty2x = forminator_plugin_url() . 'assets/images/forminator-summary@2x.png';
9
  ?>
@@ -37,7 +37,7 @@ $image_empty2x = forminator_plugin_url() . 'assets/images/forminator-summary@2x.
37
  <li><?php printf( esc_html__( "%1\$s2. ConstantContact:%2\$s Forminator doesn't integrate directly with ConstantContact. However, you can use %3\$sZapier integration%4\$s to send your leads to ConstantContact.", 'forminator' ), '<strong>', '</strong>', '<a href="https://wpmudev.com/blog/zapier-wordpress-form-integrations/" target="_blank">', '</a>' ); ?></li>
38
  <li><?php printf( esc_html__( "%1\$s3. reCAPTCHA v3 integration:%2\$s At this stage, Forminator can't import your existing reCAPTCHA integration. You can set this up manually on your imported forms once they are transferred.", 'forminator' ), '<strong>', '</strong>' ); ?></li>
39
  <li><?php printf( esc_html__( "%1\$s4. Additional settings:%2\$s Forminator doesn't support CF7’s additional form settings.", 'forminator' ), '<strong>', '</strong>' ); ?></li>
40
- <li><?php printf( esc_html__( "%1\$s5. Custom field IDs:%2\$s Forminator creates a unique ID for each field, and the conditional logic relies on them. However, you can provide a custom CSS class for each field.", 'forminator' ), '<strong>', '</strong>' ); ?></li>
41
  </ol>
42
 
43
  <button role="button" class="fui-dismiss-button forminator-dismiss-unsupported">
@@ -57,7 +57,7 @@ $image_empty2x = forminator_plugin_url() . 'assets/images/forminator-summary@2x.
57
  name="cf7_forms"
58
  value="all"
59
  id="cf7_forms_all"
60
- class="forminator-import-forms"
61
  checked="checked"
62
  />
63
  <?php esc_html_e( 'All', 'forminator' ); ?>
@@ -69,7 +69,7 @@ $image_empty2x = forminator_plugin_url() . 'assets/images/forminator-summary@2x.
69
  name="cf7_forms"
70
  value="specific"
71
  id="cf7_forms_specific"
72
- class="forminator-import-forms"
73
  data-tab-menu="cf7_forms"
74
  />
75
  <?php esc_html_e( 'Specific Forms', 'forminator' ); ?>
@@ -126,7 +126,10 @@ $image_empty2x = forminator_plugin_url() . 'assets/images/forminator-summary@2x.
126
 
127
  <p class="sui-description" style="margin-bottom: 20px;"><?php printf( esc_html__( "Choose the Contact Form 7 add-ons you wish to import form data and settings from. %1\$sNote:%2\$s The importer only supports the most widely used add-ons. For less common add-ons, you'll need to manually configure the equivalent functionality in those imported forms.", 'forminator' ), '<strong>', '</strong>' ); ?></p>
128
 
129
- <?php if ( is_plugin_active( 'flamingo/flamingo.php' ) ) : $is_addons = true; ?>
 
 
 
130
 
131
  <div class="fui-addons-option">
132
 
@@ -148,10 +151,12 @@ $image_empty2x = forminator_plugin_url() . 'assets/images/forminator-summary@2x.
148
 
149
  </div>
150
 
151
- <?php
152
  endif;
153
 
154
- if ( is_plugin_active( 'contact-form-7-honeypot/honeypot.php' ) ) : $is_addons = true; ?>
 
 
155
 
156
  <div class="fui-addons-option">
157
 
@@ -173,9 +178,12 @@ $image_empty2x = forminator_plugin_url() . 'assets/images/forminator-summary@2x.
173
 
174
  </div>
175
 
176
- <?php endif;
 
177
 
178
- if ( is_plugin_active( 'contact-form-cfdb7/contact-form-cfdb-7.php' ) ) : $is_addons = true; ?>
 
 
179
 
180
  <div class="fui-addons-option">
181
 
@@ -197,9 +205,12 @@ $image_empty2x = forminator_plugin_url() . 'assets/images/forminator-summary@2x.
197
 
198
  </div>
199
 
200
- <?php endif;
 
201
 
202
- if ( is_plugin_active( 'wpcf7-redirect/wpcf7-redirect.php' ) ) : $is_addons = true; ?>
 
 
203
 
204
  <div class="fui-addons-option">
205
 
@@ -221,9 +232,12 @@ $image_empty2x = forminator_plugin_url() . 'assets/images/forminator-summary@2x.
221
 
222
  </div>
223
 
224
- <?php endif;
 
225
 
226
- if ( is_plugin_active( 'cf7-conditional-fields/contact-form-7-conditional-fields.php' ) ) : $is_addons = true; ?>
 
 
227
 
228
  <div class="fui-addons-option">
229
 
@@ -245,9 +259,12 @@ $image_empty2x = forminator_plugin_url() . 'assets/images/forminator-summary@2x.
245
 
246
  </div>
247
 
248
- <?php endif;
 
249
 
250
- if ( is_plugin_active( 'contact-form-submissions/contact-form-submissions.php' ) ) : $is_addons = true; ?>
 
 
251
 
252
  <div class="fui-addons-option">
253
 
@@ -269,9 +286,12 @@ $image_empty2x = forminator_plugin_url() . 'assets/images/forminator-summary@2x.
269
 
270
  </div>
271
 
272
- <?php endif;
 
273
 
274
- if ( is_plugin_active( 'wpcf7-recaptcha/wpcf7-recaptcha.php' ) ) : $is_addons = true; ?>
 
 
275
 
276
  <div class="fui-addons-option">
277
 
@@ -293,9 +313,12 @@ $image_empty2x = forminator_plugin_url() . 'assets/images/forminator-summary@2x.
293
 
294
  </div>
295
 
296
- <?php endif;
 
297
 
298
- if ( is_plugin_active( 'advanced-cf7-db/advanced-cf7-db.php' ) ) : $is_addons = true; ?>
 
 
299
 
300
  <div class="fui-addons-option">
301
 
@@ -319,7 +342,7 @@ $image_empty2x = forminator_plugin_url() . 'assets/images/forminator-summary@2x.
319
 
320
  <?php endif; ?>
321
 
322
- <?php if ( ! $is_addons ) { ?>
323
 
324
  <div class="sui-notice">
325
  <p><?php esc_html_e( "We couldn't find any supported add-ons.", 'forminator' ); ?></p>
@@ -387,7 +410,7 @@ $image_empty2x = forminator_plugin_url() . 'assets/images/forminator-summary@2x.
387
 
388
  </div>
389
 
390
- <?php if ( forminator_is_show_branding() ): ?>
391
  <img
392
  src="<?php echo esc_url( $image_empty ); ?>"
393
  srcset="<?php echo esc_url( $image_empty2x ); ?> 1x, <?php echo esc_url( $image_empty2x ); ?> 2x"
@@ -443,7 +466,7 @@ $image_empty2x = forminator_plugin_url() . 'assets/images/forminator-summary@2x.
443
 
444
  </div>
445
 
446
- <?php if ( forminator_is_show_branding() ): ?>
447
  <img
448
  src="<?php echo esc_url( $image_empty ); ?>"
449
  srcset="<?php echo esc_url( $image_empty2x ); ?> 1x, <?php echo esc_url( $image_empty2x ); ?> 2x"
@@ -457,8 +480,8 @@ $image_empty2x = forminator_plugin_url() . 'assets/images/forminator-summary@2x.
457
  <div class="forminator-cf7-imported-fail sui-hidden">
458
 
459
  <div class="sui-box-body wpmudev-popup-form">
460
- <?php $support_url = FORMINATOR_PRO ? 'https://wpmudev.com/hub2/support/' :'https://wordpress.org/support/plugin/forminator'; ?>
461
- <p><?php printf( esc_html__( 'We have encountered an error while importing your forms from Contact Form 7 and selected add-ons. Unable to solve this? Contact our %1$ssupport%2$s team for further help.', 'forminator' ), '<a href="' . $support_url . '" target="_blank">', '</a>' ); ?></p>
462
 
463
  <div class="sui-notice sui-notice-error">
464
  <p><?php esc_html_e( "We couldn't find any compatible data to import.", 'forminator' ); ?></p>
@@ -484,7 +507,7 @@ $image_empty2x = forminator_plugin_url() . 'assets/images/forminator-summary@2x.
484
 
485
  </div>
486
 
487
- <?php if ( forminator_is_show_branding() ): ?>
488
  <img
489
  src="<?php echo esc_url( $image_empty ); ?>"
490
  srcset="<?php echo esc_url( $image_empty2x ); ?> 1x, <?php echo esc_url( $image_empty2x ); ?> 2x"
1
  <?php
2
  $is_addons = false;
3
+ $nonce = wp_create_nonce( 'forminator_save_import_custom_form_cf7' );
4
+ $forms = forminator_list_thirdparty_contact_forms( 'cf7' );
5
 
6
+ // Empty message.
7
  $image_empty = forminator_plugin_url() . 'assets/images/forminator-summary.png';
8
  $image_empty2x = forminator_plugin_url() . 'assets/images/forminator-summary@2x.png';
9
  ?>
37
  <li><?php printf( esc_html__( "%1\$s2. ConstantContact:%2\$s Forminator doesn't integrate directly with ConstantContact. However, you can use %3\$sZapier integration%4\$s to send your leads to ConstantContact.", 'forminator' ), '<strong>', '</strong>', '<a href="https://wpmudev.com/blog/zapier-wordpress-form-integrations/" target="_blank">', '</a>' ); ?></li>
38
  <li><?php printf( esc_html__( "%1\$s3. reCAPTCHA v3 integration:%2\$s At this stage, Forminator can't import your existing reCAPTCHA integration. You can set this up manually on your imported forms once they are transferred.", 'forminator' ), '<strong>', '</strong>' ); ?></li>
39
  <li><?php printf( esc_html__( "%1\$s4. Additional settings:%2\$s Forminator doesn't support CF7’s additional form settings.", 'forminator' ), '<strong>', '</strong>' ); ?></li>
40
+ <li><?php printf( esc_html__( '%1$s5. Custom field IDs:%2$s Forminator creates a unique ID for each field, and the conditional logic relies on them. However, you can provide a custom CSS class for each field.', 'forminator' ), '<strong>', '</strong>' ); ?></li>
41
  </ol>
42
 
43
  <button role="button" class="fui-dismiss-button forminator-dismiss-unsupported">
57
  name="cf7_forms"
58
  value="all"
59
  id="cf7_forms_all"
60
+ class="forminator-import-forms"
61
  checked="checked"
62
  />
63
  <?php esc_html_e( 'All', 'forminator' ); ?>
69
  name="cf7_forms"
70
  value="specific"
71
  id="cf7_forms_specific"
72
+ class="forminator-import-forms"
73
  data-tab-menu="cf7_forms"
74
  />
75
  <?php esc_html_e( 'Specific Forms', 'forminator' ); ?>
126
 
127
  <p class="sui-description" style="margin-bottom: 20px;"><?php printf( esc_html__( "Choose the Contact Form 7 add-ons you wish to import form data and settings from. %1\$sNote:%2\$s The importer only supports the most widely used add-ons. For less common add-ons, you'll need to manually configure the equivalent functionality in those imported forms.", 'forminator' ), '<strong>', '</strong>' ); ?></p>
128
 
129
+ <?php
130
+ if ( is_plugin_active( 'flamingo/flamingo.php' ) ) :
131
+ $is_addons = true;
132
+ ?>
133
 
134
  <div class="fui-addons-option">
135
 
151
 
152
  </div>
153
 
154
+ <?php
155
  endif;
156
 
157
+ if ( is_plugin_active( 'contact-form-7-honeypot/honeypot.php' ) ) :
158
+ $is_addons = true;
159
+ ?>
160
 
161
  <div class="fui-addons-option">
162
 
178
 
179
  </div>
180
 
181
+ <?php
182
+ endif;
183
 
184
+ if ( is_plugin_active( 'contact-form-cfdb7/contact-form-cfdb-7.php' ) ) :
185
+ $is_addons = true;
186
+ ?>
187
 
188
  <div class="fui-addons-option">
189
 
205
 
206
  </div>
207
 
208
+ <?php
209
+ endif;
210
 
211
+ if ( is_plugin_active( 'wpcf7-redirect/wpcf7-redirect.php' ) ) :
212
+ $is_addons = true;
213
+ ?>
214
 
215
  <div class="fui-addons-option">
216
 
232
 
233
  </div>
234
 
235
+ <?php
236
+ endif;
237
 
238
+ if ( is_plugin_active( 'cf7-conditional-fields/contact-form-7-conditional-fields.php' ) ) :
239
+ $is_addons = true;
240
+ ?>
241
 
242
  <div class="fui-addons-option">
243
 
259
 
260
  </div>
261
 
262
+ <?php
263
+ endif;
264
 
265
+ if ( is_plugin_active( 'contact-form-submissions/contact-form-submissions.php' ) ) :
266
+ $is_addons = true;
267
+ ?>
268
 
269
  <div class="fui-addons-option">
270
 
286
 
287
  </div>
288
 
289
+ <?php
290
+ endif;
291
 
292
+ if ( is_plugin_active( 'wpcf7-recaptcha/wpcf7-recaptcha.php' ) ) :
293
+ $is_addons = true;
294
+ ?>
295
 
296
  <div class="fui-addons-option">
297
 
313
 
314
  </div>
315
 
316
+ <?php
317
+ endif;
318
 
319
+ if ( is_plugin_active( 'advanced-cf7-db/advanced-cf7-db.php' ) ) :
320
+ $is_addons = true;
321
+ ?>
322
 
323
  <div class="fui-addons-option">
324
 
342
 
343
  <?php endif; ?>
344
 
345
+ <?php if ( ! $is_addons ) { ?>
346
 
347
  <div class="sui-notice">
348
  <p><?php esc_html_e( "We couldn't find any supported add-ons.", 'forminator' ); ?></p>
410
 
411
  </div>
412
 
413
+ <?php if ( forminator_is_show_branding() ) : ?>
414
  <img
415
  src="<?php echo esc_url( $image_empty ); ?>"
416
  srcset="<?php echo esc_url( $image_empty2x ); ?> 1x, <?php echo esc_url( $image_empty2x ); ?> 2x"
466
 
467
  </div>
468
 
469
+ <?php if ( forminator_is_show_branding() ) : ?>
470
  <img
471
  src="<?php echo esc_url( $image_empty ); ?>"
472
  srcset="<?php echo esc_url( $image_empty2x ); ?> 1x, <?php echo esc_url( $image_empty2x ); ?> 2x"
480
  <div class="forminator-cf7-imported-fail sui-hidden">
481
 
482
  <div class="sui-box-body wpmudev-popup-form">
483
+ <?php $support_url = FORMINATOR_PRO ? 'https://wpmudev.com/hub2/support/' : 'https://wordpress.org/support/plugin/forminator'; ?>
484
+ <p><?php printf( esc_html__( 'We have encountered an error while importing your forms from Contact Form 7 and selected add-ons. Unable to solve this? Contact our %1$ssupport%2$s team for further help.', 'forminator' ), '<a href="' . esc_url( $support_url ) . '" target="_blank">', '</a>' ); ?></p>
485
 
486
  <div class="sui-notice sui-notice-error">
487
  <p><?php esc_html_e( "We couldn't find any compatible data to import.", 'forminator' ); ?></p>
507
 
508
  </div>
509
 
510
+ <?php if ( forminator_is_show_branding() ) : ?>
511
  <img
512
  src="<?php echo esc_url( $image_empty ); ?>"
513
  srcset="<?php echo esc_url( $image_empty2x ); ?> 1x, <?php echo esc_url( $image_empty2x ); ?> 2x"
admin/views/custom-form/popup/import-gravityforms.php CHANGED
@@ -9,13 +9,14 @@ $forms = forminator_list_thirdparty_contact_forms( 'gravityforms' );
9
 
10
  <div class="sui-form-field">
11
  <select class="sui-form-dropdown" name="gravityforms">
12
- <option value="all"><?php esc_html_e('All Forms', 'forminator'); ?></option>
13
  <?php
14
- if ( ! empty( $forms ) ):
15
- foreach ($forms as $key => $value) {
16
- echo sprintf('<option value="%f">%s</option>',
17
- absint( $value['id'] ),
18
- esc_html( $value['title'] )
 
19
  );
20
  }
21
  endif;
9
 
10
  <div class="sui-form-field">
11
  <select class="sui-form-dropdown" name="gravityforms">
12
+ <option value="all"><?php esc_html_e( 'All Forms', 'forminator' ); ?></option>
13
  <?php
14
+ if ( ! empty( $forms ) ) :
15
+ foreach ( $forms as $key => $value ) {
16
+ echo sprintf(
17
+ '<option value="%f">%s</option>',
18
+ absint( $value['id'] ),
19
+ esc_html( $value['title'] )
20
  );
21
  }
22
  endif;
admin/views/custom-form/popup/import-ninjaforms.php CHANGED
@@ -9,13 +9,14 @@ $forms = forminator_list_thirdparty_contact_forms( 'ninjaforms' );
9
 
10
  <div class="sui-form-field">
11
  <select class="sui-form-dropdown" name="ninjaforms">
12
- <option value="all"><?php esc_html_e('All Forms', 'forminator'); ?></option>
13
  <?php
14
- if ( ! empty( $forms ) ):
15
- foreach ($forms as $key => $value) {
16
- echo sprintf('<option value="%f">%s</option>',
17
- absint( $value->get_id() ),
18
- esc_html( $value->get_setting( 'title' ) )
 
19
  );
20
  }
21
  endif;
9
 
10
  <div class="sui-form-field">
11
  <select class="sui-form-dropdown" name="ninjaforms">
12
+ <option value="all"><?php esc_html_e( 'All Forms', 'forminator' ); ?></option>
13
  <?php
14
+ if ( ! empty( $forms ) ) :
15
+ foreach ( $forms as $key => $value ) {
16
+ echo sprintf(
17
+ '<option value="%f">%s</option>',
18
+ absint( $value->get_id() ),
19
+ esc_html( $value->get_setting( 'title' ) )
20
  );
21
  }
22
  endif;
admin/views/custom-form/wizard/header.php CHANGED
@@ -1 +1 @@
1
- <?php // phpcs:ignore
1
+ <?php // empty file
admin/views/dashboard/content.php CHANGED
@@ -14,9 +14,11 @@
14
 
15
  <div class="sui-col-md-6">
16
 
17
- <?php if ( ! FORMINATOR_PRO ) {
 
18
  $this->template( 'dashboard/widgets/widget-upgrade' );
19
- } ?>
 
20
 
21
  <?php $this->template( 'dashboard/widgets/widget-quiz' ); ?>
22
 
@@ -28,7 +30,8 @@
28
  $notice_dismissed = get_option( 'forminator_dismiss_feature_1153', false );
29
  $version_upgraded = get_option( 'forminator_version_upgraded', false );
30
 
31
- if ( ! $notice_dismissed && $version_upgraded && forminator_is_show_documentation_link() ) { ?>
 
32
 
33
  <?php $this->template( 'dashboard/new-feature-notice' ); ?>
34
 
14
 
15
  <div class="sui-col-md-6">
16
 
17
+ <?php
18
+ if ( ! FORMINATOR_PRO ) {
19
  $this->template( 'dashboard/widgets/widget-upgrade' );
20
+ }
21
+ ?>
22
 
23
  <?php $this->template( 'dashboard/widgets/widget-quiz' ); ?>
24
 
30
  $notice_dismissed = get_option( 'forminator_dismiss_feature_1153', false );
31
  $version_upgraded = get_option( 'forminator_version_upgraded', false );
32
 
33
+ if ( ! $notice_dismissed && $version_upgraded && forminator_is_show_documentation_link() ) {
34
+ ?>
35
 
36
  <?php $this->template( 'dashboard/new-feature-notice' ); ?>
37
 
admin/views/dashboard/footer-free.php CHANGED
@@ -65,7 +65,7 @@
65
  </a>
66
 
67
  <img class="sui-image"
68
- src="<?php echo forminator_plugin_url(); // phpcs:ignore ?>assets/images/dev-team.png"
69
- srcset="<?php echo forminator_plugin_url(); // phpcs:ignore ?>assets/images/dev-team@2x.png 2x"
70
  alt="<?php esc_html_e( 'Try pro features for free!', 'forminator' ); ?>">
71
  </div>
65
  </a>
66
 
67
  <img class="sui-image"
68
+ src="<?php echo esc_url( forminator_plugin_url() ); ?>assets/images/dev-team.png"
69
+ srcset="<?php echo esc_url( forminator_plugin_url() ); ?>assets/images/dev-team@2x.png 2x"
70
  alt="<?php esc_html_e( 'Try pro features for free!', 'forminator' ); ?>">
71
  </div>
admin/views/dashboard/footer.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- // Free version footer
4
  if ( ! FORMINATOR_PRO ) {
5
  $this->template( 'dashboard/footer-free' );
6
  }
1
  <?php
2
 
3
+ // Free version footer.
4
  if ( ! FORMINATOR_PRO ) {
5
  $this->template( 'dashboard/footer-free' );
6
  }
admin/views/dashboard/new-feature-notice.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  $current_user = wp_get_current_user();
3
- $banner_1x = forminator_plugin_url() . 'assets/images/mailchimp-group.png';
4
- $banner_2x = forminator_plugin_url() . 'assets/images/mailchimp-group@2x.png';
5
  ?>
6
 
7
  <div
@@ -38,38 +38,38 @@ $banner_2x = forminator_plugin_url() . 'assets/images/mailchimp-group@2x.png'
38
 
39
  <button data-a11y-dialog-hide="forminator-new-feature" class="sui-dialog-close forminator-dismiss-new-feature" aria-label="<?php esc_html_e( 'Close this dialog window', 'forminator' ); ?>"></button>
40
 
41
- <?php //if ( FORMINATOR_PRO ) { ?>
42
 
43
  <h2 class="sui-box-title"><?php esc_html_e( 'New! Mailchimp Groups & Tags', 'forminator' ); ?></h2>
44
 
45
- <?php //} else { ?>
46
 
47
- <?php //} ?>
48
 
49
  </div>
50
 
51
  <div class="sui-box-body sui-block-content-center">
52
 
53
- <p class="sui-description"><?php printf( esc_html__( 'Hey, %s! Ready to start organizing your audience? You can now use Mailchimp Groups and Tags in Forminator to organize your audience based on their interests and submitted form data.', 'forminator' ), ucfirst( $current_user->display_name ) ); ?></p>
54
 
55
  </div>
56
- <div class="sui-box-body" sui-spacing-bottom="0">
57
 
58
- <ul class="sui-list" sui-type="bullets">
59
 
60
- <li>
61
- <p class="sui-description"><strong sui-color="darkgray"><?php esc_html_e( 'Multiple Integration Accounts', 'forminator' ); ?></strong></p>
62
- <p class="sui-description"><?php esc_html_e( 'In previous versions of Forminator, you could only have one connected account for each third-party integration. Now, you can connect as many third-party accounts as you’d like.', 'forminator' ); ?></p>
63
- </li>
64
 
65
- <li>
66
- <p class="sui-description"><strong sui-color="darkgray"><?php esc_html_e( 'New Consent Field', 'forminator' ); ?></strong></p>
67
- <p class="sui-description"><?php esc_html_e( 'Similar to the GDPR Approval field, the new generic Consent field will allow you to request a user’s consent, with support for visibility conditions.', 'forminator' ); ?></p>
68
- </li>
69
 
70
- </ul>
71
 
72
- </div>
73
 
74
  <div class="sui-box-footer sui-block-content-center">
75
 
@@ -94,7 +94,7 @@ $banner_2x = forminator_plugin_url() . 'assets/images/mailchimp-group@2x.png'
94
  e.preventDefault();
95
 
96
  var $notice = jQuery( e.currentTarget ).closest( '.forminator-feature-modal' );
97
- var ajaxUrl = '<?php echo forminator_ajax_url();// phpcs:ignore ?>';
98
 
99
  jQuery.post(
100
  ajaxUrl,
1
  <?php
2
  $current_user = wp_get_current_user();
3
+ $banner_1x = forminator_plugin_url() . 'assets/images/mailchimp-group.png';
4
+ $banner_2x = forminator_plugin_url() . 'assets/images/mailchimp-group@2x.png';
5
  ?>
6
 
7
  <div
38
 
39
  <button data-a11y-dialog-hide="forminator-new-feature" class="sui-dialog-close forminator-dismiss-new-feature" aria-label="<?php esc_html_e( 'Close this dialog window', 'forminator' ); ?>"></button>
40
 
41
+ <?php // if ( FORMINATOR_PRO ) { ?>
42
 
43
  <h2 class="sui-box-title"><?php esc_html_e( 'New! Mailchimp Groups & Tags', 'forminator' ); ?></h2>
44
 
45
+ <?php // } else { ?>
46
 
47
+ <?php // } ?>
48
 
49
  </div>
50
 
51
  <div class="sui-box-body sui-block-content-center">
52
 
53
+ <p class="sui-description"><?php printf( esc_html__( 'Hey, %s! Ready to start organizing your audience? You can now use Mailchimp Groups and Tags in Forminator to organize your audience based on their interests and submitted form data.', 'forminator' ), esc_html( ucfirst( $current_user->display_name ) ) ); ?></p>
54
 
55
  </div>
56
+ <div class="sui-box-body" sui-spacing-bottom="0">
57
 
58
+ <ul class="sui-list" sui-type="bullets">
59
 
60
+ <li>
61
+ <p class="sui-description"><strong sui-color="darkgray"><?php esc_html_e( 'Multiple Integration Accounts', 'forminator' ); ?></strong></p>
62
+ <p class="sui-description"><?php esc_html_e( 'In previous versions of Forminator, you could only have one connected account for each third-party integration. Now, you can connect as many third-party accounts as you’d like.', 'forminator' ); ?></p>
63
+ </li>
64
 
65
+ <li>
66
+ <p class="sui-description"><strong sui-color="darkgray"><?php esc_html_e( 'New Consent Field', 'forminator' ); ?></strong></p>
67
+ <p class="sui-description"><?php esc_html_e( 'Similar to the GDPR Approval field, the new generic Consent field will allow you to request a user’s consent, with support for visibility conditions.', 'forminator' ); ?></p>
68
+ </li>
69
 
70
+ </ul>
71
 
72
+ </div>
73
 
74
  <div class="sui-box-footer sui-block-content-center">
75
 
94
  e.preventDefault();
95
 
96
  var $notice = jQuery( e.currentTarget ).closest( '.forminator-feature-modal' );
97
+ var ajaxUrl = '<?php echo esc_url( forminator_ajax_url() ); ?>';
98
 
99
  jQuery.post(
100
  ajaxUrl,
admin/views/dashboard/widgets/widget-cform.php CHANGED
@@ -9,4 +9,4 @@ $delete_description = __( 'Are you sure you wish to permanently delete this form
9
  $view_all = __( 'View all forms', 'forminator' );
10
  $total = forminator_cforms_total();
11
 
12
- require forminator_plugin_dir() . 'admin/views/common/dashboard/widget.php';
9
  $view_all = __( 'View all forms', 'forminator' );
10
  $total = forminator_cforms_total();
11
 
12
+ require forminator_plugin_dir() . 'admin/views/common/dashboard/widget.php';
admin/views/dashboard/widgets/widget-create.php CHANGED
@@ -35,21 +35,21 @@ $hero_sample = forminator_plugin_dir() . 'assets/icons/forminator-icons/hero-sam
35
 
36
  <div class="wpmudev-sitem--header">
37
 
38
- <div class="wpmudev-sitem--icon" aria-hidden="true"><?php echo $module->get_icon(); // phpcs:ignore ?></div>
39
 
40
- <h3 class="wpmudev-sitem--title"><?php echo $module->get_name(); // phpcs:ignore ?></h3>
41
 
42
  </div>
43
 
44
  <div class="wpmudev-sitem--section">
45
 
46
- <p><?php echo $module->get_description(); // phpcs:ignore ?></p>
47
 
48
  </div>
49
 
50
  <div class="wpmudev-sitem--footer">
51
 
52
- <button href="/" class="wpmudev-button wpmudev-button-sm wpmudev-button-ghost wpmudev-open-modal" data-modal="<?php echo esc_attr( $module->get_id() ); ?>"><?php echo $module->get_label(); // phpcs:ignore ?></button>
53
 
54
  </div>
55
 
@@ -59,8 +59,8 @@ $hero_sample = forminator_plugin_dir() . 'assets/icons/forminator-icons/hero-sam
59
 
60
  </div>
61
 
62
- </div><?php // .wpmudev-box ?>
63
 
64
- </div><?php // .wpmudev-col ?>
65
 
66
- </div><?php // .wpmudev-row ?>
35
 
36
  <div class="wpmudev-sitem--header">
37
 
38
+ <div class="wpmudev-sitem--icon" aria-hidden="true"><?php echo esc_html( $module->get_icon() ); ?></div>
39
 
40
+ <h3 class="wpmudev-sitem--title"><?php echo esc_html( $module->get_name() ); ?></h3>
41
 
42
  </div>
43
 
44
  <div class="wpmudev-sitem--section">
45
 
46
+ <p><?php echo wp_kses_post( $module->get_description() ); ?></p>
47
 
48
  </div>
49
 
50
  <div class="wpmudev-sitem--footer">
51
 
52
+ <button href="/" class="wpmudev-button wpmudev-button-sm wpmudev-button-ghost wpmudev-open-modal" data-modal="<?php echo esc_attr( $module->get_id() ); ?>"><?php echo wp_kses_post( $module->get_label() ); ?></button>
53
 
54
  </div>
55
 
59
 
60
  </div>
61
 
62
+ </div><?php // .wpmudev-box. ?>
63
 
64
+ </div><?php // .wpmudev-col. ?>
65
 
66
+ </div><?php // .wpmudev-row. ?>
admin/views/dashboard/widgets/widget-resume.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  $total_modules = forminator_total_forms();
3
  $count_active = forminator_total_forms( 'publish' );
4
- $forms_total_submissions = Forminator_Form_Entry_Model::count_all_entries_by_type( 'custom-forms' ); // phpcs:ignore -- forminator_cforms_total();
5
- $poll_total_submissions = Forminator_Form_Entry_Model::count_all_entries_by_type( 'poll' );// phpcs:ignore -- forminator_polls_total();
6
- $quiz_total_submissions = Forminator_Form_Entry_Model::count_all_entries_by_type( 'quizzes' );// phpcs:ignore -- forminator_quizzes_total();
7
  $last_submission = forminator_get_latest_entry_time( 'custom-forms' );
8
  ?>
9
 
1
  <?php
2
  $total_modules = forminator_total_forms();
3
  $count_active = forminator_total_forms( 'publish' );
4
+ $forms_total_submissions = Forminator_Form_Entry_Model::count_all_entries_by_type( 'custom-forms' );
5
+ $poll_total_submissions = Forminator_Form_Entry_Model::count_all_entries_by_type( 'poll' );
6
+ $quiz_total_submissions = Forminator_Form_Entry_Model::count_all_entries_by_type( 'quizzes' );
7
  $last_submission = forminator_get_latest_entry_time( 'custom-forms' );
8
  ?>
9
 
admin/views/dashboard/widgets/widget-upgrade.php CHANGED
@@ -15,9 +15,9 @@
15
  <p style="margin-bottom: 34px;"><?php esc_html_e( 'Get Forminator Pro, our full lineup of WordPress marketing tools and more for free when you start your WPMU DEV membership.', 'forminator' ); ?></p>
16
 
17
  <ul class="sui-list-pro">
18
- <li><span class="sui-icon-check sui-lg" aria-hidden="true"></span><?php esc_html_e( 'Accept subscription and recurring payments', 'forminator' ); ?></li>
19
- <li><span class="sui-icon-check sui-lg" aria-hidden="true"></span><?php esc_html_e( 'Unlock Advanced form features with Pro Add-ons', 'forminator' ); ?></li>
20
- <li><span class="sui-icon-check sui-lg" aria-hidden="true"></span><?php esc_html_e( 'Premium form fields and E-Signature integration', 'forminator' ); ?></li>
21
  <li><span class="sui-icon-check sui-lg" aria-hidden="true"></span><?php esc_html_e( 'Early access to the newest form features', 'forminator' ); ?></li>
22
  <li><span class="sui-icon-check sui-lg" aria-hidden="true"></span><?php esc_html_e( 'Smush and Hummingbird Pro performance pack', 'forminator' ); ?></li>
23
  <li><span class="sui-icon-check sui-lg" aria-hidden="true"></span><?php esc_html_e( 'Complete marketing suite - pop-ups, email, and more', 'forminator' ); ?></li>
15
  <p style="margin-bottom: 34px;"><?php esc_html_e( 'Get Forminator Pro, our full lineup of WordPress marketing tools and more for free when you start your WPMU DEV membership.', 'forminator' ); ?></p>
16
 
17
  <ul class="sui-list-pro">
18
+ <li><span class="sui-icon-check sui-lg" aria-hidden="true"></span><?php esc_html_e( 'Accept subscription and recurring payments', 'forminator' ); ?></li>
19
+ <li><span class="sui-icon-check sui-lg" aria-hidden="true"></span><?php esc_html_e( 'Unlock Advanced form features with Pro Add-ons', 'forminator' ); ?></li>
20
+ <li><span class="sui-icon-check sui-lg" aria-hidden="true"></span><?php esc_html_e( 'Premium form fields and E-Signature integration', 'forminator' ); ?></li>
21
  <li><span class="sui-icon-check sui-lg" aria-hidden="true"></span><?php esc_html_e( 'Early access to the newest form features', 'forminator' ); ?></li>
22
  <li><span class="sui-icon-check sui-lg" aria-hidden="true"></span><?php esc_html_e( 'Smush and Hummingbird Pro performance pack', 'forminator' ); ?></li>
23
  <li><span class="sui-icon-check sui-lg" aria-hidden="true"></span><?php esc_html_e( 'Complete marketing suite - pop-ups, email, and more', 'forminator' ); ?></li>
admin/views/integrations/addon.php CHANGED
@@ -17,9 +17,9 @@ $multi_name = false;
17
  if ( ! empty( $module_id ) ) {
18
  $action = 'forminator_addon_module_settings';
19
  $icon_class_action = 'sui-icon-plus';
20
- if ( ! empty( $addon['is_' . $module_slug . '_settings_available'] ) && true === $addon['is_' . $module_slug . '_settings_available'] ) {
21
  $show_action = true;
22
- if ( $addon['is_allow_multi_on_' . $module_slug ] ) {
23
  if ( isset( $addon['multi_name'] ) ) {
24
  $icon_class_action = 'sui-icon-widget-settings-config';
25
  $tooltip = __( 'Configure App', 'forminator' );
@@ -36,7 +36,7 @@ if ( ! empty( $module_id ) ) {
36
 
37
  }
38
  } else {
39
- if ( $addon['is_' . $module_slug . '_connected'] ) {
40
  $icon_class_action = 'sui-icon-widget-settings-config';
41
  $tooltip = __( 'Configure App', 'forminator' );
42
  } else {
@@ -47,7 +47,7 @@ if ( ! empty( $module_id ) ) {
47
  }
48
  } else {
49
 
50
- // on integrations page
51
  if ( isset( $addon['is_settings_available'] ) && ! empty( $addon['is_settings_available'] ) && true === $addon['is_settings_available'] ) {
52
 
53
  $show_action = true;
@@ -84,7 +84,7 @@ $show_pro_info = false;
84
  $pro_url = 'https://wpmudev.com';
85
  $pro_url_target = '_blank';
86
 
87
- // MULTI NAME (SAMPLE)
88
  // To be added in the table later when design is ready.
89
  /*
90
  <td><?php if ( ! empty( $multi_name ) ): ?>
17
  if ( ! empty( $module_id ) ) {
18
  $action = 'forminator_addon_module_settings';
19
  $icon_class_action = 'sui-icon-plus';
20
+ if ( ! empty( $addon[ 'is_' . $module_slug . '_settings_available' ] ) && true === $addon[ 'is_' . $module_slug . '_settings_available' ] ) {
21
  $show_action = true;
22
+ if ( $addon[ 'is_allow_multi_on_' . $module_slug ] ) {
23
  if ( isset( $addon['multi_name'] ) ) {
24
  $icon_class_action = 'sui-icon-widget-settings-config';
25
  $tooltip = __( 'Configure App', 'forminator' );
36
 
37
  }
38
  } else {
39
+ if ( $addon[ 'is_' . $module_slug . '_connected' ] ) {
40
  $icon_class_action = 'sui-icon-widget-settings-config';
41
  $tooltip = __( 'Configure App', 'forminator' );
42
  } else {
47
  }
48
  } else {
49
 
50
+ // on integrations page.
51
  if ( isset( $addon['is_settings_available'] ) && ! empty( $addon['is_settings_available'] ) && true === $addon['is_settings_available'] ) {
52
 
53
  $show_action = true;
84
  $pro_url = 'https://wpmudev.com';
85
  $pro_url_target = '_blank';
86
 
87
+ // MULTI NAME (SAMPLE).
88
  // To be added in the table later when design is ready.
89
  /*
90
  <td><?php if ( ! empty( $multi_name ) ): ?>
admin/views/integrations/content.php CHANGED
@@ -9,17 +9,17 @@
9
  <li class="sui-vertical-tab forminator-integrations" data-tab-id="forminator-integrations">
10
  <a href="#forminator-integrations" role="button"><?php esc_html_e( 'Applications', 'forminator' ); ?></a>
11
  </li>
12
- <?php if ( forminator_is_show_documentation_link() ) { ?>
13
- <li class="sui-vertical-tab forminator-api" data-tab-id="forminator-api">
14
- <a href="#forminator-api" role="button"><?php esc_html_e( 'API', 'forminator' ); ?></a>
15
- </li>
16
- <?php } ?>
17
  </ul>
18
 
19
  <select class="sui-mobile-nav sui-sidenav-hide-lg">
20
  <option value="forminator-integrations"><?php esc_html_e( 'Applications', 'forminator' ); ?></option>
21
  <?php if ( forminator_is_show_documentation_link() ) { ?>
22
- <option value="forminator-api"><?php esc_html_e( 'API', 'forminator' ); ?></option>
23
  <?php } ?>
24
  </select>
25
 
@@ -47,47 +47,47 @@
47
 
48
  </div>
49
  <?php if ( forminator_is_show_documentation_link() ) { ?>
50
- <div id="forminator-api" class="wpmudev-settings--box" style="display: none;">
51
 
52
- <div class="sui-box">
53
 
54
- <div class="sui-box-header">
55
 
56
- <h2 class="sui-box-title"><?php esc_html_e( 'API', 'forminator' ); ?></h2>
57
 
58
- </div>
59
 
60
- <div class="sui-box">
61
 
62
- <div class="sui-box-body sui-block-content-center">
63
 
64
- <?php if ( forminator_is_show_branding() ) : ?>
65
- <img src="<?php echo $url . 'assets/img/forminator-disabled.png'; // phpcs:ignore ?>"
66
- srcset="<?php echo $url . 'assets/img/forminator-disabled.png'; // phpcs:ignore ?> 1x,
67
- <?php echo $url . 'assets/img/forminator-disabled@2x.png'; // phpcs:ignore ?> 2x"
68
- alt="<?php esc_html_e( 'Forminator APIs', 'forminator' ); ?>"
69
- class="sui-image sui-image-center fui-image"/>
70
- <?php endif; ?>
71
 
72
- <div class="fui-limit-block-600 fui-limit-block-center">
73
 
74
- <p>
75
- <?php
76
- esc_html_e( 'Build your own integrations and custom Forminator apps using our full featured API! Visit the Forminator API Docs to get started.', 'forminator' );
77
- ?>
78
- </p>
79
- <p>
80
- <a href="https://wpmudev.com/docs/wpmu-dev-plugins/forminator-api-docs/" target="_blank" class="sui-button sui-button-blue">Get Started</a>
81
- </p>
82
- </div>
83
 
84
- </div>
85
 
86
- </div>
87
 
88
- </div>
89
 
90
- </div>
91
  <?php } ?>
92
 
93
  </div>
9
  <li class="sui-vertical-tab forminator-integrations" data-tab-id="forminator-integrations">
10
  <a href="#forminator-integrations" role="button"><?php esc_html_e( 'Applications', 'forminator' ); ?></a>
11
  </li>
12
+ <?php if ( forminator_is_show_documentation_link() ) { ?>
13
+ <li class="sui-vertical-tab forminator-api" data-tab-id="forminator-api">
14
+ <a href="#forminator-api" role="button"><?php esc_html_e( 'API', 'forminator' ); ?></a>
15
+ </li>
16
+ <?php } ?>
17
  </ul>
18
 
19
  <select class="sui-mobile-nav sui-sidenav-hide-lg">
20
  <option value="forminator-integrations"><?php esc_html_e( 'Applications', 'forminator' ); ?></option>
21
  <?php if ( forminator_is_show_documentation_link() ) { ?>
22
+ <option value="forminator-api"><?php esc_html_e( 'API', 'forminator' ); ?></option>
23
  <?php } ?>
24
  </select>
25
 
47
 
48
  </div>
49
  <?php if ( forminator_is_show_documentation_link() ) { ?>
50
+ <div id="forminator-api" class="wpmudev-settings--box" style="display: none;">
51
 
52
+ <div class="sui-box">
53
 
54
+ <div class="sui-box-header">
55
 
56
+ <h2 class="sui-box-title"><?php esc_html_e( 'API', 'forminator' ); ?></h2>
57
 
58
+ </div>
59
 
60
+ <div class="sui-box">
61
 
62
+ <div class="sui-box-body sui-block-content-center">
63
 
64
+ <?php if ( forminator_is_show_branding() ) : ?>
65
+ <img src="<?php echo esc_url( $url ) . 'assets/img/forminator-disabled.png'; ?>"
66
+ srcset="<?php echo esc_url( $url ) . 'assets/img/forminator-disabled.png'; ?> 1x,
67
+ <?php echo esc_url( $url ) . 'assets/img/forminator-disabled@2x.png'; ?> 2x"
68
+ alt="<?php esc_html_e( 'Forminator APIs', 'forminator' ); ?>"
69
+ class="sui-image sui-image-center fui-image"/>
70
+ <?php endif; ?>
71
 
72
+ <div class="fui-limit-block-600 fui-limit-block-center">
73
 
74
+ <p>
75
+ <?php
76
+ esc_html_e( 'Build your own integrations and custom Forminator apps using our full featured API! Visit the Forminator API Docs to get started.', 'forminator' );
77
+ ?>
78
+ </p>
79
+ <p>
80
+ <a href="https://wpmudev.com/docs/wpmu-dev-plugins/forminator-api-docs/" target="_blank" class="sui-button sui-button-blue">Get Started</a>
81
+ </p>
82
+ </div>
83
 
84
+ </div>
85
 
86
+ </div>
87
 
88
+ </div>
89
 
90
+ </div>
91
  <?php } ?>
92
 
93
  </div>
admin/views/integrations/main.php CHANGED
@@ -31,7 +31,7 @@ if ( empty( $addons['connected'] ) && empty( $addons['not_connected'] ) ) { ?>
31
 
32
  <?php foreach ( $addons['connected'] as $key => $provider ) : ?>
33
 
34
- <?php echo forminator_addon_row_html_markup( $provider, $module_id, $module_slug ); // phpcs:ignore ?>
35
 
36
  <?php endforeach; ?>
37
 
@@ -68,7 +68,7 @@ if ( empty( $addons['connected'] ) && empty( $addons['not_connected'] ) ) { ?>
68
  }
69
  ?>
70
 
71
- <?php echo forminator_addon_row_html_markup( $provider, $module_id, $module_slug ); // phpcs:ignore ?>
72
 
73
  <?php endforeach; ?>
74
 
@@ -82,5 +82,5 @@ if ( empty( $addons['connected'] ) && empty( $addons['not_connected'] ) ) { ?>
82
 
83
  </div>
84
 
85
- <?php
86
  }
31
 
32
  <?php foreach ( $addons['connected'] as $key => $provider ) : ?>
33
 
34
+ <?php echo wp_kses_post( forminator_addon_row_html_markup( $provider, $module_id, $module_slug ) ); ?>
35
 
36
  <?php endforeach; ?>
37
 
68
  }
69
  ?>
70
 
71
+ <?php echo wp_kses_post( forminator_addon_row_html_markup( $provider, $module_id, $module_slug ) ); ?>
72
 
73
  <?php endforeach; ?>
74
 
82
 
83
  </div>
84
 
85
+ <?php
86
  }
admin/views/integrations/page-content.php CHANGED
@@ -18,7 +18,7 @@
18
 
19
  <?php foreach ( $addons['connected'] as $key => $provider ) : ?>
20
 
21
- <?php echo forminator_addon_row_html_markup( $provider, 0 );// phpcs:ignore ?>
22
 
23
  <?php endforeach; ?>
24
 
@@ -52,7 +52,7 @@
52
 
53
  <?php foreach ( $addons['not_connected'] as $key => $provider ) : ?>
54
 
55
- <?php echo forminator_addon_row_html_markup( $provider, 0, 'form', true, false );// phpcs:ignore ?>
56
 
57
  <?php endforeach; ?>
58
 
18
 
19
  <?php foreach ( $addons['connected'] as $key => $provider ) : ?>
20
 
21
+ <?php echo wp_kses_post( forminator_addon_row_html_markup( $provider, 0 ) ); ?>
22
 
23
  <?php endforeach; ?>
24
 
52
 
53
  <?php foreach ( $addons['not_connected'] as $key => $provider ) : ?>
54
 
55
+ <?php echo wp_kses_post( forminator_addon_row_html_markup( $provider, 0, 'form', true, false ) ); ?>
56
 
57
  <?php endforeach; ?>
58
 
admin/views/poll/entries/content.php CHANGED
@@ -22,13 +22,13 @@ $custom_votes = $this->map_custom_votes();
22
  <div class="sui-block-content-center">
23
  <?php if ( ! empty( $poll_question ) ) { ?>
24
 
25
- <h2><?php echo $poll_question; // WPCS: XSS ok. ?></h2>
26
 
27
  <?php } ?>
28
 
29
  <?php if ( ! empty( $poll_description ) ) { ?>
30
 
31
- <p><?php echo $poll_description; // WPCS: XSS ok. ?></p>
32
 
33
  <?php } ?>
34
  </div>
@@ -46,7 +46,7 @@ $custom_votes = $this->map_custom_votes();
46
 
47
  echo '<div style="margin-top: 30px;">';
48
 
49
- echo '<label class="sui-label">' . $this->get_field_title( $element_id ) . '</label>'; // phpcs:ignore
50
 
51
  echo '<div style="margin-top: 10px;">';
52
 
22
  <div class="sui-block-content-center">
23
  <?php if ( ! empty( $poll_question ) ) { ?>
24
 
25
+ <h2><?php echo wp_kses_post( $poll_question ); ?></h2>
26
 
27
  <?php } ?>
28
 
29
  <?php if ( ! empty( $poll_description ) ) { ?>
30
 
31
+ <p><?php echo wp_kses_post( $poll_description ); ?></p>
32
 
33
  <?php } ?>
34
  </div>
46
 
47
  echo '<div style="margin-top: 30px;">';
48
 
49
+ echo '<label class="sui-label">' . esc_html( $this->get_field_title( $element_id ) ) . '</label>';
50
 
51
  echo '<div style="margin-top: 10px;">';
52
 
admin/views/poll/list/content.php CHANGED
@@ -1,23 +1,19 @@
1
  <?php
2
  /** @var Forminator_Poll_Page $this */
3
 
4
- // Search keyword
5
- $search_keyword = null;
6
- $is_search = false;
7
  $search_module_nonce = esc_attr( 'forminator-nonce-search-module' );
8
- if ( isset( $_GET['module-search'] ) && strlen( trim( $_GET['module-search'] ) ) ) {
9
- $search_keyword = sanitize_text_field( $_GET['module-search'] );
10
- $is_search = true;
11
- }
12
 
13
- // Get modules
14
  $modules = $this->getModules();
15
 
16
- // Count total polls
17
- $count = ! $is_search ? $this->countModules() : count( $modules );
18
 
19
- // Start date for retrieving the information of the last 30 days in sql format
20
- $sql_month_start_date = date( 'Y-m-d H:i:s', strtotime( '-30 days midnight' ) );// phpcs:ignore
21
 
22
  $entry_type = 'poll';
23
  $wizard_page = 'forminator-poll-wizard';
1
  <?php
2
  /** @var Forminator_Poll_Page $this */
3
 
4
+ // Search keyword.
5
+ $search_keyword = Forminator_Core::sanitize_text_field( 'module-search' );
6
+ $is_search = (bool) $search_keyword;
7
  $search_module_nonce = esc_attr( 'forminator-nonce-search-module' );
 
 
 
 
8
 
9
+ // Get modules.
10
  $modules = $this->getModules();
11
 
12
+ // Count total polls.
13
+ $count = ! $is_search ? $this->countModules() : count( $modules );
14
 
15
+ // Start date for retrieving the information of the last 30 days in sql format.
16
+ $sql_month_start_date = date( 'Y-m-d H:i:s', strtotime( '-30 days midnight' ) );
17
 
18
  $entry_type = 'poll';
19
  $wizard_page = 'forminator-poll-wizard';
admin/views/poll/wizard/header.php CHANGED
@@ -1 +1 @@
1
- <?php // phpcs:ignore
1
+ <?php
admin/views/quiz/entries/content-leads-none.php CHANGED
@@ -3,8 +3,8 @@ $entries = $this->get_table();
3
  $form_type = $this->get_form_type();
4
  $count = $this->get_total_entries();
5
  $entries_per_page = $this->get_per_page();
6
- $first_item = $count;
7
- $page_number = $this->get_paged();
8
 
9
  if ( $page_number > 1 ) {
10
  $first_item = $count - ( ( $page_number - 1 ) * $entries_per_page );
@@ -13,28 +13,28 @@ if ( $page_number > 1 ) {
13
 
14
  <?php foreach ( $entries as $entry ) : ?>
15
 
16
- <tr class="sui-accordion-item">
17
 
18
- <td>
19
- <label class="sui-checkbox">
20
- <input name="ids[]" value="<?php echo esc_attr( $entry->entry_id ); ?>" type="checkbox" id="quiz-answer-<?php echo esc_attr( $entry->entry_id ); ?>">
21
- <span></span>
22
- <div class="sui-description"><?php echo esc_attr( $first_item ); ?></div>
23
- </label>
24
- </td>
25
 
26
- <td colspan="5">
27
- <?php echo date( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), strtotime( $entry->date_created_sql ) ); // phpcs:ignore ?>
28
- <span class="sui-accordion-open-indicator">
29
  <i class="sui-icon-chevron-down"></i>
30
  </span>
31
- </td>
32
 
33
- </tr>
34
 
35
- <tr class="sui-accordion-item-content">
36
 
37
- <td colspan="6">
38
 
39
  <div class="sui-box">
40
 
@@ -45,7 +45,7 @@ if ( $page_number > 1 ) {
45
 
46
  <h2 class="fui-entries-title"><?php echo '#' . esc_attr( $first_item ); ?></h2>
47
 
48
- <p class="sui-description"><?php echo date( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), strtotime( $entry->date_created_sql ) ); // phpcs:ignore ?></p>
49
 
50
  </div>
51
 
@@ -60,12 +60,12 @@ if ( $page_number > 1 ) {
60
 
61
  <tbody>
62
 
63
- <?php foreach( $entry->meta_data['lead_entry']['value'] as $lead_entry ) { ?>
64
 
65
  <tr>
66
 
67
- <td><?php echo $lead_entry['name']; // phpcs:ignore ?></td>
68
- <td><?php echo $lead_entry['value']; // phpcs:ignore ?></td>
69
 
70
  </tr>
71
 
@@ -91,14 +91,14 @@ if ( $page_number > 1 ) {
91
  $total = count( $meta );
92
  $right = 0;
93
 
94
- foreach( $meta as $key => $val ) {
95
- if ( isset( $val['isCorrect'] ) && boolval( $val['isCorrect'] ) ) {
96
- $right ++;
97
- }
98
- }
99
  ?>
100
 
101
- <p class="sui-description"><?php echo sprintf( __( 'You got %s/%s correct answers.', 'forminator' ), $right, $total ); // phpcs:ignore ?></p>
102
 
103
  <table class="fui-entries-table">
104
 
@@ -122,36 +122,36 @@ if ( $page_number > 1 ) {
122
  $right ++;
123
  }
124
 
125
- if ( isset( $answer['answer'] ) ) {
126
- $user_answer = $answer['answer'];
127
- } else {
128
- $user_answer = $answer['answers'];
129
- }
130
  ?>
131
 
132
  <tr>
133
  <td><strong><?php echo esc_html( $answer['question'] ); ?></strong></td>
134
  <td>
135
  <?php
136
- if ( is_array( $user_answer ) ) {
137
- foreach( $user_answer as $val ) {
138
- if ( $answer['isCorrect'] ) {
139
- echo '<span class="sui-tag sui-tag-success">' . esc_html( $val ) . '</span>';
140
- } else {
141
- echo '<span class="sui-tag sui-tag-error">' . esc_html( $val ) . '</span>';
142
- }
143
- }
144
- } else {
145
- if ( $answer['isCorrect'] ) {
146
- echo '<span class="sui-tag sui-tag-success">' . esc_html( $user_answer ) . '</span>';
147
- } else {
148
- echo '<span class="sui-tag sui-tag-error">' . esc_html( $user_answer ) . '</span>';
149
- }
150
- }
151
- ?>
152
  </td>
153
  </tr>
154
-
155
  <?php endforeach; ?>
156
 
157
  </tbody>
@@ -212,7 +212,7 @@ if ( $page_number > 1 ) {
212
 
213
  <tr>
214
 
215
- <td colspan="2"><?php printf( __( '<strong>Quiz Result:</strong> %s', 'forminator' ), $meta['result']['title'] ); // phpcs:ignore ?></td>
216
 
217
  </tr>
218
 
@@ -230,9 +230,9 @@ if ( $page_number > 1 ) {
230
 
231
  </div>
232
 
233
- </td>
234
 
235
- </tr>
236
 
237
  <?php
238
  $first_item --;
3
  $form_type = $this->get_form_type();
4
  $count = $this->get_total_entries();
5
  $entries_per_page = $this->get_per_page();
6
+ $first_item = $count;
7
+ $page_number = $this->get_paged();
8
 
9
  if ( $page_number > 1 ) {
10
  $first_item = $count - ( ( $page_number - 1 ) * $entries_per_page );
13
 
14
  <?php foreach ( $entries as $entry ) : ?>
15
 
16
+ <tr class="sui-accordion-item">
17
 
18
+ <td>
19
+ <label class="sui-checkbox">
20
+ <input name="ids[]" value="<?php echo esc_attr( $entry->entry_id ); ?>" type="checkbox" id="quiz-answer-<?php echo esc_attr( $entry->entry_id ); ?>">
21
+ <span></span>
22
+ <div class="sui-description"><?php echo esc_attr( $first_item ); ?></div>
23
+ </label>
24
+ </td>
25
 
26
+ <td colspan="5">
27
+ <?php echo esc_html( date( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), strtotime( $entry->date_created_sql ) ) ); ?>
28
+ <span class="sui-accordion-open-indicator">
29
  <i class="sui-icon-chevron-down"></i>
30
  </span>
31
+ </td>
32
 
33
+ </tr>
34
 
35
+ <tr class="sui-accordion-item-content">
36
 
37
+ <td colspan="6">
38
 
39
  <div class="sui-box">
40
 
45
 
46
  <h2 class="fui-entries-title"><?php echo '#' . esc_attr( $first_item ); ?></h2>
47
 
48
+ <p class="sui-description"><?php echo esc_html( date( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), strtotime( $entry->date_created_sql ) ) ); ?></p>
49
 
50
  </div>
51
 
60
 
61
  <tbody>
62
 
63
+ <?php foreach ( $entry->meta_data['lead_entry']['value'] as $lead_entry ) { ?>
64
 
65
  <tr>
66
 
67
+ <td><?php echo esc_html( $lead_entry['name'] ); ?></td>
68
+ <td><?php echo wp_kses_post( $lead_entry['value'] ); ?></td>
69
 
70
  </tr>
71
 
91
  $total = count( $meta );
92
  $right = 0;
93
 
94
+ foreach ( $meta as $key => $val ) {
95
+ if ( isset( $val['isCorrect'] ) && boolval( $val['isCorrect'] ) ) {
96
+ $right ++;
97
+ }
98
+ }
99
  ?>
100
 
101
+ <p class="sui-description"><?php echo sprintf( esc_html__( 'You got %1$s/%2$s correct answers.', 'forminator' ), intval( $right ), intval( $total ) ); ?></p>
102
 
103
  <table class="fui-entries-table">
104
 
122
  $right ++;
123
  }
124
 
125
+ if ( isset( $answer['answer'] ) ) {
126
+ $user_answer = $answer['answer'];
127
+ } else {
128
+ $user_answer = $answer['answers'];
129
+ }
130
  ?>
131
 
132
  <tr>
133
  <td><strong><?php echo esc_html( $answer['question'] ); ?></strong></td>
134
  <td>
135
  <?php
136
+ if ( is_array( $user_answer ) ) {
137
+ foreach ( $user_answer as $val ) {
138
+ if ( $answer['isCorrect'] ) {
139
+ echo '<span class="sui-tag sui-tag-success">' . esc_html( $val ) . '</span>';
140
+ } else {
141
+ echo '<span class="sui-tag sui-tag-error">' . esc_html( $val ) . '</span>';
142
+ }
143
+ }
144
+ } else {
145
+ if ( $answer['isCorrect'] ) {
146
+ echo '<span class="sui-tag sui-tag-success">' . esc_html( $user_answer ) . '</span>';
147
+ } else {
148
+ echo '<span class="sui-tag sui-tag-error">' . esc_html( $user_answer ) . '</span>';
149
+ }
150
+ }
151
+ ?>
152
  </td>
153
  </tr>
154
+
155
  <?php endforeach; ?>
156
 
157
  </tbody>
212
 
213
  <tr>
214
 
215
+ <td colspan="2"><?php echo wp_kses_post( sprintf( __( '<strong>Quiz Result:</strong> %s', 'forminator' ), $meta['result']['title'] ) ); ?></td>
216
 
217
  </tr>
218
 
230
 
231
  </div>
232
 
233
+ </td>
234
 
235
+ </tr>
236
 
237
  <?php
238
  $first_item --;
admin/views/quiz/entries/content-leads.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
2
- $form_type = $this->get_form_type();
3
- $url_entry_id = ( isset( $_GET['entry_id'] ) && ! empty( $_GET['entry_id'] ) ) ? (int) sanitize_text_field( $_GET['entry_id'] ) : 0;//phpcs:ignore
 
4
  foreach ( $this->entries_iterator() as $entries ) {
5
 
6
  $db_entry_id = isset( $entries['entry_id'] ) ? $entries['entry_id'] : '';
7
- $entry_date = isset( $entries['entry_date'] ) ? $entries['entry_date'] : '';
8
 
9
  $summary = $entries['summary'];
10
  $summary_items = $summary['items'];
@@ -13,11 +14,11 @@ foreach ( $this->entries_iterator() as $entries ) {
13
  $detail_items = $detail['items'];
14
  $quiz_entry = $detail['quiz_entry'];
15
  $integrations = $detail['integrations'];
16
- //Open entry tab by received submission link
17
  $cls_open_tab = $url_entry_id === (int) $db_entry_id ? 'sui-accordion-item--open' : '';
18
  ?>
19
 
20
- <tr class="sui-accordion-item <?php echo esc_attr( $cls_open_tab ); ?>" data-entry-id="<?php echo esc_attr( $db_entry_id ); ?>">
21
 
22
  <?php foreach ( $summary_items as $key => $summary_item ) { ?>
23
 
@@ -36,7 +37,7 @@ foreach ( $this->entries_iterator() as $entries ) {
36
 
37
  echo '</td>';
38
 
39
- elseif ( 1 === $summary_item['colspan'] ) :
40
 
41
  echo '<td class="sui-accordion-item-title">';
42
 
@@ -47,9 +48,9 @@ foreach ( $this->entries_iterator() as $entries ) {
47
  echo '<span aria-hidden="true"></span>';
48
 
49
  echo '<span class="sui-screen-reader-text">' . sprintf(/* translators: ... */
50
- esc_html__( 'Select entry number %s', 'forminator' ),
51
- esc_html( $db_entry_id )
52
- ) . '</span>';
53
 
54
  echo '</label>';
55
 
@@ -79,9 +80,9 @@ foreach ( $this->entries_iterator() as $entries ) {
79
 
80
  echo '<td>';
81
  echo '' . sprintf(/* translators: ... */
82
- esc_html__( '+ %s other fields', 'forminator' ),
83
- esc_html( $summary['num_fields_left'] )
84
- ) . '';
85
  echo '<span class="sui-accordion-open-indicator">';
86
  echo '<span class="sui-icon-chevron-down"></span>';
87
  echo '</span>';
@@ -90,13 +91,13 @@ foreach ( $this->entries_iterator() as $entries ) {
90
  }
91
  ?>
92
 
93
- </tr>
94
 
95
- <tr class="sui-accordion-item-content">
96
 
97
- <td colspan="<?php echo esc_attr( $detail['colspan'] ); ?>">
98
 
99
- <div class="sui-box">
100
 
101
  <div class="sui-box-body fui-entries--knowledge">
102
 
@@ -173,8 +174,8 @@ foreach ( $this->entries_iterator() as $entries ) {
173
  $sub_key ++;
174
 
175
  if ( $sub_key === $end ) {
176
- // No escape for Stripe & PayPal transaction links because we generate it ourselves above
177
- echo '<td colspan="2">' . $sub_entry['value'] . '</td>'; //phpcs:ignore -- html output intended
178
 
179
  } else {
180
 
@@ -206,13 +207,13 @@ foreach ( $this->entries_iterator() as $entries ) {
206
 
207
  <?php if ( empty( $sub_entries ) ) { ?>
208
 
209
- <?php if ( 'textarea' === $detail_item['type'] && ( isset( $detail_item['rich'] ) && 'true' === $detail_item['rich'] ) ): ?>
210
 
211
- <div class="fui-rich-textarea"><?php echo( $detail_item['value'] );//phpcs:ignore -- html output intended ?></div>
212
 
213
- <?php else: ?>
214
 
215
- <?php echo( $detail_item['value'] );//phpcs:ignore -- html output intended ?>
216
 
217
  <?php endif; ?>
218
 
@@ -222,7 +223,7 @@ foreach ( $this->entries_iterator() as $entries ) {
222
 
223
  <div class="sui-form-field">
224
  <span class="sui-settings-label"><?php echo esc_html( $sub_entry['label'] ); ?></span>
225
- <span class="sui-description"><?php echo( $sub_entry['value'] );//phpcs:ignore -- html output intended ?></span>
226
  </div>
227
 
228
  <?php } ?>
@@ -256,7 +257,8 @@ foreach ( $this->entries_iterator() as $entries ) {
256
 
257
  <h3 class="fui-entries-subtitle"><?php esc_html_e( 'Quiz Results', 'forminator' ); ?></h3>
258
 
259
- <?php if ( ! empty( $quiz_entry ) ) {
 
260
 
261
  if ( 'knowledge' === $form_type ) {
262
 
@@ -272,7 +274,7 @@ foreach ( $this->entries_iterator() as $entries ) {
272
  }
273
  ?>
274
 
275
- <p class="sui-description"><?php echo sprintf( __( 'You got %s/%s correct answers.', 'forminator' ), $right, $total ); // phpcs:ignore ?></p>
276
 
277
  <table class="fui-entries-table">
278
 
@@ -294,12 +296,14 @@ foreach ( $this->entries_iterator() as $entries ) {
294
  <tr>
295
  <td><strong><?php echo esc_html( $answer['question'] ); ?></strong></td>
296
  <td>
297
- <?php if ( $answer['isCorrect'] ) {
 
298
  echo '<span class="sui-tag sui-tag-success">' . esc_html( $user_answer ) . '</span>';
299
  } else {
300
  echo '<span class="sui-tag sui-tag-error">' . esc_html( $user_answer ) . '</span>';
301
- } ?>
302
- </td>
 
303
  </tr>
304
 
305
  <?php endforeach; ?>
@@ -362,7 +366,7 @@ foreach ( $this->entries_iterator() as $entries ) {
362
 
363
  <tr>
364
 
365
- <td colspan="2"><?php printf( __( '<strong>Quiz Result:</strong> %s', 'forminator' ), $meta['result']['title'] ); // phpcs:ignore ?></td>
366
 
367
  </tr>
368
 
@@ -375,9 +379,9 @@ foreach ( $this->entries_iterator() as $entries ) {
375
  <?php } ?>
376
 
377
  <?php } else { ?>
378
- <div class="sui-notice">
379
- <p><?php esc_html_e( 'Quiz results are not available for this submission. The participant either couldn\'t finish the quiz or had some errors while submitting the quiz.', 'forminator' ); ?></p>
380
- </div>
381
  <?php } ?>
382
 
383
  </div>
@@ -413,7 +417,7 @@ foreach ( $this->entries_iterator() as $entries ) {
413
  class="sui-image"
414
  style="width: 20px; height: 20px;"
415
  />
416
- <span style="margin-left: 10px;"><?php echo $integration['title']; // phpcs:ignore -- html output intended ?></span>
417
  </div>
418
 
419
  <div>
@@ -430,7 +434,7 @@ foreach ( $this->entries_iterator() as $entries ) {
430
 
431
  <?php else : ?>
432
 
433
- <span><?php echo( $integration['value'] ); // phpcs:ignore -- html output intended ?></span>
434
 
435
  <?php endif; ?>
436
 
@@ -456,7 +460,7 @@ foreach ( $this->entries_iterator() as $entries ) {
456
 
457
  <div class="">
458
  <span class="sui-settings-label"><?php echo esc_html( $sub_entry['label'] ); ?></span>
459
- <span class="sui-description"><?php echo( $sub_entry['value'] ); // phpcs:ignore -- html output intended ?></span>
460
  </div>
461
 
462
  <?php } ?>
@@ -481,39 +485,41 @@ foreach ( $this->entries_iterator() as $entries ) {
481
 
482
  </div>
483
 
484
- <div class="sui-box-footer">
485
 
486
- <button
487
- type="button"
488
- class="sui-button sui-button-ghost sui-button-red wpmudev-open-modal"
489
- <?php if ( isset( $entries['activation_key'] ) ) {
490
- $button_title = esc_html__( 'Delete Submission & User', 'forminator' );
 
491
  $is_activation_key = true;
492
  ?>
493
- data-activation-key="<?php echo $entries['activation_key']; ?>"
494
- data-modal="delete-unconfirmed-user-module"
495
- data-entry-id="<?php echo esc_attr( $db_entry_id ); ?>"
496
- data-form-id="<?php echo esc_attr( $this->model->id ); ?>"
497
- <?php } else {
498
- $button_title = esc_html__( 'Delete', 'forminator' );
 
499
  $is_activation_key = false;
500
  ?>
501
- data-modal="delete-module"
502
- data-form-id="<?php echo esc_attr( $db_entry_id ); ?>"
503
  <?php } ?>
504
- data-modal-title="<?php esc_attr_e( 'Delete Submission', 'forminator' ); ?>"
505
- data-modal-content="<?php esc_attr_e( 'Are you sure you wish to permanently delete this submission?', 'forminator' ); ?>"
506
- data-nonce="<?php echo esc_attr( wp_create_nonce( 'forminatorQuizEntries' ) ); ?>"
507
- >
508
- <i class="sui-icon-trash" aria-hidden="true"></i> <?php echo $button_title; ?>
509
- </button>
510
 
511
- </div>
512
 
513
- </div>
514
 
515
- </td>
516
 
517
- </tr>
518
 
519
  <?php } ?>
1
  <?php
2
+ $form_type = $this->get_form_type();
3
+ $url_entry_id = filter_input( INPUT_GET, 'entry_id', FILTER_VALIDATE_INT );
4
+ $url_entry_id = $url_entry_id ? $url_entry_id : 0;
5
  foreach ( $this->entries_iterator() as $entries ) {
6
 
7
  $db_entry_id = isset( $entries['entry_id'] ) ? $entries['entry_id'] : '';
8
+ $entry_date = isset( $entries['entry_date'] ) ? $entries['entry_date'] : '';
9
 
10
  $summary = $entries['summary'];
11
  $summary_items = $summary['items'];
14
  $detail_items = $detail['items'];
15
  $quiz_entry = $detail['quiz_entry'];
16
  $integrations = $detail['integrations'];
17
+ // Open entry tab by received submission link.
18
  $cls_open_tab = $url_entry_id === (int) $db_entry_id ? 'sui-accordion-item--open' : '';
19
  ?>
20
 
21
+ <tr class="sui-accordion-item <?php echo esc_attr( $cls_open_tab ); ?>" data-entry-id="<?php echo esc_attr( $db_entry_id ); ?>">
22
 
23
  <?php foreach ( $summary_items as $key => $summary_item ) { ?>
24
 
37
 
38
  echo '</td>';
39
 
40
+ elseif ( 1 === $summary_item['colspan'] ) :
41
 
42
  echo '<td class="sui-accordion-item-title">';
43
 
48
  echo '<span aria-hidden="true"></span>';
49
 
50
  echo '<span class="sui-screen-reader-text">' . sprintf(/* translators: ... */
51
+ esc_html__( 'Select entry number %s', 'forminator' ),
52
+ esc_html( $db_entry_id )
53
+ ) . '</span>';
54
 
55
  echo '</label>';
56
 
80
 
81
  echo '<td>';
82
  echo '' . sprintf(/* translators: ... */
83
+ esc_html__( '+ %s other fields', 'forminator' ),
84
+ esc_html( $summary['num_fields_left'] )
85
+ ) . '';
86
  echo '<span class="sui-accordion-open-indicator">';
87
  echo '<span class="sui-icon-chevron-down"></span>';
88
  echo '</span>';
91
  }
92
  ?>
93
 
94
+ </tr>
95
 
96
+ <tr class="sui-accordion-item-content">
97
 
98
+ <td colspan="<?php echo esc_attr( $detail['colspan'] ); ?>">
99
 
100
+ <div class="sui-box">
101
 
102
  <div class="sui-box-body fui-entries--knowledge">
103
 
174
  $sub_key ++;
175
 
176
  if ( $sub_key === $end ) {
177
+ // No escape for Stripe & PayPal transaction links because we generate it ourselves above.
178
+ echo '<td colspan="2">' . wp_kses_post( $sub_entry['value'] ) . '</td>';
179
 
180
  } else {
181
 
207
 
208
  <?php if ( empty( $sub_entries ) ) { ?>
209
 
210
+ <?php if ( 'textarea' === $detail_item['type'] && ( isset( $detail_item['rich'] ) && 'true' === $detail_item['rich'] ) ) : ?>
211
 
212
+ <div class="fui-rich-textarea"><?php echo wp_kses_post( $detail_item['value'] ); ?></div>
213
 
214
+ <?php else : ?>
215
 
216
+ <?php echo wp_kses_post( $detail_item['value'] ); ?>
217
 
218
  <?php endif; ?>
219
 
223
 
224
  <div class="sui-form-field">
225
  <span class="sui-settings-label"><?php echo esc_html( $sub_entry['label'] ); ?></span>
226
+ <span class="sui-description"><?php echo wp_kses_post( $sub_entry['value'] ); ?></span>
227
  </div>
228
 
229
  <?php } ?>
257
 
258
  <h3 class="fui-entries-subtitle"><?php esc_html_e( 'Quiz Results', 'forminator' ); ?></h3>
259
 
260
+ <?php
261
+ if ( ! empty( $quiz_entry ) ) {
262
 
263
  if ( 'knowledge' === $form_type ) {
264
 
274
  }
275
  ?>
276
 
277
+ <p class="sui-description"><?php echo sprintf( esc_html__( 'You got %1$s/%2$s correct answers.', 'forminator' ), (int) $right, (int) $total ); ?></p>
278
 
279
  <table class="fui-entries-table">
280
 
296
  <tr>
297
  <td><strong><?php echo esc_html( $answer['question'] ); ?></strong></td>
298
  <td>
299
+ <?php
300
+ if ( $answer['isCorrect'] ) {
301
  echo '<span class="sui-tag sui-tag-success">' . esc_html( $user_answer ) . '</span>';
302
  } else {
303
  echo '<span class="sui-tag sui-tag-error">' . esc_html( $user_answer ) . '</span>';
304
+ }
305
+ ?>
306
+ </td>
307
  </tr>
308
 
309
  <?php endforeach; ?>
366
 
367
  <tr>
368
 
369
+ <td colspan="2"><?php echo wp_kses_post( sprintf( __( '<strong>Quiz Result:</strong> %s', 'forminator' ), $meta['result']['title'] ) ); ?></td>
370
 
371
  </tr>
372
 
379
  <?php } ?>
380
 
381
  <?php } else { ?>
382
+ <div class="sui-notice">
383
+ <p><?php esc_html_e( 'Quiz results are not available for this submission. The participant either couldn\'t finish the quiz or had some errors while submitting the quiz.', 'forminator' ); ?></p>
384
+ </div>
385
  <?php } ?>
386
 
387
  </div>
417
  class="sui-image"
418
  style="width: 20px; height: 20px;"
419
  />
420
+ <span style="margin-left: 10px;"><?php echo wp_kses_post( $integration['title'] ); ?></span>
421
  </div>
422
 
423
  <div>
434
 
435
  <?php else : ?>
436
 
437
+ <span><?php echo wp_kses_post( $integration['value'] ); ?></span>
438
 
439
  <?php endif; ?>
440
 
460
 
461
  <div class="">
462
  <span class="sui-settings-label"><?php echo esc_html( $sub_entry['label'] ); ?></span>
463
+ <span class="sui-description"><?php echo wp_kses_post( $sub_entry['value'] ); ?></span>
464
  </div>
465
 
466
  <?php } ?>
485
 
486
  </div>
487
 
488
+ <div class="sui-box-footer">
489
 
490
+ <button
491
+ type="button"
492
+ class="sui-button sui-button-ghost sui-button-red wpmudev-open-modal"
493
+ <?php
494
+ if ( isset( $entries['activation_key'] ) ) {
495
+ $button_title = esc_html__( 'Delete Submission & User', 'forminator' );
496
  $is_activation_key = true;
497
  ?>
498
+ data-activation-key="<?php echo esc_attr( $entries['activation_key'] ); ?>"
499
+ data-modal="delete-unconfirmed-user-module"
500
+ data-entry-id="<?php echo esc_attr( $db_entry_id ); ?>"
501
+ data-form-id="<?php echo esc_attr( $this->model->id ); ?>"
502
+ <?php
503
+ } else {
504
+ $button_title = esc_html__( 'Delete', 'forminator' );
505
  $is_activation_key = false;
506
  ?>
507
+ data-modal="delete-module"
508
+ data-form-id="<?php echo esc_attr( $db_entry_id ); ?>"
509
  <?php } ?>
510
+ data-modal-title="<?php esc_attr_e( 'Delete Submission', 'forminator' ); ?>"
511
+ data-modal-content="<?php esc_attr_e( 'Are you sure you wish to permanently delete this submission?', 'forminator' ); ?>"
512
+ data-nonce="<?php echo esc_attr( wp_create_nonce( 'forminatorQuizEntries' ) ); ?>"
513
+ >
514
+ <i class="sui-icon-trash" aria-hidden="true"></i> <?php echo wp_kses_post( $button_title ); ?>
515
+ </button>
516
 
517
+ </div>
518
 
519
+ </div>
520
 
521
+ </td>
522
 
523
+ </tr>
524
 
525
  <?php } ?>
admin/views/quiz/entries/content.php CHANGED
@@ -15,71 +15,73 @@ $submissions = $this->get_total_entries();
15
 
16
  <form method="get" class="sui-box fui-box-entries forminator-entries-actions">
17
 
18
- <div class="fui-pagination-entries sui-pagination-wrap">
19
  <?php $this->paginate(); ?>
20
- </div>
21
 
22
- <div class="sui-box fui-box-entries">
23
 
24
- <fieldset class="forminator-entries-nonce">
25
- <?php wp_nonce_field( 'forminatorQuizEntries', 'forminatorEntryNonce' ); ?>
26
- </fieldset>
27
 
28
- <div class="sui-box-body fui-box-actions">
29
 
30
- <?php $this->template( 'common/entries/prompt', array( 'submissions' => $submissions ) ); ?>
31
 
32
- <input type="hidden" name="page" value="<?php echo esc_attr( $this->get_admin_page() ); ?>">
33
- <input type="hidden" name="form_type" value="<?php echo esc_attr( $this->forminator_get_form_type() ); ?>">
34
- <input type="hidden" name="form_id" value="<?php echo esc_attr( $this->form_id ); ?>"/>
35
 
36
- <?php $this->template( 'common/entries/filter', array( 'fields' => $this->get_lead_fields() ) ); ?>
37
 
38
- </div>
39
 
40
  <?php if ( true === $is_filter_enabled ) : ?>
41
 
42
  <?php $this->template( 'common/entries/active_filters_row' ); ?>
43
 
44
- <?php endif; ?>
45
 
46
- <table class="sui-table sui-table-flushed sui-accordion fui-table-entries">
47
 
48
- <?php $this->entries_header(); ?>
49
 
50
- <tbody>
51
 
52
- <?php if ( $this->has_leads() ) {
53
- $this->template( 'quiz/entries/content-leads' );
54
- } else {
55
- $this->template( 'quiz/entries/content-leads-none' );
56
- } ?>
57
- </tbody>
 
 
58
 
59
- </table>
60
 
61
- <div class="sui-box-body">
62
 
63
- <div class="sui-box-search">
64
 
65
- <div class="sui-search-left">
66
 
67
- <?php $this->bulk_actions( 'bottom' ); ?>
68
 
69
- </div>
70
 
71
- <div class="sui-search-right">
72
 
73
- <div class="sui-pagination-wrap">
74
- <?php $this->paginate(); ?>
75
- </div>
76
 
77
- </div>
78
 
79
- </div>
80
 
81
- </div>
82
- </div>
83
 
84
  </form>
85
 
15
 
16
  <form method="get" class="sui-box fui-box-entries forminator-entries-actions">
17
 
18
+ <div class="fui-pagination-entries sui-pagination-wrap">
19
  <?php $this->paginate(); ?>
20
+ </div>
21
 
22
+ <div class="sui-box fui-box-entries">
23
 
24
+ <fieldset class="forminator-entries-nonce">
25
+ <?php wp_nonce_field( 'forminatorQuizEntries', 'forminatorEntryNonce' ); ?>
26
+ </fieldset>
27
 
28
+ <div class="sui-box-body fui-box-actions">
29
 
30
+ <?php $this->template( 'common/entries/prompt', array( 'submissions' => $submissions ) ); ?>
31
 
32
+ <input type="hidden" name="page" value="<?php echo esc_attr( $this->get_admin_page() ); ?>">
33
+ <input type="hidden" name="form_type" value="<?php echo esc_attr( $this->forminator_get_form_type() ); ?>">
34
+ <input type="hidden" name="form_id" value="<?php echo esc_attr( $this->form_id ); ?>"/>
35
 
36
+ <?php $this->template( 'common/entries/filter', array( 'fields' => $this->get_lead_fields() ) ); ?>
37
 
38
+ </div>
39
 
40
  <?php if ( true === $is_filter_enabled ) : ?>
41
 
42
  <?php $this->template( 'common/entries/active_filters_row' ); ?>
43
 
44
+ <?php endif; ?>
45
 
46
+ <table class="sui-table sui-table-flushed sui-accordion fui-table-entries">
47
 
48
+ <?php $this->entries_header(); ?>
49
 
50
+ <tbody>
51
 
52
+ <?php
53
+ if ( $this->has_leads() ) {
54
+ $this->template( 'quiz/entries/content-leads' );
55
+ } else {
56
+ $this->template( 'quiz/entries/content-leads-none' );
57
+ }
58
+ ?>
59
+ </tbody>
60
 
61
+ </table>
62
 
63
+ <div class="sui-box-body">
64
 
65
+ <div class="sui-box-search">
66
 
67
+ <div class="sui-search-left">
68
 
69
+ <?php $this->bulk_actions( 'bottom' ); ?>
70
 
71
+ </div>
72
 
73
+ <div class="sui-search-right">
74
 
75
+ <div class="sui-pagination-wrap">
76
+ <?php $this->paginate(); ?>
77
+ </div>
78
 
79
+ </div>
80
 
81
+ </div>
82
 
83
+ </div>
84
+ </div>
85
 
86
  </form>
87
 
admin/views/quiz/knowledge/header.php CHANGED
@@ -1 +1 @@
1
- <?php // phpcs:ignore
1
+ <?php
admin/views/quiz/list/content.php CHANGED
@@ -1,23 +1,19 @@
1
  <?php
2
  /** @var Forminator_Quiz_Page $this */
3
 
4
- // Search keyword
5
- $search_keyword = null;
6
- $is_search = false;
7
  $search_module_nonce = esc_attr( 'forminator-nonce-search-module' );
8
- if ( isset( $_GET['module-search'] ) && strlen( trim( $_GET['module-search'] ) ) ) {
9
- $search_keyword = sanitize_text_field( $_GET['module-search'] );
10
- $is_search = true;
11
- }
12
 
13
- // Get modules
14
  $modules = $this->getModules();
15
 
16
- // Count total quizzes
17
- $count = ! $is_search ? $this->countModules() : count( $modules );
18
 
19
- // Start date for retrieving the information of the last 30 days in sql format
20
- $sql_month_start_date = date( 'Y-m-d H:i:s', strtotime( '-30 days midnight' ) );// phpcs:ignore
21
 
22
  $entry_type = 'quizzes';
23
  $most_entry = Forminator_Form_Entry_Model::get_most_entry( $entry_type );
1
  <?php
2
  /** @var Forminator_Quiz_Page $this */
3
 
4
+ // Search keyword.
5
+ $search_keyword = Forminator_Core::sanitize_text_field( 'module-search' );
6
+ $is_search = (bool) $search_keyword;
7
  $search_module_nonce = esc_attr( 'forminator-nonce-search-module' );
 
 
 
 
8
 
9
+ // Get modules.
10
  $modules = $this->getModules();
11
 
12
+ // Count total quizzes.
13
+ $count = ! $is_search ? $this->countModules() : count( $modules );
14
 
15
+ // Start date for retrieving the information of the last 30 days in sql format.
16
+ $sql_month_start_date = date( 'Y-m-d H:i:s', strtotime( '-30 days midnight' ) );
17
 
18
  $entry_type = 'quizzes';
19
  $most_entry = Forminator_Form_Entry_Model::get_most_entry( $entry_type );
admin/views/quiz/nowrong/header.php CHANGED
@@ -1 +1 @@
1
- <?php // phpcs:ignore
1
+ <?php
admin/views/settings/content.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- $section = isset( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : 'dashboard';
3
  ?>
4
  <div class="sui-row-with-sidenav">
5
 
1
  <?php
2
+ $section = Forminator_Core::sanitize_text_field( 'section', 'dashboard' );
3
  ?>
4
  <div class="sui-row-with-sidenav">
5
 
admin/views/settings/data/forms-privacy.php CHANGED
@@ -31,13 +31,16 @@
31
  )
32
  );
33
 
34
- $form_submission_erasure_enabled = get_option( 'forminator_enable_erasure_request_erase_form_submissions', false ); ?>
 
35
  <span class="sui-settings-label"><?php esc_html_e( 'Account Erasure Requests', 'forminator' ); ?></span>
36
  <span class="sui-description">
37
  <?php
38
- /* translators: ... */
39
- echo sprintf( __( 'When handling an <a href="%s" target="_blank">account erasure request</a> that contains an email associated with a submission, what do you want to do?', 'forminator' ),
40
- esc_url( admin_url( 'erase-personal-data.php' ) )
 
 
41
  );
42
  ?>
43
  </span>
31
  )
32
  );
33
 
34
+ $form_submission_erasure_enabled = get_option( 'forminator_enable_erasure_request_erase_form_submissions', false );
35
+ ?>
36
  <span class="sui-settings-label"><?php esc_html_e( 'Account Erasure Requests', 'forminator' ); ?></span>
37
  <span class="sui-description">
38
  <?php
39
+ printf(
40
+ /* translators: ... */
41
+ esc_html__( 'When handling an %1$saccount erasure request%2$s that contains an email associated with a submission, what do you want to do?', 'forminator' ),
42
+ '<a href="' . esc_url( admin_url( 'erase-personal-data.php' ) ) . '" target="_blank">',
43
+ '</a>'
44
  );
45
  ?>
46
  </span>
admin/views/settings/payments/paypal.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'sandbox_id' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'sandbox_id' => '',
admin/views/settings/payments/section-stripe.php CHANGED
@@ -73,7 +73,7 @@ if ( $stripe_loaded ) {
73
  <?php } else { ?>
74
 
75
  <?php
76
- // SETTINGS: Authorization
77
  ?>
78
  <table class="sui-table" style="margin-top: 10px;">
79
 
@@ -149,7 +149,7 @@ if ( $stripe_loaded ) {
149
 
150
  </table>
151
 
152
- <?php // SETTINGS: Default Charge Currency ?>
153
  <div class="sui-form-field">
154
 
155
  <label for="forminator-stripe-currency" class="sui-settings-label"><?php esc_html_e( 'Default charge currency', 'forminator' ); ?></label>
73
  <?php } else { ?>
74
 
75
  <?php
76
+ // SETTINGS: Authorization.
77
  ?>
78
  <table class="sui-table" style="margin-top: 10px;">
79
 
149
 
150
  </table>
151
 
152
+ <?php // SETTINGS: Default Charge Currency. ?>
153
  <div class="sui-form-field">
154
 
155
  <label for="forminator-stripe-currency" class="sui-settings-label"><?php esc_html_e( 'Default charge currency', 'forminator' ); ?></label>
admin/views/settings/payments/stripe.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // defaults
3
  $vars = array(
4
  'error_message' => '',
5
  'test_key' => '',
1
  <?php
2
+ // defaults.
3
  $vars = array(
4
  'error_message' => '',
5
  'test_key' => '',
admin/views/settings/tab-accessibility.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- $section = isset( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : 'dashboard';
3
  $nonce = wp_create_nonce( 'forminator_save_accessibility_settings' );
4
  $accessibility_enabled = get_option( 'forminator_enable_accessibility', false );
5
  $accessibility_enabled = filter_var( $accessibility_enabled, FILTER_VALIDATE_BOOLEAN );
1
  <?php
2
+ $section = Forminator_Core::sanitize_text_field( 'section', 'dashboard' );
3
  $nonce = wp_create_nonce( 'forminator_save_accessibility_settings' );
4
  $accessibility_enabled = get_option( 'forminator_enable_accessibility', false );
5
  $accessibility_enabled = filter_var( $accessibility_enabled, FILTER_VALIDATE_BOOLEAN );
admin/views/settings/tab-dashboard.php CHANGED
@@ -21,7 +21,7 @@
21
 
22
  <div class="sui-tabs-content">
23
 
24
- <?php // TAB: Forms ?>
25
  <div tabindex="0" role="tabpanel" id="dashboard-forms-panel" class="forms-content sui-tab-content active" aria-labelledby="dashboard-forms-tab">
26
  <?php
27
  $this->template(
@@ -36,7 +36,7 @@
36
  ?>
37
  </div>
38
 
39
- <?php // TAB: Polls ?>
40
  <div tabindex="0" role="tabpanel" id="dashboard-polls-panel" class="polls-content sui-tab-content" aria-labelledby="dashboard-polls-tab" hidden>
41
  <?php
42
  $this->template(
@@ -51,7 +51,7 @@
51
  ?>
52
  </div>
53
 
54
- <?php // TAB: Quizzes ?>
55
  <div tabindex="0" role="tabpanel" id="dashboard-quizzes-panel" class="quizzes-content sui-tab-content" aria-labelledby="dashboard-quizzes-tab" hidden>
56
  <?php
57
  $this->template(
21
 
22
  <div class="sui-tabs-content">
23
 
24
+ <?php // TAB: Forms. ?>
25
  <div tabindex="0" role="tabpanel" id="dashboard-forms-panel" class="forms-content sui-tab-content active" aria-labelledby="dashboard-forms-tab">
26
  <?php
27
  $this->template(
36
  ?>
37
  </div>
38
 
39
+ <?php // TAB: Polls. ?>
40
  <div tabindex="0" role="tabpanel" id="dashboard-polls-panel" class="polls-content sui-tab-content" aria-labelledby="dashboard-polls-tab" hidden>
41
  <?php
42
  $this->template(
51
  ?>
52
  </div>
53
 
54
+ <?php // TAB: Quizzes. ?>
55
  <div tabindex="0" role="tabpanel" id="dashboard-quizzes-panel" class="quizzes-content sui-tab-content" aria-labelledby="dashboard-quizzes-tab" hidden>
56
  <?php
57
  $this->template(
admin/views/settings/tab-data.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- $section = isset( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : 'dashboard';
3
  $nonce = wp_create_nonce( 'forminator_save_popup_uninstall_settings' );
4
  $forminator_uninstall = get_option( 'forminator_uninstall_clear_data', false );
5
 
1
  <?php
2
+ $section = Forminator_Core::sanitize_text_field( 'section', 'dashboard' );
3
  $nonce = wp_create_nonce( 'forminator_save_popup_uninstall_settings' );
4
  $forminator_uninstall = get_option( 'forminator_uninstall_clear_data', false );
5
 
admin/views/settings/tab-editor.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- $forminator_editor_settings = get_option( 'forminator_editor_settings', "true" );
3
 
4
  ?>
5
  <div class="sui-box-settings-row">
@@ -19,7 +19,7 @@ $forminator_editor_settings = get_option( 'forminator_editor_settings', "true" )
19
  <input type="checkbox"
20
  name="editor_settings"
21
  value="true"
22
- id="forminator-editor-settings" <?php checked( $forminator_editor_settings, "true" ); ?>/>
23
  <span class="sui-toggle-slider" aria-hidden="true"></span>
24
  </label>
25
 
1
  <?php
2
+ $forminator_editor_settings = get_option( 'forminator_editor_settings', 'true' );
3
 
4
  ?>
5
  <div class="sui-box-settings-row">
19
  <input type="checkbox"
20
  name="editor_settings"
21
  value="true"
22
+ id="forminator-editor-settings" <?php checked( $forminator_editor_settings, 'true' ); ?>/>
23
  <span class="sui-toggle-slider" aria-hidden="true"></span>
24
  </label>
25
 
admin/views/settings/tab-general.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
- $section = isset( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : 'dashboard';
3
- $nonce = wp_create_nonce( 'forminator_save_dashboard_settings' );
4
  ?>
5
 
6
  <div class="sui-box" data-nav="dashboard" style="<?php echo esc_attr( 'dashboard' !== $section ? 'display: none;' : '' ); ?>">
1
  <?php
2
+ $section = Forminator_Core::sanitize_text_field( 'section', 'dashboard' );
3
+ $nonce = wp_create_nonce( 'forminator_save_dashboard_settings' );
4
  ?>
5
 
6
  <div class="sui-box" data-nav="dashboard" style="<?php echo esc_attr( 'dashboard' !== $section ? 'display: none;' : '' ); ?>">
admin/views/settings/tab-import.php CHANGED
@@ -1,7 +1,4 @@
1
- <?php
2
- $section = isset( $_GET['section'] ) ? $_GET['section'] : 'dashboard'; // wpcs csrf ok.
3
-
4
- ?>
5
 
6
  <div class="sui-box" data-nav="import" style="<?php echo esc_attr( 'import' !== $section ? 'display: none;' : '' ); ?>">
7
 
1
+ <?php $section = Forminator_Core::sanitize_text_field( 'section', 'dashboard' ); ?>
 
 
 
2
 
3
  <div class="sui-box" data-nav="import" style="<?php echo esc_attr( 'import' !== $section ? 'display: none;' : '' ); ?>">
4
 
admin/views/settings/tab-payments.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- $section = isset( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : 'dashboard';
3
  $plugin_url = forminator_plugin_url();
4
  $nonce = wp_create_nonce( 'forminator_save_payments_settings' );
5
  ?>
1
  <?php
2
+ $section = Forminator_Core::sanitize_text_field( 'section', 'dashboard' );
3
  $plugin_url = forminator_plugin_url();
4
  $nonce = wp_create_nonce( 'forminator_save_payments_settings' );
5
  ?>
admin/views/settings/tab-recaptcha.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- $section = isset( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : 'dashboard';
3
  $v2_captcha_key = get_option( 'fo
1
  <?php
2
+ $section = Forminator_Core::sanitize_text_field( 'section', 'dashboard' );
3
  $v2_captcha_key = get_option( 'fo