BxDolProfileForms.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  4. * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  5. *
  6. * @defgroup DolphinCore Dolphin Core
  7. * @{
  8. */
  9. /**
  10. * Functions to automate profile creation/editing/deletion forms.
  11. */
  12. class BxDolProfileForms extends BxDol {
  13. /**
  14. * Constructor
  15. */
  16. protected function __construct () {
  17. parent::__construct ();
  18. }
  19. // TODO: remake all calls and include markers with content and profile id at least
  20. protected function _redirectAndExit ($sUrl, $isPermalink = true, $aMarkers = false) {
  21. if ($isPermalink) {
  22. bx_import('BxDolPermalinks');
  23. $sUrl = BxDolPermalinks::getInstance()->permalink($sUrl);
  24. }
  25. header('Location: ' . BX_DOL_URL_ROOT . $this->_replaceMarkers($sUrl, $aMarkers));
  26. exit;
  27. }
  28. /**
  29. * Replace provided markers in a string, markers are surrounded by '{' and '}' signs, for example: a.php?x={id}
  30. * @param $mixed string or array to replace markers in
  31. * @param $aMarkers araay or markers for replacement, for example: array ('num' => 123, 'name' => 'Ivan');
  32. * @return string where all markers are replaced
  33. */
  34. protected function _replaceMarkers ($mixed, $aMarkers) {
  35. return bx_replace_markers($mixed, $aMarkers);
  36. }
  37. }
  38. /** @} */