CAdvBanner::SetKeywords: Bitrix method

      
<?php 
//  CAdvBanner :: SetKeywords()
//  /dist/bitrix/modules/advertising/classes/general/advertising.php:2897

    
public static function SetKeywords($keywords$TYPE_SID=""$LOGIC="DESIRED")
    {
        global 
$arrADV_KEYWORDS;
        if (
strlen($LOGIC)<=0) return;
        if (
strlen($TYPE_SID)<=0$TYPE_SID "";
        
$arrKeywords = array();
        if (
is_array($keywords) && count($keywords)>0)
        {
            foreach(
$keywords as $word)
            {
                if (
is_array($word))
                {
                    
$exact_match $word["EXACT_MATCH"]=="Y" "Y" "N";
                    
$value $word["KEYWORD"];
                }
                else
                {
                    
$exact_match "N";
                    
$value $word;
                }
                
$arrKeywords[$exact_match][] = trim($value);
            }
        }
        else
        {
            
$arrWords explode(",",$keywords);
            if (
is_array($arrWords) && count($arrWords)>0)
            {
                foreach(
$arrWords as $word)
                {
                    if (
strlen(trim($word))>0)
                        
$arrKeywords["N"][] = trim($word);
                }
            }
        }
        if(!
is_set($arrADV_KEYWORDS$TYPE_SID)) $arrADV_KEYWORDS[$TYPE_SID] = array();
        
$arr = array("Y","N");
        foreach (
$arr as $exact_match)
        {
            
$arrWords is_array($arrKeywords[$exact_match]) ? array_unique($arrKeywords[$exact_match]) : array();
            if (
count($arrWords)>0)
            {
                
$arrTemp $arrADV_KEYWORDS[$TYPE_SID][$LOGIC][$exact_match];
                if (
is_array($arrTemp) && count($arrTemp)>0)
                {
                    
$arrTemp array_merge($arrWords$arrTemp);
                    
$arrTemp array_unique($arrTemp);
                    
$arrADV_KEYWORDS[$TYPE_SID][$LOGIC][$exact_match] = $arrTemp;
                }
                else 
$arrADV_KEYWORDS[$TYPE_SID][$LOGIC][$exact_match] = $arrWords;
            }
        }
    }