예제 #1
0
 function highlightError($error, $highlight_text = array())
 {
     if (empty($highlight_text)) {
         return $error;
     }
     require_once AK_LIB_DIR . DS . 'AkColor.php';
     require_once AK_LIB_DIR . DS . 'AkActionView' . DS . 'helpers' . DS . 'text_helper.php';
     $line = $this->getCurrentLine();
     $highlighted_error = '';
     foreach ($highlight_text as $phrases) {
         $color = AkColor::getRandomHex();
         if (is_array($phrases)) {
             $highlighted_error_line = $error;
             foreach ($phrases as $phrase) {
                 $this->_linesToHighlight[$line][$error] = array('color' => $color, 'phrase' => htmlentities($phrase));
                 $highlighted_error_line = TextHelper::highlight($highlighted_error_line, $phrase . ' ', ' <strong style="border:2px solid #' . $color . '; background: #ffc;">\\1</strong> ');
             }
             $highlighted_error .= $highlighted_error_line;
         } else {
             $highlighted_error = TextHelper::highlight($error, $phrases . ' ', ' <strong style="border:2px solid #' . $color . '; background: #ffc">\\1</strong> ');
             $this->_linesToHighlight[$line][$error] = array('color' => $color, 'phrase' => htmlentities($phrases));
         }
     }
     return $highlighted_error;
 }
예제 #2
0
파일: base.php 프로젝트: bermi/akelos
 static function getRandomHex()
 {
     return AkColor::rgbToHex(rand(0, 255), rand(0, 255), rand(0, 255));
 }