serialize.inc 773 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * @file
  4. * The Node export serialize format handler.
  5. *
  6. * Adds serialize format to Node export.
  7. */
  8. /**
  9. * Export callback.
  10. */
  11. function node_export_serialize_export($nodes, $format) {
  12. return 'node_export_serialize::' . htmlspecialchars(serialize($nodes));
  13. }
  14. /**
  15. * Import callback.
  16. */
  17. function node_export_serialize_import($code_string) {
  18. // Check for 'node_export_serialize::' at the start.
  19. if (substr(ltrim($code_string), 0, 23) == 'node_export_serialize::') {
  20. return unserialize(htmlspecialchars_decode(str_replace('node_export_serialize::', '', $code_string)));
  21. }
  22. }
  23. /**
  24. * Callback for actions.
  25. */
  26. function node_export_serialize_action_form($context, &$form_state) {
  27. return node_export_action_form($context, $form_state, 'serialize');
  28. }