Beispiel #1
0
     if ($ftitle !== false) {
         $title = cli_highlight($doc->f($ftitle));
     }
     if ($fbody !== false) {
         $body = cli_highlight($doc->f($fbody)) . "\n";
     }
     // main fields
     printf("\n%d. %s#%s# [%d%%]\n", $doc->rank(), $title, $doc->f($fid), $doc->percent());
     echo $body;
     // other fields
     $line = '';
     foreach ($xs->getAllFields() as $field) {
         if ($field->isSpeical()) {
             continue;
         }
         $tmp = ucfirst($field->name) . ':' . cli_highlight($doc->f($field));
         if (strlen($tmp) + strlen($line) > 80) {
             if (strlen($line) > 0) {
                 echo $line . "\n";
                 $line = '';
             }
             echo $tmp . "\n";
         } else {
             $line .= $tmp . ' ';
         }
     }
     if (strlen($line) > 0) {
         echo $line . "\n";
     }
 }
 // related
Beispiel #2
0
 /**
  * Change color, background color and formatting of text.
  *
  * @param $string
  * @param null $color
  * @param null $highlight
  * @param null $format
  *
  * @return string
  */
 function cli_style($string, $color = null, $highlight = null, $format = null)
 {
     return cli_highlight(cli_color(cli_format($string, $format), $color), $highlight);
 }