protected function replaceDeprecatedApis($xhtml) {
    	$dom = new DOMDocument('1.0', TAO_DEFAULT_ENCODING);
    	if (!$dom->loadHTML($xhtml)){
    		throw new taoItems_models_classes_ItemModelException("An error occured while loading the XML content of the rendered item.");
    	}

    	$found = 0;
    	$deprecatedApis = array('taoApi', 'wfApi');
    	foreach ($deprecatedApis as $pattern){
    		$found += taoItems_helpers_Xhtml::removeScriptElements($dom, '/' . $pattern . '/i');
    	}
    	if ($found > 0) {
    		common_Logger::i('found '.$found.' references to deprecated APIs, replacing with legacy API');
	    	$taoItemsExt = common_ext_ExtensionsManager::singleton()->getExtensionById('taoItems');
	    	$legacyApiSrc = Template::js('legacyApi/taoLegacyApi.min.js', 'taoItems');
	    	taoItems_helpers_Xhtml::addScriptElement($dom, $legacyApiSrc);
    	}
    	return $dom->saveHTML();
    }
protected function replaceDeprecatedApis($xhtml) {
    	$dom = new DOMDocument('1.0', TAO_DEFAULT_ENCODING);
    	if (!$dom->loadHTML($xhtml)){
    		throw new taoItems_models_classes_ItemModelException("An error occured while loading the XML content of the rendered item.");
    	}

    	$found = 0;
    	$deprecatedApis = array('taoApi', 'wfApi');
    	foreach ($deprecatedApis as $pattern){
    		$found += taoItems_helpers_Xhtml::removeScriptElements($dom, '/' . $pattern . '/i');
    	}
    	if ($found > 0) {
    		common_Logger::i('found '.$found.' references to deprecated APIs, replacing with legacy API');
	    	$taoItemsExt = common_ext_ExtensionsManager::singleton()->getExtensionById('taoItems');
	    	$legacyApiSrc = Template::js('legacyApi/taoLegacyApi.min.js', 'taoItems');
	    	taoItems_helpers_Xhtml::addScriptElement($dom, $legacyApiSrc);
    	}
    	return $dom->saveHTML();
    }
protected function replaceDeprecatedApis ( $ xhtml ) { $ dom = new DOMDocument ( '1.0' , TAO_DEFAULT_ENCODING ) ; if ( ! $ dom -> loadHTML ( $ xhtml ) ) { throw new taoItems_models_classes_ItemModelException ( "An error occured while loading the XML content of the rendered item." ) ; } $ found = 0 ; $ deprecatedApis = array ( 'taoApi' , 'wfApi' ) ; foreach ( $ deprecatedApis as $ pattern ) { $ found += taoItems_helpers_Xhtml :: removeScriptElements ( $ dom , '/' . $ pattern . '/i' ) ; } if ( $ found > 0 ) { common_Logger :: i ( 'found ' . $ found . ' references to deprecated APIs, replacing with legacy API' ) ; $ taoItemsExt = common_ext_ExtensionsManager :: singleton ( ) -> getExtensionById ( 'taoItems' ) ; $ legacyApiSrc = Template :: js ( 'legacyApi/taoLegacyApi.min.js' , 'taoItems' ) ; taoItems_helpers_Xhtml :: addScriptElement ( $ dom , $ legacyApiSrc ) ; } return $ dom -> saveHTML ( ) ; }
Removes unnescessary API references

@param Resource $item
Removes unnescessary API references