public static function formatTitle($strTitle, $strFontColour, $strBackColour, $boolBlink = false) { if (empty($strFontColour)) { $strFontColour = self::$strTitleFontColour; } if (empty($strFontColour)) { $strFontColour = 'blue'; } if (empty(self::$arrFontColourMap[$strFontColour])) { $strFontColour = 'blue'; } if (empty(self::$strTitleFontColour)) { self::$strTitleFontColour = $strFontColour; } if (empty($strBackColour)) { $strBackColour = 'black'; } if (empty(self::$arrBackColourMap[$strBackColour])) { $strBackColour = 'black'; } if (empty(self::$strTitleBackColour)) { self::$strTitleBackColour = $strBackColour; } $intTitleLen = strlen($strTitle); $i = 0; $intContentLen = (self::$intDefaultLineLen - self::$intDefaultTitleLen) / 2; $strMiddle = ''; for ($i = 0; $i < self::$intDefaultLineLen; $i++) { if ($intContentLen > $i || self::$intDefaultLineLen - $intContentLen < $i) { $strPadTmp = ' '; } else { $strPadTmp = self::$strColourPadUnit; } $strMiddle .= $strPadTmp; } echo $strMiddle . "\n"; $intStartIndex = 0; $intCur = 0; $signleLineLen = self::$intDefaultTitleLen - 6; $i = 0; $intLineNum = $intTitleLen / self::$intDefaultTitleLen; while ($intTitleLen > $intStartIndex) { $str = ' '; $strTmp = substr($strTitle, $intStartIndex, $signleLineLen); $strTmp = str_pad($strTmp, self::$intDefaultTitleLen, ' ', STR_PAD_BOTH); $strTmp = self::getColourMsg($strTmp, $strFontColour, $strBackColour, $boolBlink, false); $strPadTmp = ' '; for ($j = 0; $j < $intContentLen - 1; $j++) { $str .= $strPadTmp; } $str .= self::$strColourLineFormat; $str .= $strTmp; $str .= self::$strColourLineFormat; for ($j = self::$intDefaultTitleLen + 1; $j < self::$intDefaultLineLen - $intContentLen; $j++) { $str .= $strPadTmp; } echo $str . "\n"; $intStartIndex += $signleLineLen; $i++; } echo self::$strColourLineLast; }