getModuleByName($mixed); else $aModule = $oDb->getModuleById($mixed); if (empty($aModule)) return ''; $sKey = md5($mixed . $sMethod . print_r($aParams, true) . $sClass); if (!$bIgnoreCache && isset(self::$_aMemoryCache[$sKey])) return self::$_aMemoryCache[$sKey]; self::$_aMemoryCache[$sKey] = BxDolRequest::processAsService($aModule, $sMethod, $aParams, $sClass); return self::$_aMemoryCache[$sKey]; } /** * 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]) && $aMarkers) $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', isset($a['ignore_cache']) ? $a['ignore_cache'] : false); } /** * Check if string is serialized array */ public static function isSerializedService($s) { return preg_match('/^a:[\d+]:\{/', $s); } /** * Serialized service call array */ public static function getSerializedService($mixedModule, $sMethod, $aParams = array(), $sClass = '') { $aService = array( 'module' => $mixedModule, 'method' => $sMethod, ); if(!empty($aParams)) $aService['params'] = $aParams; if(!empty($sClass)) $aService['class'] = $sClass; return serialize($aService); } } /** @} */