BxDolProfileForms.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup UnaCore UNA Core
  7. * @{
  8. */
  9. /**
  10. * Functions to automate profile creation/editing/deletion forms.
  11. */
  12. class BxDolProfileForms extends BxDolFactory
  13. {
  14. /**
  15. * Constructor
  16. */
  17. protected function __construct ()
  18. {
  19. parent::__construct ();
  20. }
  21. protected function _redirectAndExit ($sUrl, $isPermalink = true, $aMarkers = false)
  22. {
  23. if ($isPermalink)
  24. $sUrl = BxDolPermalinks::getInstance()->permalink($sUrl);
  25. if(!bx_has_proto($sUrl))
  26. $sUrl = BX_DOL_URL_ROOT . $sUrl;
  27. header('Location: ' . $this->_replaceMarkers($sUrl, $aMarkers));
  28. exit;
  29. }
  30. /**
  31. * Replace provided markers in a string, markers are surrounded by '{' and '}' signs, for example: a.php?x={id}
  32. * @param $mixed string or array to replace markers in
  33. * @param $aMarkers araay or markers for replacement, for example: array ('num' => 123, 'name' => 'Ivan');
  34. * @return string where all markers are replaced
  35. */
  36. protected function _replaceMarkers ($mixed, $aMarkers)
  37. {
  38. return bx_replace_markers($mixed, $aMarkers);
  39. }
  40. }
  41. /** @} */