/** * @param eZTemplate $tpl * @param string $operatorName * @param array $operatorParameters * @param string $rootNamespace * @param string $currentNamespace * @param mixed $operatorValue * @param array $namedParameters */ function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters) { switch ($operatorName) { case 'timestampToDateISO': $operatorValue = date('c', $namedParameters['timestamp']); break; case 'ezstr_replace': $operatorValue = str_replace( $namedParameters['search'], $namedParameters['replace'], $namedParameters['text'] ); break; case 'hash_set': $hash = $namedParameters['hash']; $hash[$namedParameters['key']] = $namedParameters['val']; $operatorValue = $hash; break; case 'currentApplication': $operatorValue = ApplicationDefault::instance(); break; case 'getApplicationName': if ($namedParameters['application'] instanceof ApplicationDefault) { $operatorValue = $namedParameters['application']->applicationName(); } break; case 'getTableEmbeddedName': $pattern = '/<td class="MMTableCellHead" ?.*>(.*)<\/td>/'; preg_match_all($pattern, $namedParameters['htmlCode'], $matches); $operatorValue = $matches[1][0]; break; case 'external_app_cookie_key': $operatorValue = ExternalApplication::createExternalApplicationCookieKey( $namedParameters['localized_application'] ); break; case 'getCurrentCluster': $operatorValue = ClusterTool::clusterIdentifier(); break; case 'checkIfSiteMatchesType': $contexts = array( ContextTool::APP_MOBILE_DESIGN, ContextTool::FRONT_DESIGN, ContextTool::MOBILE_DESIGN ); $operatorValue = (in_array($namedParameters['site_type'], $contexts)) ? ContextTool::instance( )->siteIsTypeOf($namedParameters['site_type']) : false; break; case 'import_status_xml_mdd': $statusXmlMdd = array( 1 => 'COMPLETE_SUCCESS', 2 => 'SUCCESS_WITH_WARNINGS', 3 => 'BLOCKING_ERROR', 4 => 'CRITICAL_ERROR', 5 => 'FATAL_ERROR' ); $operatorValue = (isset($statusXmlMdd[$namedParameters['status']]) ? $statusXmlMdd[$namedParameters['status']] : $namedParameters['status']); break; case 'import_status_mdd_ez': $statusMddEz = array( '-1' => 'DO_NOT_TREAT', 0 => 'INITIAL', 1 => 'SYNCHRO', 2 => 'ARTICLE_REF', 4 => 'CRITICAL_ERROR', 8 => 'FATAL_ERROR' ); $operatorValue = (isset($statusMddEz[$namedParameters['status']]) ? $statusMddEz[$namedParameters['status']] : $namedParameters['status']); break; case 'getUserCustomerType': $user = MMUsers::getCurrentUserObject(); $operatorValue = ($user) ? $user->attribute('customer_type') : 'User not logged in'; break; case 'isUserDataMissing': $instance = MMUserData::instance(); $operatorValue = $instance->isUserDataMissing($namedParameters['name']); break; case 'isMobile': $operatorValue = ContextTool::instance()->isMobile(); break; case 'getExternalConfiguration': $operatorValue = ApplicationExternalConfiguration::getExternalConfiguration($namedParameters['id']); break; case 'getLocalizedApplicationByIdentifier': $operatorValue = CacheApplicationTool::buildLocalizedApplicationByIdentifier( $namedParameters['identifier'] ); break; case 'getWebtrendsTimezone': $d = new DateTime('now', new DateTimeZone(eZINI::instance()->variable('TimeZoneSettings', 'TimeZone'))); $operatorValue = ($d->getOffset() / 3600); break; case 'getChinaProvinceCity': $operatorValue = ChinaLocation::fetchProvincesAndCities(); break; case 'isCatchUpAppNameEnabled': $operatorValue = MMGlobalSearch::isCatchUpAppNameEnabled(); break; case 'gmdate': $operatorValue = gmdate($namedParameters['format'], $namedParameters['duration']); break; case 'mb_strtoupper': $operatorValue = mb_strtoupper($namedParameters['str']); break; case 'preg_replace': $operatorValue = preg_replace( $namedParameters['pattern'], $namedParameters['replacement'], $namedParameters['subject'], $namedParameters['$limit'] ); break; case 'html_entity_decode': $operatorValue = html_entity_decode($namedParameters['string']); break; case 'urlencode': $operatorValue = urlencode($namedParameters['string']); break; case 'json_encode': $operatorValue = json_encode($namedParameters['value']); break; case 'domain': $operatorValue = ContextTool::instance()->domain(); break; case 'getUumpDateFormat': $operatorValue = SolrSafeOperatorHelper::clusterIni('EsbDateConvert', 'FormatDate', 'merck.ini' ); break; case 'html_contains_image': $operatorValue = SolrSafeOperatorHelper::htmlContainsImage($namedParameters['string']); break; case 'preg_match': $operatorValue = preg_match ( $namedParameters['pattern'], $namedParameters['subject'] ); break; } }