コード例 #1
0
 /**
  * Replace provided markers in string.
  * @param $s - string to replace markers in
  * @param $a - markers array
  * @return string with replaces markers
  */
 protected function _replaceMarkers($mixed, $aMarkers)
 {
     if (empty($mixed) || empty($aMarkers) || !is_array($aMarkers)) {
         return $mixed;
     }
     return bx_replace_markers($mixed, $aMarkers);
 }
コード例 #2
0
ファイル: BxDolService.php プロジェクト: blas-dmx/trident
 /**
  * Perform serice call by accepting serialized array of service call parameters:
  * @code
  *     array (
  *         'module' => 'system', // module name
  *         'method' => 'test', // service method name
  *         'params' => array(), // array of parameters to pass to service method
  *         'class' => 'Module', // class to search service method in
  *     )
  * @endcode
  *
  * @param $s serialized array of serice call
  * @param $aMarkers service method name in format 'method_name', corresponding class metod is serviceMethodName
  * @param $sReplaceIn params to pass to service method
  * @return service call result
  */
 public static function callSerialized($s, $aMarkers = array(), $sReplaceIn = 'params')
 {
     $a = @unserialize($s);
     if (false === $a || !is_array($a)) {
         return '';
     }
     if (isset($a[$sReplaceIn])) {
         $a[$sReplaceIn] = bx_replace_markers($a[$sReplaceIn], $aMarkers);
     }
     return self::call($a['module'], $a['method'], isset($a['params']) ? $a['params'] : array(), isset($a['class']) ? $a['class'] : 'Module');
 }
コード例 #3
0
ファイル: BxBaseRss.php プロジェクト: blas-dmx/trident
 public function getFeed($mixedId, $iUserId = 0)
 {
     $sUrl = $this->getUrl($mixedId);
     $aMarkers = array('SiteUrl' => BX_DOL_URL_ROOT);
     if ($iUserId) {
         $oProfile = BxDolProfile::getInstance($iUserId);
         if (!$oProfile) {
             $oProfile = BxDolProfileUndefined::getInstance();
         }
         $aMarkers['NickName'] = $oProfile->getDisplayName();
     }
     $sUrl = bx_replace_markers($sUrl, $aMarkers);
     header('Content-Type: text/xml; charset=utf-8');
     return bx_file_get_contents($sUrl . (defined('BX_PROFILER') && BX_PROFILER && 0 == strncmp(BX_DOL_URL_ROOT, $sUrl, strlen(BX_DOL_URL_ROOT)) ? '&bx_profiler_disable=1' : ''));
 }
コード例 #4
0
ファイル: BxDolCmts.php プロジェクト: blas-dmx/trident
 /**
  * Replace provided markers in a string
  * @param $mixed string or array to replace markers in
  * @return string where all occured markers are replaced
  */
 protected function _replaceMarkers($mixed)
 {
     return bx_replace_markers($mixed, $this->_aMarkers);
 }
コード例 #5
0
ファイル: BxDolEditor.php プロジェクト: blas-dmx/trident
 /**
  * Replace provided markers string.
  * @param $s - string to replace markers in
  * @param $a - markers array
  * @return string with replaces markers
  */
 protected function _replaceMarkers($s, $a)
 {
     if (empty($s) || empty($a) || !is_array($a)) {
         return $s;
     }
     return bx_replace_markers($s, $a);
 }
コード例 #6
0
 public function getRssHelpUrl()
 {
     return bx_replace_markers($this->sPageRssHelpUrl, $this->aMarkers);
 }
コード例 #7
0
ファイル: utils.inc.php プロジェクト: blas-dmx/trident
function bx_replace_markers($mixed, $aMarkers)
{
    if (empty($aMarkers)) {
        return $mixed;
    }
    if (is_array($mixed)) {
        foreach ($mixed as $sKey => $sValue) {
            $mixed[$sKey] = bx_replace_markers($sValue, $aMarkers);
        }
    } else {
        foreach ($aMarkers as $sKey => $sValue) {
            $mixed = str_replace('{' . $sKey . '}', $sValue, $mixed);
        }
    }
    return $mixed;
}
コード例 #8
0
ファイル: BxDolMenu.php プロジェクト: blas-dmx/trident
 /**
  * Replace provided markers in menu item array, curently markers are replaced in title, link and onclick fields.
  * @param $a menu item array
  * @return array where markes are replaced with real values
  */
 protected function _replaceMarkers($a)
 {
     if (empty($this->_aMarkers)) {
         return $a;
     }
     $aReplacebleFields = array('title', 'link', 'onclick');
     foreach ($aReplacebleFields as $sField) {
         if (isset($a[$sField])) {
             $a[$sField] = bx_replace_markers($a[$sField], $this->_aMarkers);
         }
     }
     return $a;
 }
コード例 #9
0
ファイル: BxDolGrid.php プロジェクト: blas-dmx/trident
 /**
  * Replace provided markers in form array
  * @param $a form description array
  * @return array where markes are replaced with real values
  */
 protected function _replaceMarkers()
 {
     $this->_aOptions['source'] = bx_replace_markers($this->_aOptions['source'], $this->_aMarkers);
 }