$value)
{
// print("\nKey: "); print($key); print("\nColor: "); print($value);
$newkey = str_replace('ah_keyword_input','ah_color_input',$key);
// print("Newkey: $newkey is Array?"); print((string)(is_array($newkey)));
if ($newkey != $key && $newkey != null && array_key_exists($newkey, $_REQUEST))
{
$keyword_array[$value] = $_REQUEST[$newkey];
}
}
rss_plugins_add_option(AH_CONFIG_KEYWORDS, $keyword_array, 'array');
// }
// print("Done!");
return;
}
$keyword_array = rss_plugins_get_option(AH_CONFIG_KEYWORDS);
if($keyword_array == null || !is_array($keyword_array))
{
$keyword_array = array(AH_KEYWORDS_DEFAULT => AH_COLORS_DEFAULT);
}
?>
\n";
echo "
\n";
$count = 0;
foreach($keyword_array as $keyword => $color)
{
if ($color == null)
{
$color = AH_COLORS_DEFAULT;
}
echo "
\n" . "\n";
echo ""."
\n";
$count++;
}
echo "\n";
echo "\n";
return;
}
function _autohighlighter_js($js) {
$js[] = getPath(). RSS_PLUGINS_DIR . "/autohighlighter.php?ahjs";
return $js;
}
function _autohighlighter_execute_js($dummy) {
$keywordArray = rss_plugins_get_option(AH_CONFIG_KEYWORDS);
echo "";
echo "\n\n";
return $dummy;
}
if (isset($_REQUEST['ahjs'])) {
?>
// This routine taken from http://www.squarefree.com/bookmarklets/pagedata.html
function __highlight(regexp,color) {
var count = 0;
var count2 = 0;
function searchWithinNode(node, re)
{
var pos, skip, spannode, middlebit, endbit, middleclone;
skip=0;
if( node.nodeType==3 )
{
pos=node.data.search(re);
if(pos>=0)
{
spannode=document.createElement("SPAN");
spannode.style.backgroundColor=color;
middlebit=node.splitText(pos);
endbit=middlebit.splitText(RegExp.$1.length);
middleclone=middlebit.cloneNode(true);
spannode.appendChild(middleclone);
middlebit.parentNode.replaceChild(spannode,middlebit);
++count;
skip=1;
}
}
else if( node.nodeType==1 && node.childNodes &&
node.tagName.toUpperCase()!="SCRIPT" &&
node.tagName.toUpperCase()!="STYLE")
{
for (var child=0; child < node.childNodes.length; ++child) {
child=child+searchWithinNode(node.childNodes[child], re);
}
}
return skip;
}
searchWithinNode(document.getElementById("items"), regexp);
}