Skip to content
Snippets Groups Projects
Commit 5c8d8e0a authored by Kevin Abel's avatar Kevin Abel
Browse files

Updated the XML schema of the custom local search. Still appear to not be working properly.

parent 8cc86a96
No related branches found
No related tags found
No related merge requests found
<?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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment