diff --git a/src/UNL/Search/CSEGenerator.php b/src/UNL/Search/CSEGenerator.php index c518deb7eb6e32f02c3cf04f12a5d38e0c1b5192..9d8b219d7e56c40e0a872972540d08af5357ba01 100644 --- a/src/UNL/Search/CSEGenerator.php +++ b/src/UNL/Search/CSEGenerator.php @@ -1,50 +1,47 @@ -<?php +<?php class UNL_Search_CSEGenerator { public static function generateCSE($url) { - $xml = '<CustomSearchEngine volunteers="false" - keywords="unl" - language="en" - visible="false" - encoding="UTF-8"> - <Title>UNL Custom Search Engine for '.htmlentities($url, ENT_QUOTES).'</Title> + $xml = ' +<GoogleCustomizations> + <CustomSearchEngine> + <Title>UNL Custom Search Engine for '. htmlentities($url, ENT_QUOTES) . '</Title> <Description>This custom search engine was automatically generated by the UNL Web Developer Network.</Description> <Context> <BackgroundLabels> - <Label name="_cse_local_site" mode="FILTER"/> + <Label name="_cse_localsite" mode="FILTER"/> + <Label name="_cse_exclude_localsite" mode="EXCLUDE"/> </BackgroundLabels> - </Context> - <LookAndFeel nonprofit="true"/> - <Annotations>'; + <LookAndFeel nonprofit="true"/> + </CustomSearchEngine>'; + $xml .= ' + <Annotations>'; foreach (UNL_Search_CSEGenerator::getIncludedSites($url) as $include) { $xml .= " - <Annotation about=\"$include*\"> - <Label name=\"_cse_local_site\"/> - </Annotation>"; + <Annotation about=\"$include*\"> + <Label name=\"_cse_localsite\"/> + </Annotation>"; } foreach (UNL_Search_CSEGenerator::getExcludedSites($url) as $exclude) { $xml .= " <Annotation about=\"$exclude*\"> - <Label name=\"_cse_exclude_local_site\"/> + <Label name=\"_cse_exclude_localsite\"/> </Annotation>"; } $xml .= ' </Annotations> - <LookAndFeel resultsurl="http://www1.unl.edu/search/" nonprofit="true" adsposition="11"> - <Colors url="#008000" background="#FFFFFF" border="#FFFFFF" title="#C60202" text="#000000" visited="#990000" light="#000000" /> - </LookAndFeel> - </CustomSearchEngine>'; +</GoogleCustomizations>'; return $xml; } - + public static function getIncludedSites($baseurl) { $baseurl = str_replace('http://', '', $baseurl); return array($baseurl); } - + public static function getExcludedSites($baseurl) { return array();