Exemplo n.º 1
0
function compareWithSearchText($search_text, $value) {
	if(mb_stristr($value, $search_text)) {
		$marker_color = getMarkerColor();
		if($marker_color === 'green') {
			$replace = '(:mainsearch_text_green:)$0(:mainsearch_text_green_end:)';
		} else if($marker_color === 'yellow') {
			$replace = '(:mainsearch_text_yellow:)$0(:mainsearch_text_yellow_end:)';
		}
		
		$value = preg_replace('~' . preg_quote($search_text, '/') . '~iu', $replace, $value);
	}
	
	return $value;
}
function _compareWithSearchText($value){
   if(!empty($_GET['search'])){
      if ( mb_stristr($value,$_GET['search']) ) {
         // $replace = '(:mainsearch_text:)$0(:mainsearch_text_end:)';
         include_once('functions/misc_functions.php');
         if ( getMarkerColor() == 'green') {
            $replace = '(:mainsearch_text_green:)$0(:mainsearch_text_green_end:)';
         }
         else if (getMarkerColor() == 'yellow') {
            $replace = '(:mainsearch_text_yellow:)$0(:mainsearch_text_yellow_end:)';
         }
         // $replace = '(:searchedtext:)$0(:searchedtext_end:)';
         $value = preg_replace('~'.preg_quote($_GET['search'],'/').'~iu',$replace,$value);
         // $value = preg_replace('~'.preg_quote($search_text,'/').'~iu','*$0*',$value);
      }
   }
   return $value;
}
Exemplo n.º 3
0
 /** compare the item text and the search criteria
  * this method returns the item text bold if it fits to the search criteria
  *
  * @return string value
  */
 function _compareWithSearchText($value, $bold = true)
 {
     if (!empty($this->_search_array)) {
         foreach ($this->_search_array as $search_text) {
             if (mb_stristr($value, $search_text)) {
                 // CSS Klasse erstellen für Farbmarkierung
                 include_once 'functions/misc_functions.php';
                 if (getMarkerColor() == 'green') {
                     $replace = '(:mainsearch_text_green:)$0(:mainsearch_text_green_end:)';
                 } else {
                     if (getMarkerColor() == 'yellow') {
                         $replace = '(:mainsearch_text_yellow:)$0(:mainsearch_text_yellow_end:)';
                     }
                 }
                 // $replace = '(:mainsearch_text:)$0(:mainsearch_text_end:)';
                 // $replace = '*$0*';
                 if (!$bold) {
                     if (getMarkerColor() == 'green') {
                         $replace = '(:mainsearch_text_green:)$0(:mainsearch_text_green_end:)';
                     } else {
                         if (getMarkerColor() == 'yellow') {
                             $replace = '(:mainsearch_text_yellow:)$0(:mainsearch_text_yellow_end:)';
                         }
                     }
                     // $replace = '(:search:)$0(:search_end:)';
                 }
                 if (stristr($value, '<!-- KFC TEXT')) {
                     if (getMarkerColor() == 'green') {
                         $replace = '<span class="searched_text_green">$0</span>';
                     } else {
                         if (getMarkerColor() == 'yellow') {
                             $replace = '<span class="searched_text_yellow">$0</span>';
                         }
                     }
                     // $replace = '<span class="bold">$0</span>';
                     if (!$bold) {
                         $replace = '<span class="italic" style="font-style: italic;">$0</span>';
                     }
                 }
                 $value = preg_replace('~' . preg_quote($search_text, '/') . '~iu', $replace, $value);
             }
         }
     }
     return $value;
 }