Wedding Chicks
function set_searchteaser($row,$c){ $a2=banner([1,'between250',CMSMODE*1]); $a3=banner([1,'between120',CMSMODE*1]); $a3=is_array($a3)?array_merge($a3,$a3,$a3,$a3):$a3; $a4=[30,29,33,25]; if(isset($row['published'])){ $t=strtotime($row['published']); $row['published']=''; } $row['image']=lazylink($row['image'],1); return taglayout('searchteaser',$row).($c%6==3?'
':'').($c%6?'':getinhalt('module',array_shift($a4))); } function search($words,$i,$next=0,$max=32){ $qn='ext_search'; $val=''; if($i=='' and !BOTUSER and $r=googlesearch(implode('+',$words),$next)){ foreach($r['items'] as $c=>$v){ $link=$v['link']; $inhaltname=''; if(strpos($link,'/blog/')){ $inhaltname='blog'; }else if(strpos($link,'/modul/trending-')){ $inhaltname='trendings'; }else if(strpos($link,'/modul/inspiration-')){ $inhaltname='inspirations'; }else if(strpos($link,'/vendor/portfolio-')){ $inhaltname='vendors'; } $img=@$v['pagemap']['metatags'][0]['og:image']?:@$v['pagemap']['creativework'][0]['image']?:@$v['pagemap']['cse_image'][0]['src']?:''; //if(!strpos($img,'weddingchicks.com')){$img='';} $val.=set_searchteaser(['inhaltname'=>$inhaltname,'image'=>$img,'link'=>$link,'title'=>html_entity_decode($v['htmlTitle'],ENT_QUOTES, 'UTF-8'),'published'=>@$v['pagemap']['metatags'][0]['article:published_time'],'text'=>html_entity_decode(str_replace('
','',$v['htmlSnippet']),ENT_QUOTES, 'UTF-8')],$c); } }else{ $words=word_filer($words); if(count($words)>0){ $qwords=array_map('mE',$words); $q="(CASE WHEN inhaltname='blog' THEN 30 WHEN inhaltname='vendors' OR inhaltname='trendings' THEN 20 ELSE 10 END)"; $res=mQ("SELECT inhaltname,inhaltid FROM `searchindex` WHERE".($i?" inhaltname='".mE($i)."' AND":'')." (INSTR(`word`,'".implode("') OR INSTR(`word`,'",$qwords)."')) GROUP BY inhaltname,inhaltid ORDER BY ".(count($words)>1?"TRUNCATE(SUM(CASE WHEN `word` = '".implode("' OR `word` = '",$qwords)."' THEN $q ELSE 1 END),-1)":$q)." DESC, datum DESC LIMIT ".($max*$next).",$max",$qn); $c=0; $a2=banner([1,'between250',CMSMODE*1]); $a3=banner([1,'between120',CMSMODE*1]); $a3=is_array($a3)?array_merge($a3,$a3,$a3,$a3):$a3; $a4=[30,29,33,25]; $img=''; while($rows=mO($res)){ $text=$titel=''; if($rows->inhaltname=='blog'){ if(!$row=mA("SELECT a.*,b.rubrik,c.name autor FROM `blog` a JOIN `inhalt` b ON a.inhalt=b.id JOIN `cmsuser` c ON c.`id`=a.`autor` WHERE a.id=".$rows->inhaltid,$qn)){continue;} $blog_type=preg_split('//',$row['type'],2, PREG_SPLIT_NO_EMPTY); if($blog_type[0]==2 and isset($blog_type[1])){ $row=array_merge($row,mA("SELECT titel, images FROM trendings WHERE id=".$blog_type[1],$qn)?:[]); $row['image']=stristr($row['images'],',',1); } $link=["nav"=>'blog',"titel"=>$row['titel'].'-l-'.$row['id'].'-l-'.$row['rubrik']]; //$flink=rewriteurllink($link); $titlelink=$rmlink=hreflink($link); $img=@$row['image']?:stristr($row['images'],',',1); $img=hreflink(['nav'=>'file','titel'=>$img.'_'.$row['titel'],'typ'=>'jpg']); $credits=json_decode(html_entity_decode($row['credits']),1); $credits=empty($credits)?'':array_map(function($a){$a=current($a);return $a[0].': '.$a[1];},$credits); $credits=empty($credits)?'':implode(', ',$credits); $text=get_text($words,$row['description'].' '.$row['text'].' '.$credits); }else if($rows->inhaltname=='trendings'){ $row=mA("SELECT a.*,b.rubrik,c.name autor FROM `trendings` a JOIN `inhalt` b ON a.inhalt=b.id JOIN `cmsuser` c ON c.`id`=a.`autor` WHERE a.id=".$rows->inhaltid,$qn); $link=["nav"=>'modul',"titel"=>'trending-'.$row['id'].'-'.$row['titel'].'-l-'.$row['rubrik'].'-l-22']; //$flink=rewriteurllink($link); $titlelink=$rmlink=hreflink($link); $img=hreflink(['nav'=>'file','titel'=>$row['image'].'_'.$row['titel'],'typ'=>'jpg']); $text=get_text($words,$row['text']); }else if($rows->inhaltname=='printouts'){ $row=mA("SELECT a.*,b.rubrik,c.name autor FROM `printouts` a JOIN `inhalt` b ON a.inhalt=b.id JOIN `cmsuser` c ON c.`id`=a.`autor` WHERE a.id=".$rows->inhaltid,$qn); $link=["nav"=>'modul',"titel"=>'print-'.$row['id'].'-'.$row['titel'].'-l-'.$row['rubrik'].'-l-17']; //$flink=rewriteurllink($link); $titlelink=$rmlink=hreflink($link); $img=hreflink(['nav'=>'file','titel'=>$row['image'].'_'.$row['titel'],'typ'=>'jpg']); $text=''; }else if($rows->inhaltname=='inspirations'){ $row=mA("SELECT a.*,b.business,b.website FROM `inspirations` a JOIN `vendors` b ON b.`id`=a.`vendors` WHERE a.id=".$rows->inhaltid,$qn); $website=$row['website']?:hreflink(["nav"=>'modul',"titel"=>'inspiration-l-'.$row['id'].'-l-7']); $img=current(getImgLinks($row['image']))['link']; $link=["nav"=>'modul',"titel"=>'inspiration-l-'.$row['id'].'-l-7']; //$flink=rewriteurllink($link); $titlelink=hreflink($link); $rmlink=$row['url']; $text=preg_replace('/('.implode('|',$words).')/iu',"$1",$row['description'].'
'.$row['url']); $row['autor']=($row['website']?''.$row['business'].'':$row['business']); $titel='Inspiration'; }else if($rows->inhaltname=='vendors'){ $row=mA("SELECT * FROM `vendors` a WHERE id=".$rows->inhaltid,$qn); $rmlink=hreflink(["nav"=>'vendor',"titel"=>'portfolio-l-'.$row['business'].'-l-'.$row['id']]); $titel=$row['business']; $row['autor']=trim($row['firstname'].' '.$row['lastname']); $titlelink=$row['website']; $img=hreflink(['nav'=>'file','titel'=>$row['profileimage'].'_'.$titel,'typ'=>'jpg']); $socials=explode(';','email:mailto:'.$row['email'].';'.(empty($row['website'])?'':'www:'.$row['website'].';').$row['socials']); $ss=''; foreach($socials as $k=>$v){ $v=explode(':',$v,2); if(!empty($v[1])){$ss.='';} } $text="
$ss
".($row['phone']?'Phone - '.$row['phone']:'').'

Services Offered:
'.implode(', ',array_map('trim',explode(';',ucwords(strtolower($row['offers']))))).'

'; }else if($rows->inhaltname=='textinhalt'){ $row=mA("SELECT a.*,b.`rubrik`,c.`name` FROM `textinhalt` a JOIN `inhalt` b ON a.inhalt=b.id JOIN `rubrik` c ON c.`id`=b.`rubrik` WHERE a.id=".$rows->inhaltid,$qn); $titlelink=$rmlink=hreflink(["nav"=>$row['rubrik'],"titel"=>$row['name']]); $titel=$row['name']; $text=get_text($words,$row['text']); } if(!empty($row['video'])){ $img='video'.$row['video']; } $val.=set_searchteaser(['inhaltname'=>$rows->inhaltname,'image'=>$img,'link'=>$titlelink,'title'=>(@$titel?:$row['titel']),'published'=>$row['datum'],'text'=>$text],++$c); unset($img,$row);//,$flink } } } $val.='Load more Results'; $opt=''; $sel=[$i=>' class="sel"']; foreach([''=>'All of Wedding Chicks','blog'=>'Just the Blog','trendings'=>'Trending','inspirations'=>'Wedding Inspiration','printouts'=>'Free Printables','vendors'=>'Wedding Vendors','textinhalt'=>'FAQ / Policy / Other'] as $k=>$v){ $opt.='
  • $v
  • "; } return '
    '.$val; }