NF_Database_MockData

The Ninja Forms NF Database MockData class.

Defined (1)

The class is defined in the following location(s).

/includes/Database/MockData.php  
  1. final class NF_Database_MockData 
  2.  
  3. public function __construct() 
  4. $this->_migrate(); 
  5.  
  6. public function saved_fields() 
  7. $field = Ninja_Forms()->form()->field()->get(); 
  8. $field->update_setting( 'label', __( 'Foo', 'ninja-forms' ) ); 
  9. $field->update_setting( 'key', 'foo' ); 
  10. $field->update_setting( 'type', 'textbox' ); 
  11. $field->update_setting( 'saved', 1 ); 
  12. $field->save(); 
  13.  
  14. $field = Ninja_Forms()->form()->field()->get(); 
  15. $field->update_setting( 'label', __( 'Bar', 'ninja-forms' ) ); 
  16. $field->update_setting( 'key', 'bar' ); 
  17. $field->update_setting( 'type', 'checkbox' ); 
  18. $field->update_setting( 'saved', 1 ); 
  19. $field->save(); 
  20.  
  21. $field = Ninja_Forms()->form()->field()->get(); 
  22. $field->update_setting( 'label', __( 'Baz', 'ninja-forms' ) ); 
  23. $field->update_setting( 'key', 'baz' ); 
  24. $field->update_setting( 'type', 'listselect' ); 
  25. $field->update_setting( 'saved', 1 ); 
  26. $field->save(); 
  27.  
  28. public function form_blank_form() 
  29. /** 
  30. * FORM 
  31. */ 
  32.  
  33. $form = Ninja_Forms()->form()->get(); 
  34. $form->update_setting( 'title', __( 'Blank Forms', 'ninja-forms' ) ); 
  35. $form->update_setting( 'default_label_pos', 'above' ); 
  36. $form->save(); 
  37.  
  38. public function form_contact_form_1() 
  39. /** 
  40. * FORM 
  41. */ 
  42.  
  43. $form = Ninja_Forms()->form()->get(); 
  44. $form->update_setting( 'title', __( 'Contact Me', 'ninja-forms' ) ); 
  45. $form->update_setting( 'default_label_pos', 'above' ); 
  46. $form->save(); 
  47.  
  48. $form_id = $form->get_id(); 
  49.  
  50. /** 
  51. * FIELDS 
  52. */ 
  53.  
  54. $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  55. $field->update_setting( 'type', 'textbox' ) 
  56. ->update_setting( 'label', __( 'Name', 'ninja-forms' ) ) 
  57. ->update_setting( 'label_pos', 'above' ) 
  58. ->update_setting( 'required', 1 ) 
  59. ->update_setting( 'order', 1 ) 
  60. ->update_setting( 'key', 'name' ) 
  61. ->update_setting( 'placeholder', '' ) 
  62. ->update_setting( 'default', '' ) 
  63. ->update_setting( 'wrapper_class', '' ) 
  64. ->update_setting( 'element_class', '' ) 
  65. ->save(); 
  66.  
  67. $name_field_id = $field->get_id(); 
  68.  
  69. $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  70. $field->update_setting( 'type', 'email' ) 
  71. ->update_setting( 'label', __( 'Email', 'ninja-forms' ) ) 
  72. ->update_setting( 'label_pos', 'above' ) 
  73. ->update_setting( 'required', 1 ) 
  74. ->update_setting( 'order', 2 ) 
  75. ->update_setting( 'key', 'email' ) 
  76. ->update_setting( 'placeholder', '' ) 
  77. ->update_setting( 'default', '' ) 
  78. ->update_setting( 'wrapper_class', '' ) 
  79. ->update_setting( 'element_class', '' ) 
  80. ->save(); 
  81.  
  82. $email_field_id = $field->get_id(); 
  83.  
  84. // $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  85. // $field->update_setting( 'type', 'textbox' ) 
  86. // ->update_setting( 'label', 'Confirm Email') 
  87. // ->update_setting( 'label_pos', 'above' ) 
  88. // ->update_setting( 'confirm_field', $email_field_id ) 
  89. // ->update_setting( 'required', 1 ) 
  90. // ->update_setting( 'order', 3 ) 
  91. // ->save(); 
  92.  
  93. $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  94. $field->update_setting( 'type', 'textarea' ) 
  95. ->update_setting( 'label', __( 'Message', 'ninja-forms' ) ) 
  96. ->update_setting( 'label_pos', 'above' ) 
  97. ->update_setting( 'required', 1 ) 
  98. ->update_setting( 'order', 3 ) 
  99. ->update_setting( 'key', 'message' ) 
  100. ->update_setting( 'placeholder', '' ) 
  101. ->update_setting( 'default', '' ) 
  102. ->update_setting( 'wrapper_class', '' ) 
  103. ->update_setting( 'element_class', '' ) 
  104. ->save(); 
  105.  
  106. // $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  107. // $field->update_setting( 'type', 'textbox' ) 
  108. // ->update_setting( 'label', 'Mirror Name') 
  109. // ->update_setting( 'label_pos', 'above' ) 
  110. // ->update_setting( 'required', 1 ) 
  111. // ->update_setting( 'mirror_field', $name_field_id ) 
  112. // ->update_setting( 'order', 5 ) 
  113. // ->save(); 
  114.  
  115. $options = array( 
  116. array( 
  117. 'label' => __( 'One', 'ninja-forms' ),  
  118. 'value' => '1',  
  119. 'calc' => 1,  
  120. 'order' => 1,  
  121. 'selected' => 0,  
  122. ),  
  123. array( 
  124. 'label' => __( 'Two', 'ninja-forms' ),  
  125. 'value' => '2',  
  126. 'calc' => 2,  
  127. 'order' => 2,  
  128. 'selected' => 1,  
  129. ),  
  130. array( 
  131. 'label' => __( 'Three', 'ninja-forms' ),  
  132. 'value' => '3',  
  133. 'calc' => 3,  
  134. 'order' => 3,  
  135. 'selected' => 0,  
  136. ),  
  137. ); 
  138.  
  139. $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  140. $field->update_setting( 'type', 'listradio' ) 
  141. ->update_setting( 'label_pos', 'above') 
  142. ->update_setting( 'label', __( 'List', 'ninja-forms' ) ) 
  143. ->update_setting( 'required', 0) 
  144. ->update_setting( 'options', $options) 
  145. ->update_setting( 'order', 4 ) 
  146. ->update_setting( 'key', 'list' ) 
  147. ->update_setting( 'placeholder', '' ) 
  148. ->update_setting( 'default', '' ) 
  149. ->update_setting( 'wrapper_class', '' ) 
  150. ->update_setting( 'element_class', '' ) 
  151. ->save(); 
  152.  
  153. $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  154. $field->update_setting( 'type', 'submit' ) 
  155. ->update_setting( 'label', __( 'Submit', 'ninja-forms' ) ) 
  156. ->update_setting( 'processing_label', 'Processing' ) 
  157. ->update_setting( 'order', 5 ) 
  158. ->update_setting( 'key', 'submit' ) 
  159. ->save(); 
  160.  
  161. /** 
  162. * ACTIONS 
  163. */ 
  164.  
  165. $action = Ninja_Forms()->form( $form_id )->action()->get(); 
  166. $action->update_setting( 'label', __( 'Mock Success Message Action', 'ninja-forms' ) ) 
  167. ->update_setting( 'type', 'successmessage' ) 
  168. ->update_setting( 'message', __( 'Thank you {field:name} for filling out my form!', 'ninja-forms' ) ) 
  169. ->update_setting( 'active', TRUE ) 
  170. ->save(); 
  171.  
  172. // $action = Ninja_Forms()->form( $form_id )->action()->get(); 
  173. // $action->update_setting( 'label', 'Mock Redirect Action' ) 
  174. // ->update_setting( 'type', 'redirect' ) 
  175. // ->update_setting( 'url', 'http://kstover.codes' ) 
  176. // ->update_setting( 'active', 0 ) 
  177. // ->save(); 
  178.  
  179. $action = Ninja_Forms()->form( $form_id )->action()->get(); 
  180. $action->update_setting( 'label', __( 'Mock Email Action', 'ninja-forms' ) ) 
  181. ->update_setting( 'type', 'email' ) 
  182. ->update_setting( 'to', 'myformbuildingbringsallthedeveloperstotheyard@wpninjas.com' ) 
  183. ->update_setting( 'subject', __( 'This is an email action.', 'ninja-forms' ) ) 
  184. ->update_setting( 'message', __( 'Hello, Ninja Forms!', 'ninja-forms' ) ) 
  185. ->update_setting( 'active', FALSE ) 
  186. ->save(); 
  187.  
  188. // $action = Ninja_Forms()->form( $form_id )->action()->get(); 
  189. // $action->update_setting( 'label', 'Run WordPress Action' ) 
  190. // ->update_setting( 'type', 'custom' ) 
  191. // ->update_setting( 'hook', 'action' ) 
  192. // ->update_setting( 'tag', 'blarg_action' ) 
  193. // ->save(); 
  194.  
  195. $action = Ninja_Forms()->form( $form_id )->action()->get(); 
  196. $action->update_setting( 'label', __( 'Mock Save Action', 'ninja-forms' ) ) 
  197. ->update_setting( 'type', 'save' ) 
  198. ->update_setting( 'active', TRUE ) 
  199. ->save(); 
  200.  
  201. /** 
  202. * SUBMISSIONS 
  203. */ 
  204.  
  205. $sub = Ninja_Forms()->form( $form_id )->sub()->get(); 
  206. $sub->update_field_value( 1, __( 'Foo Bar', 'ninja-forms' ) ) 
  207. ->update_field_value( 2, __( 'foo@wpninjas.com', 'ninja-forms' ) ) 
  208. ->update_field_value( 3, __( 'This is a test', 'ninja-forms' ) ) 
  209. ->update_field_value( 4, '2' ) 
  210. ->update_field_value( 5, __( 'Foo Bar', 'ninja-forms' ) ); 
  211. $sub->save(); 
  212.  
  213. // Delay Execution for different submission dates 
  214. sleep(1); 
  215.  
  216. $sub = Ninja_Forms()->form( $form_id )->sub()->get(); 
  217. $sub->update_field_value( 1, __( 'John Doe', 'ninja-forms' ) ) 
  218. ->update_field_value( 2, __( 'user@gmail.com', 'ninja-forms' ) ) 
  219. ->update_field_value( 3, __( 'This is another test.', 'ninja-forms' ) ) 
  220. ->update_field_value( 4, '3' ) 
  221. ->update_field_value( 5, __( 'John Doe', 'ninja-forms' ) ); 
  222. $sub->save(); 
  223.  
  224. public function form_contact_form_2() 
  225. /** 
  226. * FORM 
  227. */ 
  228.  
  229. $form = Ninja_Forms()->form()->get(); 
  230. $form->update_setting( 'title', __( 'Get Help', 'ninja-forms' ) ); 
  231. $form->update_setting( 'default_label_pos', 'above' ); 
  232. $form->save(); 
  233.  
  234. $form_id = $form->get_id(); 
  235.  
  236. /** 
  237. * FIELDS 
  238. */ 
  239.  
  240. $fields = array( 
  241. array( 
  242. 'type' => 'textbox',  
  243. 'label' => __( 'Name', 'ninja-forms' ),  
  244. 'label_pos' => 'above',  
  245. 'order' => 1,  
  246. 'key' => 'name',  
  247. ),  
  248. array( 
  249. 'type' => 'email',  
  250. 'label' => __( 'Email', 'ninja-forms' ),  
  251. 'label_pos' => 'above',  
  252. 'order' => 2,  
  253. 'key' => 'email',  
  254. ),  
  255. array( 
  256. 'type' => 'textarea',  
  257. 'label' => __( 'What Can We Help You With?', 'ninja-forms' ),  
  258. 'label_pos' => 'above',  
  259. 'order' => 3,  
  260. 'key' => 'message',  
  261. ),  
  262. array( 
  263. 'type' => 'checkbox',  
  264. 'label' => __( 'Agree?', 'ninja-forms' ),  
  265. 'label_pos' => 'right',  
  266. 'order' => 4,  
  267. 'key' => 'agree',  
  268. ),  
  269. array( 
  270. 'type' => 'listradio',  
  271. 'label' => __( 'Best Contact Method?', 'ninja-forms' ),  
  272. 'label_pos' => 'above',  
  273. 'options' => array( 
  274. array( 
  275. 'label' => __( 'Phone', 'ninja-forms' ),  
  276. 'value' => 'phone',  
  277. 'calc' => '',  
  278. 'order' => 1,  
  279. 'selected' => 0,  
  280. ),  
  281. array( 
  282. 'label' => __( 'Email', 'ninja-forms' ),  
  283. 'value' => 'email',  
  284. 'calc' => '',  
  285. 'order' => 2,  
  286. 'selected' => 0,  
  287. ),  
  288. array( 
  289. 'label' => __( 'Snail Mail', 'ninja-forms' ),  
  290. 'value' => 'snail-mail',  
  291. 'calc' => '',  
  292. 'order' => 3,  
  293. 'selected' => 0,  
  294. ),  
  295. ),  
  296. 'show_other' => 1,  
  297. 'required' => 1,  
  298. 'order' => 5,  
  299. 'key' => 'contact_method',  
  300. ),  
  301. array( 
  302. 'type' => 'submit',  
  303. 'label' => __( 'Send', 'ninja-forms' ),  
  304. 'order' => 6,  
  305. 'key' => 'submit',  
  306. ); 
  307.  
  308. foreach( $fields as $settings ) { 
  309.  
  310. $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  311. $field->update_settings( $settings )->save(); 
  312.  
  313. /** 
  314. * ACTIONS 
  315. */ 
  316.  
  317. $action = Ninja_Forms()->form( $form_id )->action()->get(); 
  318. $action->update_setting( 'label', __( 'Mock Save Action', 'ninja-forms' ) ) 
  319. ->update_setting( 'type', 'save' ) 
  320. ->save(); 
  321.  
  322. public function form_kitchen_sink() 
  323. /** 
  324. * FORM 
  325. */ 
  326. $form = Ninja_Forms()->form()->get(); 
  327. $form->update_setting( 'title', __( 'Kitchen Sink', 'ninja-forms' ) ); 
  328. $form->update_setting( 'default_label_pos', 'above' ); 
  329. $form->save(); 
  330.  
  331. $form_id = $form->get_id(); 
  332.  
  333. /** 
  334. * FIELDS 
  335. */ 
  336.  
  337. $fields = array( 
  338. array( 
  339. 'type' => 'html',  
  340. 'label' => __( 'Textbox', 'ninja-forms' ),  
  341. 'key' => 'textbox',  
  342. ),  
  343. array( 
  344. 'type' => 'textbox',  
  345. 'label' => __( 'Textbox', 'ninja-forms' ),  
  346. 'key' => 'textbox',  
  347. ),  
  348. array( 
  349. 'type' => 'firstname',  
  350. 'label' => __( 'First Name', 'ninja-forms' ),  
  351. 'key' => 'first_name',  
  352. ),  
  353. array( 
  354. 'type' => 'lastname',  
  355. 'label' => __( 'Last Name', 'ninja-forms' ),  
  356. 'key' => 'last_name',  
  357. ),  
  358. array( 
  359. 'type' => 'hidden',  
  360. 'label' => __( 'Hidden', 'ninja-forms' ),  
  361. 'label_pos' => 'hidden',  
  362. 'key' => 'hidden',  
  363. ),  
  364. array( 
  365. 'type' => 'textarea',  
  366. 'label' => __( 'Textarea', 'ninja-forms' ),  
  367. 'key' => 'textarea',  
  368. ),  
  369. array( 
  370. 'type' => 'listselect',  
  371. 'label' => __( 'Select List', 'ninja-forms' ),  
  372. 'options' => array( 
  373. array( 
  374. 'label' => __( 'Option One', 'ninja-forms' ),  
  375. 'value' => 1,  
  376. 'calc' => '',  
  377. 'order' => 1,  
  378. 'selected' => 0,  
  379. ),  
  380. array( 
  381. 'label' => __( 'Option Two', 'ninja-forms' ),  
  382. 'value' => 2,  
  383. 'calc' => '',  
  384. 'order' => 2,  
  385. 'selected' => 0,  
  386. ),  
  387. array( 
  388. 'label' => __( 'Option Three', 'ninja-forms' ),  
  389. 'value' => 3,  
  390. 'calc' => '',  
  391. 'order' => 3,  
  392. 'selected' => 0,  
  393. ),  
  394. 'key' => 'select_list',  
  395. ),  
  396. array( 
  397. 'type' => 'listradio',  
  398. 'label' => __( 'Radio List', 'ninja-forms' ),  
  399. 'options' => array( 
  400. array( 
  401. 'label' => __( 'Option One', 'ninja-forms' ),  
  402. 'value' => 1,  
  403. 'calc' => '',  
  404. 'order' => 1,  
  405. 'selected' => 0,  
  406. ),  
  407. array( 
  408. 'label' => __( 'Option Two', 'ninja-forms' ),  
  409. 'value' => 2,  
  410. 'calc' => '',  
  411. 'order' => 2,  
  412. 'selected' => 0,  
  413. ),  
  414. array( 
  415. 'label' => __( 'Option Three', 'ninja-forms' ),  
  416. 'value' => 3,  
  417. 'calc' => '',  
  418. 'order' => 3,  
  419. 'selected' => 0,  
  420. ),  
  421. 'key' => 'radio_list',  
  422. ),  
  423. array( 
  424. 'type' => 'checkbox',  
  425. 'label' => __( 'Checkbox', 'ninja-forms' ),  
  426. 'key' => 'checkbox',  
  427. ),  
  428. // array( 
  429. // 'type' => 'button',  
  430. // 'label' => 'Button',  
  431. // 'label_pos' => 'hidden',  
  432. // ),  
  433. ); 
  434.  
  435. $order = 1; 
  436. $i = 1; 
  437. foreach( array( 'above', 'right', 'below', 'left', 'hidden' ) as $label_pos ) { 
  438.  
  439.  
  440. foreach ($fields as $settings) { 
  441.  
  442. unset($settings['id']); 
  443.  
  444. $settings[ 'key' ] = $settings[ 'key' ] . '-' . $i; 
  445.  
  446. if ( ! isset( $settings['label_pos'] ) ) $settings['label_pos'] = $label_pos; 
  447.  
  448. if ( 'submit' != $settings['type'] ) $settings['label'] = $settings['label'] . ' - label ' . $label_pos; 
  449.  
  450. if ( 'hidden' == $settings['label_pos'] && 'submit' != $settings['type'] ) $settings['placeholder'] = $settings['label']; 
  451.  
  452. $field = Ninja_Forms()->form($form_id)->field()->get(); 
  453.  
  454. $settings[ 'order' ] = $order; 
  455.  
  456. $field->update_settings($settings)->save(); 
  457.  
  458. $order++; 
  459. $order++; 
  460. $i++; 
  461.  
  462. $submit = Ninja_Forms()->form($form_id)->field()->get(); 
  463. $submit->update_setting( 'label', __( 'Submit', 'ninja-forms' ) ) 
  464. ->update_setting( 'type', 'submit' ) 
  465. ->update_setting( 'order', $order) 
  466. ->update_setting( 'key', 'submit' ) 
  467. ->save(); 
  468.  
  469. $action = Ninja_Forms()->form( $form_id )->action()->get(); 
  470. $action->update_setting( 'label', __( 'Mock Save Action', 'ninja-forms' ) ) 
  471. ->update_setting( 'type', 'save' ) 
  472. ->save(); 
  473.  
  474. public function form_bathroom_sink() 
  475. /** 
  476. * FORM 
  477. */ 
  478. $form = Ninja_Forms()->form()->get(); 
  479. $form->update_setting( 'title', __( 'Bathroom Sink', 'ninja-forms' ) ); 
  480. $form->update_setting( 'default_label_pos', 'above' ); 
  481. $form->save(); 
  482.  
  483. $form_id = $form->get_id(); 
  484.  
  485. /** 
  486. * FIELDS 
  487. */ 
  488.  
  489. $fields = array( 
  490. array( 
  491. 'type' => 'html',  
  492. 'label' => '',  
  493. 'label_pos' => 'hidden',  
  494. 'key' => 'html_1',  
  495. 'default' => '<div style="background:#DBF0FD; padding: 15px;"><h3>Common Fields</h3><div>These are all the most common generic fields one might use.</div></div>',  
  496. ),  
  497. array( 
  498. 'type' => 'textbox',  
  499. 'label' => __( 'Textbox', 'ninja-forms' ),  
  500. 'key' => 'textbox',  
  501. ),  
  502. array( 
  503. 'type' => 'textarea',  
  504. 'label' => __( 'Textarea', 'ninja-forms' ),  
  505. 'key' => 'textarea',  
  506. ),  
  507. array( 
  508. 'type' => 'checkbox',  
  509. 'label' => __( 'Checkbox', 'ninja-forms' ),  
  510. 'key' => 'checkbox',  
  511. ),  
  512. array( 
  513. 'type' => 'listselect',  
  514. 'label' => __( 'Select List', 'ninja-forms' ),  
  515. 'options' => array( 
  516. array( 
  517. 'label' => __( 'Option One', 'ninja-forms' ),  
  518. 'value' => 1,  
  519. 'calc' => '',  
  520. 'order' => 1,  
  521. 'selected' => 0,  
  522. ),  
  523. array( 
  524. 'label' => __( 'Option Two', 'ninja-forms' ),  
  525. 'value' => 2,  
  526. 'calc' => '',  
  527. 'order' => 2,  
  528. 'selected' => 0,  
  529. ),  
  530. array( 
  531. 'label' => __( 'Option Three', 'ninja-forms' ),  
  532. 'value' => 3,  
  533. 'calc' => '',  
  534. 'order' => 3,  
  535. 'selected' => 0,  
  536. ),  
  537. 'key' => 'select_list',  
  538. ),  
  539. array( 
  540. 'type' => 'listradio',  
  541. 'label' => __( 'Radio List', 'ninja-forms' ),  
  542. 'options' => array( 
  543. array( 
  544. 'label' => __( 'Option One', 'ninja-forms' ),  
  545. 'value' => 1,  
  546. 'calc' => '',  
  547. 'order' => 1,  
  548. 'selected' => 0,  
  549. ),  
  550. array( 
  551. 'label' => __( 'Option Two', 'ninja-forms' ),  
  552. 'value' => 2,  
  553. 'calc' => '',  
  554. 'order' => 2,  
  555. 'selected' => 0,  
  556. ),  
  557. array( 
  558. 'label' => __( 'Option Three', 'ninja-forms' ),  
  559. 'value' => 3,  
  560. 'calc' => '',  
  561. 'order' => 3,  
  562. 'selected' => 0,  
  563. ),  
  564. 'key' => 'radio_list',  
  565. ),  
  566. array( 
  567. 'type' => 'listcheckbox',  
  568. 'label' => __( 'Checkbox List', 'ninja-forms' ),  
  569. 'options' => array( 
  570. array( 
  571. 'label' => __( 'Option One', 'ninja-forms' ),  
  572. 'value' => 1,  
  573. 'calc' => '',  
  574. 'order' => 1,  
  575. 'selected' => 0,  
  576. ),  
  577. array( 
  578. 'label' => __( 'Option Two', 'ninja-forms' ),  
  579. 'value' => 2,  
  580. 'calc' => '',  
  581. 'order' => 2,  
  582. 'selected' => 0,  
  583. ),  
  584. array( 
  585. 'label' => __( 'Option Three', 'ninja-forms' ),  
  586. 'value' => 3,  
  587. 'calc' => '',  
  588. 'order' => 3,  
  589. 'selected' => 0,  
  590. ),  
  591. 'key' => 'checkbox_list',  
  592. ),  
  593. array( 
  594. 'type' => 'date',  
  595. 'label' => __( 'Date', 'ninja-forms' ),  
  596. 'key' => 'date',  
  597. ),  
  598. array( 
  599. 'type' => 'number',  
  600. 'label' => __( 'Number', 'ninja-forms' ),  
  601. 'key' => 'number',  
  602. 'num_min' => '0',  
  603. 'num_max' => '100',  
  604. 'num_step' => '1',  
  605. ),  
  606. array( 
  607. 'type' => 'hidden',  
  608. 'label' => __( 'Hidden', 'ninja-forms' ),  
  609. 'label_pos' => 'hidden',  
  610. 'key' => 'hidden',  
  611. ),  
  612. // array( 
  613. // 'type' => 'hr',  
  614. // 'label' => 'Divider',  
  615. // 'label_pos' => 'hidden',  
  616. // 'key' => 'hr_1',  
  617. // ),  
  618. array( 
  619. 'type' => 'html',  
  620. 'label' => '',  
  621. 'label_pos' => 'hidden',  
  622. 'key' => 'html_2',  
  623. 'default' => '<div style="background:#DBF0FD; padding: 15px;"><h3>' . __( 'User Information Fields', 'ninja-forms' ) . 
  624. '</h3><div>' . __( 'These are all the fields in the User Information section.', 'ninja-forms' ) . '</div></div>',  
  625. ),  
  626. array( 
  627. 'type' => 'firstname',  
  628. 'label' => __( 'First Name', 'ninja-forms' ),  
  629. 'key' => 'first_name',  
  630. ),  
  631. array( 
  632. 'type' => 'lastname',  
  633. 'label' => __( 'Last Name', 'ninja-forms' ),  
  634. 'key' => 'last_name',  
  635. ),  
  636. array( 
  637. 'type' => 'email',  
  638. 'label' => __( 'Email', 'ninja-forms' ),  
  639. 'key' => 'email',  
  640. ),  
  641. array( 
  642. 'type' => 'phone',  
  643. 'label' => __( 'Phone', 'ninja-forms' ),  
  644. 'key' => 'phone',  
  645. ),  
  646. array( 
  647. 'type' => 'address',  
  648. 'label' => __( 'Address', 'ninja-forms' ),  
  649. 'key' => 'address',  
  650. ),  
  651. array( 
  652. 'type' => 'city',  
  653. 'label' => __( 'City', 'ninja-forms' ),  
  654. 'key' => 'city',  
  655. ),  
  656. // array( 
  657. // 'type' => 'liststate',  
  658. // 'label' => 'State',  
  659. // 'key' => 'state',  
  660. // ),  
  661. array( 
  662. 'type' => 'zip',  
  663. 'label' => __( 'Zip Code', 'ninja-forms' ),  
  664. 'key' => 'zip',  
  665. ),  
  666. array( 
  667. 'type' => 'html',  
  668. 'label' => '',  
  669. 'label_pos' => 'hidden',  
  670. 'key' => 'html_3',  
  671. 'default' => '<div style="background:#DBF0FD; padding: 15px;"><h3>' . __( "Pricing Fields", "ninja-forms" ) . 
  672. '</h3><div>' . __( "These are all the fields in the Pricing section.", "ninja-forms" ) . '</div></div>',  
  673. ),  
  674. array( 
  675. 'type' => 'product',  
  676. 'label' => __( 'Product (quanitity included)', 'ninja-forms' ),  
  677. 'key' => 'product_qty',  
  678. 'product_use_quantity' => 1,  
  679. 'product_price' => '5.00',  
  680. ),  
  681. array( 
  682. 'type' => 'product',  
  683. 'label' => __( 'Product (seperate quantity)', 'ninja-forms' ),  
  684. 'key' => 'product',  
  685. 'product_use_quantity' => 0,  
  686. 'product_price' => '5.00',  
  687. ),  
  688. array( 
  689. 'type' => 'quantity',  
  690. 'label' => __( 'Quantity', 'ninja-forms' ),  
  691. 'key' => 'quantity',  
  692. 'product_assignment' => '999',  
  693. 'num_min' => '0',  
  694. 'num_max' => '',  
  695. 'num_step' => '1',  
  696. ),  
  697. array( 
  698. 'type' => 'shipping',  
  699. 'label' => __( 'Shipping', 'ninja-forms' ),  
  700. 'key' => 'shipping',  
  701. 'shipping_cost' => '10.00',  
  702. ),  
  703. array( 
  704. 'type' => 'total',  
  705. 'label' => __( 'Total', 'ninja-forms' ),  
  706. 'key' => 'total',  
  707. ),  
  708. array( 
  709. 'type' => 'creditcardfullname',  
  710. 'label' => __( 'Credit Card Full Name', 'ninja-forms' ),  
  711. 'key' => 'creditcardfullname',  
  712. ),  
  713. array( 
  714. 'type' => 'creditcardnumber',  
  715. 'label' => __( 'Credit Card Number', 'ninja-forms' ),  
  716. 'key' => 'creditcardnumber',  
  717. ),  
  718. array( 
  719. 'type' => 'creditcardcvc',  
  720. 'label' => __( 'Credit Card CVV', 'ninja-forms' ),  
  721. 'key' => 'creditcardcvc',  
  722. ),  
  723. array( 
  724. 'type' => 'creditcardexpiration',  
  725. 'label' => __( 'Credit Card Expiration', 'ninja-forms' ),  
  726. 'key' => 'creditcardexpiration',  
  727. ),  
  728. array( 
  729. 'type' => 'creditcardzip',  
  730. 'label' => __( 'Credit Card Zip Code', 'ninja-forms' ),  
  731. 'key' => 'creditcardzip',  
  732. ),  
  733. array( 
  734. 'type' => 'html',  
  735. 'label' => '',  
  736. 'label_pos' => 'hidden',  
  737. 'key' => 'html_3',  
  738. 'default' => '<div style="background:#DBF0FD; padding: 15px;"><h3>' . __( "Miscellaneous Fields", "ninja-forms" ) . 
  739. '</h3><div>' . __( "These are various special fields.", "ninja-forms" ) . '</div></div>',  
  740. ),  
  741. array( 
  742. 'type' => 'starrating',  
  743. 'label' => __( 'Star Rating', 'ninja-forms' ),  
  744. 'key' => 'starrating',  
  745. 'default' => '5',  
  746. ),  
  747. array( 
  748. 'type' => 'spam',  
  749. 'label' => __( 'Anti-Spam Question (Answer = answer)', 'ninja-forms' ),  
  750. 'key' => 'spam',  
  751. 'spam_answer' => __( 'answer', 'ninja-forms' ),  
  752. ),  
  753. array( 
  754. 'type' => 'hr',  
  755. 'label' => '',  
  756. 'key' => 'hr',  
  757. ),  
  758. ); 
  759.  
  760. $order = 1; 
  761. foreach ($fields as $settings) { 
  762.  
  763. unset($settings['id']); 
  764.  
  765. $field = Ninja_Forms()->form($form_id)->field()->get(); 
  766.  
  767. $settings[ 'order' ] = $order; 
  768.  
  769. $settings[ 'label_pos' ] = 'default'; 
  770.  
  771. $field->update_settings($settings)->save(); 
  772.  
  773. $order++; 
  774.  
  775. $submit = Ninja_Forms()->form($form_id)->field()->get(); 
  776. $submit->update_setting( 'label', __( 'Submit', 'ninja-forms' ) ) 
  777. ->update_setting( 'type', 'submit' ) 
  778. ->update_setting( 'order', $order) 
  779. ->update_setting( 'process_label', __( 'processing', 'ninja-forms' ) ) 
  780. ->update_setting( 'key', 'submit' ) 
  781. ->save(); 
  782.  
  783. $action = Ninja_Forms()->form( $form_id )->action()->get(); 
  784. $action->update_setting( 'label', __( 'Mock Save Action', 'ninja-forms' ) ) 
  785. ->update_setting( 'type', 'save' ) 
  786. ->save(); 
  787.  
  788. public function form_long_form( $num_fields = 500 ) 
  789. /** 
  790. * FORM 
  791. */ 
  792.  
  793. $form = Ninja_Forms()->form()->get(); 
  794. $form->update_setting( 'title', __( 'Long Form - ', 'ninja-forms' ) . $num_fields . __( ' Fields', 'ninja-forms' ) ); 
  795. $form->update_setting( 'default_label_pos', 'above' ); 
  796. $form->save(); 
  797.  
  798. $form_id = $form->get_id(); 
  799.  
  800. /** 
  801. * FIELDS 
  802. */ 
  803.  
  804. for( $i = 1; $i <= $num_fields; $i++ ) { 
  805. $field = Ninja_Forms()->form($form_id)->field()->get(); 
  806. $field->update_setting( 'type', 'textbox' ) 
  807. ->update_setting( 'label', __( 'Field #', 'ninja-forms' ) . $i ) 
  808. ->update_setting( 'label_pos', 'above' ) 
  809. ->update_setting( 'required', 0 ) 
  810. ->update_setting( 'order', $i ) 
  811. ->update_setting( 'key', 'field_' . $i ) 
  812. ->save(); 
  813.  
  814. public function form_email_submission() 
  815. /** 
  816. * FORM 
  817. */ 
  818.  
  819. $form = Ninja_Forms()->form()->get(); 
  820. $form->update_setting( 'title', __( 'Email Subscription Form', 'ninja-forms' ) ); 
  821. $form->update_setting( 'default_label_pos', 'above' ); 
  822. $form->save(); 
  823.  
  824. $form_id = $form->get_id(); 
  825.  
  826. /** 
  827. * FIELDS 
  828. */ 
  829.  
  830. $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  831. $field->update_setting( 'type', 'email' ) 
  832. ->update_setting( 'label', __( 'Email Address', 'ninja-forms' ) ) 
  833. ->update_setting( 'label_pos', 'hidden' ) 
  834. ->update_setting( 'required', 1 ) 
  835. ->update_setting( 'order', 1 ) 
  836. ->update_setting( 'placeholder', __( 'Enter your email address', 'ninja-forms' ) ) 
  837. ->update_setting( 'wrapper_class', 'three-fourths first' ) 
  838. ->update_setting( 'key', 'email' ) 
  839. ->save(); 
  840.  
  841. $email_field_id = $field->get_id(); 
  842.  
  843. $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  844. $field->update_setting( 'type', 'submit' ) 
  845. ->update_setting( 'label', __( 'Subscribe', 'ninja-forms' ) ) 
  846. ->update_setting( 'order', 5 ) 
  847. ->update_setting( 'wrapper_class', 'one-fourth' ) 
  848. ->update_setting( 'key', 'submit' ) 
  849. ->save(); 
  850.  
  851.  
  852. public function form_product_1() 
  853. /** FORM */ 
  854. $form = Ninja_Forms()->form()->get(); 
  855. $form->update_setting( 'title', __( 'Product Form (with Quantity Field)', 'ninja-forms' ) ); 
  856. $form->update_setting( 'default_label_pos', 'above' ); 
  857. $form->update_setting( 'hide_successfully_completed_form', 1 ); 
  858. $form->save(); 
  859.  
  860. $form_id = $form->get_id(); 
  861.  
  862. /** Fields */ 
  863. $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  864. $field->update_setting( 'type', 'product' ) 
  865. ->update_setting( 'label', __( 'Product', 'ninja-forms' )) 
  866. ->update_setting( 'label_pos', 'above' ) 
  867. ->update_setting( 'product_price', 10.10 ) 
  868. ->update_setting( 'product_use_quantity', 0 ) 
  869. ->update_setting( 'order', 1 ) 
  870. ->update_setting( 'key', 'product' ) 
  871. ->save(); 
  872.  
  873. $product_field_id = $field->get_id(); 
  874.  
  875. $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  876. $field->update_setting( 'type', 'quantity' ) 
  877. ->update_setting( 'label', __( 'Quantity', 'ninja-forms' )) 
  878. ->update_setting( 'label_pos', 'above' ) 
  879. ->update_setting( 'product_assignment', $product_field_id ) 
  880. ->update_setting( 'default', 1 ) 
  881. ->update_setting( 'num_min', 1 ) 
  882. ->update_setting( 'num_max', NULL ) 
  883. ->update_setting( 'num_step', 1 ) 
  884. ->update_setting( 'order', 2 ) 
  885. ->update_setting( 'key', 'quantity' ) 
  886. ->save(); 
  887.  
  888. $quantity_field_id = $field->get_id(); 
  889.  
  890. $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  891. $field->update_setting( 'type', 'shipping' ) 
  892. ->update_setting( 'label', __( 'Shipping', 'ninja-forms' ) ) 
  893. ->update_setting( 'label_pos', 'above' ) 
  894. ->update_setting( 'shipping_cost', 2.00 ) 
  895. ->update_setting( 'order', 4 ) 
  896. ->update_setting( 'key', 'shipping' ) 
  897. ->save(); 
  898.  
  899. $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  900. $field->update_setting( 'type', 'total' ) 
  901. ->update_setting( 'label', __( 'Total', 'ninja-forms' ) ) 
  902. ->update_setting( 'label_pos', 'above' ) 
  903. ->update_setting( 'key', 'total' ) 
  904. ->update_setting( 'order', 5 ) 
  905. ->update_setting( 'key', 'total' ) 
  906. ->save(); 
  907.  
  908. $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  909. $field->update_setting( 'type', 'submit' ) 
  910. ->update_setting( 'label', __( 'Purchase', 'ninja-forms' ) ) 
  911. ->update_setting( 'order', 1000 ) 
  912. ->update_setting( 'key', 'submit' ) 
  913. ->save(); 
  914.  
  915. /** 
  916. * ACTIONS 
  917. */ 
  918.  
  919. $action = Ninja_Forms()->form( $form_id )->action()->get(); 
  920. $action->update_setting( 'label', __( 'Success Message', 'ninja-forms' ) ) 
  921. ->update_setting( 'type', 'successmessage' ) 
  922. ->update_setting( 'message', '<div style="border: 2px solid green; padding: 10px; color: green;">' . __( 'You purchased ', 'ninja-forms' ) . 
  923. '{field:' . $quantity_field_id . '}' . __( 'product(s) for ', 'ninja-forms' ) . '${field:total}.</div>' ) 
  924. ->save(); 
  925.  
  926. public function form_product_2() 
  927. /** FORM */ 
  928. $form = Ninja_Forms()->form()->get(); 
  929. $form->update_setting( 'title', __( 'Product Form (Inline Quantity)', 'ninja-forms' ) ); 
  930. $form->update_setting( 'default_label_pos', 'above' ); 
  931. $form->update_setting( 'hide_successfully_completed_form', 1 ); 
  932. $form->save(); 
  933.  
  934. $form_id = $form->get_id(); 
  935.  
  936. /** Fields */ 
  937. $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  938. $field->update_setting( 'type', 'product' ) 
  939. ->update_setting( 'label', __( 'Product', 'ninja-forms' ) ) 
  940. ->update_setting( 'label_pos', 'above' ) 
  941. ->update_setting( 'product_price', 10.10 ) 
  942. ->update_setting( 'product_use_quantity', 1 ) 
  943. ->update_setting( 'order', 1 ) 
  944. ->update_setting( 'key', 'product' ) 
  945. ->save(); 
  946.  
  947. $product_field_id = $field->get_id(); 
  948.  
  949. $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  950. $field->update_setting( 'type', 'shipping' ) 
  951. ->update_setting( 'label', __( 'Shipping', 'ninja-forms' ) ) 
  952. ->update_setting( 'label_pos', 'above' ) 
  953. ->update_setting( 'shipping_cost', 2.00 ) 
  954. ->update_setting( 'order', 4 ) 
  955. ->update_setting( 'key', 'shipping' ) 
  956. ->save(); 
  957.  
  958. $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  959. $field->update_setting( 'type', 'total' ) 
  960. ->update_setting( 'label', __( 'Total', 'ninja-forms' ) ) 
  961. ->update_setting( 'label_pos', 'above' ) 
  962. ->update_setting( 'key', 'total' ) 
  963. ->update_setting( 'order', 5 ) 
  964. ->update_setting( 'key', 'total' ) 
  965. ->save(); 
  966.  
  967. $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  968. $field->update_setting( 'type', 'submit' ) 
  969. ->update_setting( 'label', __( 'Purchase', 'ninja-forms' ) ) 
  970. ->update_setting( 'order', 1000 ) 
  971. ->update_setting( 'key', 'submit' ) 
  972. ->save(); 
  973.  
  974. /** 
  975. * ACTIONS 
  976. */ 
  977.  
  978. $action = Ninja_Forms()->form( $form_id )->action()->get(); 
  979. $action->update_setting( 'label', __( 'Success Message', 'ninja-forms' ) ) 
  980. ->update_setting( 'type', 'successmessage' ) 
  981. ->update_setting( 'message', '<div style="border: 2px solid green; padding: 10px; color: green;">' . __( 'You purchased ', 'ninja-forms' ) . 
  982. '{field:' . $product_field_id . '}' . __( ' product(s) for ', 'ninja-forms' ) . '${field:total}' . '.' . '</div>' ) 
  983. ->save(); 
  984.  
  985. public function form_product_3() 
  986. /** FORM */ 
  987. $form = Ninja_Forms()->form()->get(); 
  988. $form->update_setting( 'title', __( 'Product Form (Multiple Products)', 'ninja-forms' ) ); 
  989. $form->update_setting( 'default_label_pos', 'above' ); 
  990. $form->update_setting( 'hide_successfully_completed_form', 1 ); 
  991. $form->save(); 
  992.  
  993. $form_id = $form->get_id(); 
  994.  
  995. /** Fields */ 
  996. $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  997. $field->update_setting( 'type', 'product' ) 
  998. ->update_setting( 'label', __( 'Product A', 'ninja-forms' ) ) 
  999. ->update_setting( 'label_pos', 'above' ) 
  1000. ->update_setting( 'product_price', 10.10 ) 
  1001. ->update_setting( 'product_use_quantity', 0 ) 
  1002. ->update_setting( 'order', 1 ) 
  1003. ->update_setting( 'key', 'product_a' ) 
  1004. ->save(); 
  1005.  
  1006. $product_field_A_id = $field->get_id(); 
  1007.  
  1008. $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  1009. $field->update_setting( 'type', 'quantity' ) 
  1010. ->update_setting( 'label', __( 'Quantity for Product A', 'ninja-forms' ) ) 
  1011. ->update_setting( 'label_pos', 'above' ) 
  1012. ->update_setting( 'product_assignment', $product_field_A_id ) 
  1013. ->update_setting( 'default', 1 ) 
  1014. ->update_setting( 'num_min', 1 ) 
  1015. ->update_setting( 'num_max', NULL ) 
  1016. ->update_setting( 'num_step', 1 ) 
  1017. ->update_setting( 'order', 2 ) 
  1018. ->update_setting( 'key', 'qauntity_for_product_a' ) 
  1019. ->save(); 
  1020.  
  1021. $quantity_field_A_id = $field->get_id(); 
  1022.  
  1023. $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  1024. $field->update_setting( 'type', 'product' ) 
  1025. ->update_setting( 'label', __( 'Product B', 'ninja-forms' ) ) 
  1026. ->update_setting( 'label_pos', 'above' ) 
  1027. ->update_setting( 'product_price', 9.23 ) 
  1028. ->update_setting( 'product_use_quantity', 0 ) 
  1029. ->update_setting( 'order', 3 ) 
  1030. ->update_setting( 'key', 'product_b' ) 
  1031. ->save(); 
  1032.  
  1033. $product_field_B_id = $field->get_id(); 
  1034.  
  1035. $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  1036. $field->update_setting( 'type', 'quantity' ) 
  1037. ->update_setting( 'label', __( 'Quantity for Product B', 'ninja-forms' ) ) 
  1038. ->update_setting( 'label_pos', 'above' ) 
  1039. ->update_setting( 'product_assignment', $product_field_B_id ) 
  1040. ->update_setting( 'default', 1 ) 
  1041. ->update_setting( 'num_min', 1 ) 
  1042. ->update_setting( 'num_max', NULL ) 
  1043. ->update_setting( 'num_step', 1 ) 
  1044. ->update_setting( 'order', 4 ) 
  1045. ->update_setting( 'key', 'quantity_for_product_b' ) 
  1046. ->save(); 
  1047.  
  1048. $quantity_field_B_id = $field->get_id(); 
  1049.  
  1050. $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  1051. $field->update_setting( 'type', 'shipping' ) 
  1052. ->update_setting( 'label', __( 'Shipping', 'ninja-forms' ) ) 
  1053. ->update_setting( 'label_pos', 'above' ) 
  1054. ->update_setting( 'shipping_cost', 2.00 ) 
  1055. ->update_setting( 'order', 998 ) 
  1056. ->update_setting( 'key', 'shipping' ) 
  1057. ->save(); 
  1058.  
  1059. $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  1060. $field->update_setting( 'type', 'total' ) 
  1061. ->update_setting( 'label', __( 'Total', 'ninja-forms' ) ) 
  1062. ->update_setting( 'label_pos', 'above' ) 
  1063. ->update_setting( 'key', 'total' ) 
  1064. ->update_setting( 'order', 999 ) 
  1065. ->update_setting( 'key', 'total' ) 
  1066. ->save(); 
  1067.  
  1068. $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  1069. $field->update_setting( 'type', 'submit' ) 
  1070. ->update_setting( 'label', __( 'Purchase', 'ninja-forms' ) ) 
  1071. ->update_setting( 'order', 1000 ) 
  1072. ->update_setting( 'key', 'submit' ) 
  1073. ->save(); 
  1074.  
  1075. /** 
  1076. * ACTIONS 
  1077. */ 
  1078.  
  1079. $action = Ninja_Forms()->form( $form_id )->action()->get(); 
  1080. $action->update_setting( 'label', __( 'Success Message', 'ninja-forms' ) ) 
  1081. ->update_setting( 'type', 'successmessage' ) 
  1082. ->update_setting( 'message', '<div style="border: 2px solid green; padding: 10px; color: green;">' . __( 'You purchased ', 'ninja-forms' ) . 
  1083. '{field:' . $quantity_field_A_id . '}' . __( 'of Product A and ', 'ninja-forms' ) . '{field:' . $quantity_field_B_id . '}' . 
  1084. __( 'of Product B for $', 'ninja-forms' ) . '{field:total}.</div>' ) 
  1085. ->save(); 
  1086.  
  1087. public function form_calc_form() 
  1088. /** 
  1089. * FORM 
  1090. */ 
  1091.  
  1092. $form = Ninja_Forms()->form()->get(); 
  1093. $form->update_setting( 'title', __( 'Form with Calculations', 'ninja-forms' ) ); 
  1094. $form->update_setting( 'default_label_pos', 'above' ); 
  1095. $form->update_setting( 'calculations', array( 
  1096. array( 
  1097. 'name' => __( 'My First Calculation', 'ninja-forms' ),  
  1098. 'eq' => '2 * 3' 
  1099. ),  
  1100. array( 
  1101. 'name' => __( 'My Second Calculation', 'ninja-forms' ),  
  1102. 'eq' => '4 + 1' 
  1103. )); 
  1104. $form->save(); 
  1105.  
  1106. $form_id = $form->get_id(); 
  1107.  
  1108. $field = Ninja_Forms()->form( $form_id )->field()->get(); 
  1109. $field->update_setting( 'type', 'submit' ) 
  1110. ->update_setting( 'label', __( 'Purchase', 'ninja-forms' ) ) 
  1111. ->update_setting( 'order', 1000 ) 
  1112. ->update_setting( 'key', 'submit' ) 
  1113. ->save(); 
  1114.  
  1115. $action = Ninja_Forms()->form( $form_id )->action()->get(); 
  1116. $action->update_setting( 'label', __( 'Success Message', 'ninja-forms' ) ) 
  1117. ->update_setting( 'type', 'successmessage' ) 
  1118. ->update_setting( 'message', __( 'Calculations are returned with the AJAX response ( response -> data -> calcs', 'ninja-forms' ) ) 
  1119. ->save(); 
  1120.  
  1121. private function _migrate() 
  1122. $migrations = new NF_Database_Migrations(); 
  1123. $migrations->nuke(TRUE, TRUE); 
  1124.  
  1125. $posts = get_posts('post_type=nf_sub&numberposts=-1'); 
  1126. foreach ($posts as $post) { 
  1127. wp_delete_post($post->ID, TRUE); 
  1128.  
  1129. $migrations->migrate(); 
  1130.  
  1131. } // END CLASS NF_Database_MockData