Ejemplo n.º 1
0
 public static function formatSingleLine($strLine, $strFontColour, $strBackColour, $boolBlink = false)
 {
     if (empty($strFontColour)) {
         $strFontColour = self::$strContentFontColour;
     }
     if (empty($strFontColour)) {
         $strFontColour = 'blue';
     }
     if (empty(self::$arrFontColourMap[$strFontColour])) {
         $strFontColour = 'blue';
     }
     if (empty(self::$strContentFontColour)) {
         self::$strContentFontColour = $strFontColour;
     }
     if (empty($strBackColour)) {
         $strBackColour = 'black';
     }
     if (empty(self::$arrBackColourMap[$strBackColour])) {
         $strBackColour = 'black';
     }
     if (empty(self::$strContentBackColour)) {
         self::$strContentBackColour = $strBackColour;
     }
     $intLineLen = strlen($strLine);
     $i = 0;
     $intStartIndex = 0;
     $intCur = 0;
     if (self::$intDefaultContentLen >= self::$intDefaultLineLen) {
         self::$intDefaultContentLen = self::$intDefaultLineLen - 2;
     }
     $signleLineLen = self::$intDefaultContentLen;
     $i = 0;
     while ($intLineLen > $intStartIndex) {
         $str = self::$strColourLineFormat;
         $strTmp = substr($strLine, $intStartIndex, $signleLineLen);
         $strTmp = str_pad($strTmp, self::$intDefaultLineLen - 2, ' ', STR_PAD_RIGHT);
         $strTmp = self::getColourMsg($strTmp, $strFontColour, $strBackColour, $boolBlink, false);
         $str .= $strTmp;
         $str .= self::$strColourLineFormat;
         $intStartIndex += $signleLineLen;
         $i++;
         echo $str . "\n";
     }
 }