コード例 #1
0
 function FormatTextAsRow($Array, $MaxLengthArray)
 {
     if (function_exists('Debug') && Debug()) {
         trigger_error('FormatTextAsRow() is deprecated. Use TextDataGrid() instead.');
     }
     $Result = '';
     $Array = array_values($Array);
     $LastNum = count($Array) - 1;
     foreach ($Array as $N => $Value) {
         $MaxLengthOfRow = $MaxLengthArray[$N];
         $LocalLength = mb_strlen($Value, 'utf-8');
         $NumOfSpace = $MaxLengthOfRow - $LocalLength + 4;
         $Value = mb_str_pad($Value, $MaxLengthOfRow + 4, ' ');
         $NumOfTabs = floor($NumOfSpace / 4);
         if ($NumOfTabs >= 1) {
             $Value = mb_substr($Value, 0, -($NumOfTabs * 4), 'utf-8');
             $Value .= str_repeat("\t", $NumOfTabs);
         }
         if ($LastNum == $N) {
             $Value = trim($Value);
         }
         $Result .= $Value;
     }
     return $Result;
 }
コード例 #2
0
/**
 * Pass a nested array and get well formatted output
 * @param array $rows
 * @return string
 */
function generateOutput($rows = array(), $columnsToHide = array())
{
    $maxLengthsColumn = array();
    $str = '';
    //get length of the strings
    foreach ($rows as $rowKey => $row) {
        foreach ($row as $columnKey => $column) {
            if (false === array_key_exists($columnKey, $maxLengthsColumn)) {
                $maxLengthsColumn[$columnKey] = mb_strlen($column);
            }
            if (mb_strlen($column) > $maxLengthsColumn[$columnKey]) {
                $maxLengthsColumn[$columnKey] = mb_strlen($column);
            }
        }
    }
    //write output to string
    foreach ($rows as $rowKey => $row) {
        foreach ($row as $columnKey => $column) {
            if (false == in_array($columnKey, $columnsToHide)) {
                $str .= mb_str_pad($column, $maxLengthsColumn[$columnKey] + 3, ' ', STR_PAD_RIGHT);
            }
        }
        $str .= PHP_EOL;
    }
    return $str;
}
コード例 #3
0
ファイル: coreTest.php プロジェクト: keruald/globalfunctions
 /**
  * @covers ::mb_str_pad
  */
 function test_mb_str_pad()
 {
     // Tests from http://3v4l.org/UnXTF
     // http://web.archive.org/web/20150711100913/http://3v4l.org/UnXTF
     $this->assertEquals('àèòàFOOàèòà', mb_str_pad("FOO", 11, "àèò", STR_PAD_BOTH, "UTF-8"));
     $this->assertEquals('àèòFOOàèòà', mb_str_pad("FOO", 10, "àèò", STR_PAD_BOTH, "UTF-8"));
     $this->assertEquals('àèòBAAZàèòà', mb_str_pad("BAAZ", 11, "àèò", STR_PAD_BOTH, "UTF-8"));
     $this->assertEquals('àèòBAAZàèò', mb_str_pad("BAAZ", 10, "àèò", STR_PAD_BOTH, "UTF-8"));
     $this->assertEquals('FOOBAR', mb_str_pad("FOOBAR", 6, "àèò", STR_PAD_BOTH, "UTF-8"));
     $this->assertEquals('FOOBAR', mb_str_pad("FOOBAR", 1, "àèò", STR_PAD_BOTH, "UTF-8"));
     $this->assertEquals('FOOBAR', mb_str_pad("FOOBAR", 0, "àèò", STR_PAD_BOTH, "UTF-8"));
     $this->assertEquals('FOOBAR', mb_str_pad("FOOBAR", -10, "àèò", STR_PAD_BOTH, "UTF-8"));
     $this->assertEquals('àèòàèòàèFOO', mb_str_pad("FOO", 11, "àèò", STR_PAD_LEFT, "UTF-8"));
     $this->assertEquals('àèòàèòàFOO', mb_str_pad("FOO", 10, "àèò", STR_PAD_LEFT, "UTF-8"));
     $this->assertEquals('àèòàèòàBAAZ', mb_str_pad("BAAZ", 11, "àèò", STR_PAD_LEFT, "UTF-8"));
     $this->assertEquals('àèòàèòBAAZ', mb_str_pad("BAAZ", 10, "àèò", STR_PAD_LEFT, "UTF-8"));
     $this->assertEquals('FOOBAR', mb_str_pad("FOOBAR", 6, "àèò", STR_PAD_LEFT, "UTF-8"));
     $this->assertEquals('FOOBAR', mb_str_pad("FOOBAR", 1, "àèò", STR_PAD_LEFT, "UTF-8"));
     $this->assertEquals('FOOBAR', mb_str_pad("FOOBAR", 0, "àèò", STR_PAD_LEFT, "UTF-8"));
     $this->assertEquals('FOOBAR', mb_str_pad("FOOBAR", -10, "àèò", STR_PAD_LEFT, "UTF-8"));
     $this->assertEquals('FOOàèòàèòàè', mb_str_pad("FOO", 11, "àèò", STR_PAD_RIGHT, "UTF-8"));
     $this->assertEquals('FOOàèòàèòà', mb_str_pad("FOO", 10, "àèò", STR_PAD_RIGHT, "UTF-8"));
     $this->assertEquals('BAAZàèòàèòà', mb_str_pad("BAAZ", 11, "àèò", STR_PAD_RIGHT, "UTF-8"));
     $this->assertEquals('BAAZàèòàèò', mb_str_pad("BAAZ", 10, "àèò", STR_PAD_RIGHT, "UTF-8"));
     $this->assertEquals('FOOBAR', mb_str_pad("FOOBAR", 6, "àèò", STR_PAD_RIGHT, "UTF-8"));
     $this->assertEquals('FOOBAR', mb_str_pad("FOOBAR", 1, "àèò", STR_PAD_RIGHT, "UTF-8"));
     $this->assertEquals('FOOBAR', mb_str_pad("FOOBAR", 0, "àèò", STR_PAD_RIGHT, "UTF-8"));
     $this->assertEquals('FOOBAR', mb_str_pad("FOOBAR", -10, "àèò", STR_PAD_RIGHT, "UTF-8"));
 }
コード例 #4
0
 function test_mb_str_pad()
 {
     $this->assertEquals('a   ', mb_str_pad('a', 4));
     $this->assertEquals('ö   ', mb_str_pad('ö', 4));
     $this->assertEquals(str_pad('a', 4), mb_str_pad('a', 4));
 }
コード例 #5
0
 /**
  * @dataProvider mbStrPadProvider
  *
  * @param string $string
  * @param string $pad
  * @param string $expected
  */
 public function testMbStrPad($string, $pad, $expected)
 {
     self::assertSame(mb_str_pad($string, $pad), $expected);
 }
コード例 #6
0
ファイル: html2text.php プロジェクト: ed00m/osTicket-1.8
 function render($width, $options)
 {
     $cols = 0;
     $rows = array_merge($this->body, $this->foot);
     # Count the number of columns
     foreach ($rows as $r) {
         $cols = max($cols, count($r));
     }
     if (!$cols) {
         return '';
     }
     # Find the largest cells in all columns
     $weights = $mins = array_fill(0, $cols, 0);
     foreach ($rows as $r) {
         $i = 0;
         foreach ($r as $cell) {
             for ($j = 0; $j < $cell->cols; $j++) {
                 $weights[$i] = max($weights[$i], $cell->getWeight());
                 $mins[$i] = max($mins[$i], $cell->getMinWidth());
             }
             $i += $cell->cols;
         }
     }
     # Subtract internal padding and borders from the available width
     $inner_width = $width - $cols * 3 - 1;
     # Optimal case, where the preferred width of all the columns is
     # doable
     if (array_sum($weights) <= $inner_width) {
         $widths = $weights;
     } elseif (array_sum($mins) > $inner_width) {
         $widths = $mins;
     } else {
         $total = array_sum($weights);
         $widths = array();
         foreach ($weights as $c) {
             $widths[] = (int) ($inner_width * $c / $total);
         }
         $this->_fixupWidths($widths, $mins);
     }
     $outer_width = array_sum($widths) + $cols * 3 + 1;
     $contents = array();
     $heights = array();
     foreach ($rows as $y => $r) {
         $heights[$y] = 0;
         for ($x = 0, $i = 0; $x < $cols; $i++) {
             if (!isset($r[$i])) {
                 // No cell at the end of this row
                 $contents[$y][$i][] = "";
                 break;
             }
             $cell = $r[$i];
             # Compute the effective cell width for spanned columns
             # Add extra space for the unneeded border padding for
             # spanned columns
             $cwidth = ($cell->cols - 1) * 3;
             for ($j = 0; $j < $cell->cols; $j++) {
                 $cwidth += $widths[$x + $j];
             }
             # Stash the computed width so it doesn't need to be
             # recomputed again below
             $cell->width = $cwidth;
             unset($data);
             $data = explode("\n", $cell->render($cwidth, $options));
             $heights[$y] = max(count($data), $heights[$y]);
             $contents[$y][$i] =& $data;
             $x += $cell->cols;
         }
     }
     # Build the header
     $header = "";
     for ($i = 0; $i < $cols; $i++) {
         $header .= "+-" . str_repeat("-", $widths[$i]) . "-";
     }
     $header .= "+";
     # Emit the rows
     $output = "\n";
     if (isset($this->caption)) {
         $this->caption = $this->caption->render($outer_width, $options);
     }
     foreach ($rows as $y => $r) {
         $output .= $header . "\n";
         for ($x = 0, $k = 0; $k < $heights[$y]; $k++) {
             $output .= "|";
             foreach ($r as $x => $cell) {
                 $content = isset($contents[$y][$x][$k]) ? $contents[$y][$x][$k] : "";
                 $output .= " " . mb_str_pad($content, $cell->width) . " |";
                 $x += $cell->cols;
             }
             $output .= "\n";
         }
     }
     $output .= $header . "\n";
     return new PreFormattedText($output);
 }
コード例 #7
0
ファイル: Gui.php プロジェクト: nielsk/otodo
 protected function printColumn($value, $length, $pad)
 {
     if (mb_strlen($value) > $length) {
         echo ' ' . mb_substr($value, 0, $length) . '→';
     } else {
         echo ' ' . mb_str_pad($value, $length, ' ', $pad) . ' ';
     }
 }
コード例 #8
0
 /**
  * @param array $failures
  * @param int $padLength
  * @param ExerciseInterface $exercise
  * @param OutputInterface $output
  */
 private function renderErrorInformation(array $failures, $padLength, ExerciseInterface $exercise, OutputInterface $output)
 {
     foreach ($failures as list($failure, $message)) {
         $output->writeLine($this->center($this->style(str_repeat(' ', $padLength), ['bg_red'])));
         $output->writeLine($this->center($this->style(\mb_str_pad($message, $padLength), ['bg_red'])));
         $output->writeLine($this->center($this->style(str_repeat(' ', $padLength), ['bg_red'])));
         $output->emptyLine();
         $output->write($this->renderResult($failure));
     }
     $output->lineBreak();
     $output->emptyLine();
     $output->emptyLine();
     $this->fullWidthBlock($output, 'Your solution was unsuccessful!', ['white', 'bg_red', 'bold']);
     $output->emptyLine();
     $output->writeLine($this->center(sprintf(" Your solution to %s didn't pass. Try again!", $exercise->getName())));
     $output->emptyLine();
     $output->emptyLine();
 }
コード例 #9
0
ファイル: fzMainBottom.php プロジェクト: sac071213/allpay_web
             // 8.付款人統編 X(10)
             $Y .= mb_str_pad($bankOUT_kotai_name, 70, ' ');
             // 9.付款人戶名 X(70)
             $Y .= "TWD";
             // 10.幣別 X(3)
             $Y .= "+";
             // 11.金額正負號 X(1)
             $Y .= str_pad($OKpayAmt, 12, '0', 0) . '00';
             // 12.金額 X(14)
             $Y .= str_pad($BankID, 7, ' ');
             // 13.收款行代碼 X(7)
             $Y .= str_pad($account, 16, ' ');
             // 14.收款人帳號 X(16)
             $Y .= str_pad($soID, 10, ' ');
             // 15.收款人統編 X(10)
             $Y .= mb_str_pad($accname, 70, ' ');
             // 16.收款人戶名 X(70)
             $Y .= "1";
             // 17.收款人是否電告 X(1) //0 不通知 1 email 2 fax 3 簡訊
             $Y .= str_pad($bankOUT_email, 50, ' ');
             // 18.電告設備號碼 X(50) //會計小姐的email
             $Y .= "15";
             // 19.手續費分擔方式 //15 匯費外加 13 匯費內扣
             $Y .= "0000";
             // 20.發票筆數 X(4)
             $Y .= str_repeat(' ', 50);
             // 21.備註 X(50)
             $Y .= "\n";
         }
     }
 }
コード例 #10
0
function hline($col, $lng, $bord)
{
    if ($bord) {
        echo "+";
    }
    for ($j = 0; $j < $col - 1; $j++) {
        echo mb_str_pad("", $lng[$j], "-") . "+";
    }
    echo mb_str_pad("", $lng[$col - 1], "-");
    if ($bord) {
        echo "+";
    }
    echo "\n";
}
コード例 #11
0
ファイル: order.php プロジェクト: raphaelm/rzl_merchandise
require_once 'Twig/Autoloader.php';
Twig_Autoloader::register();
$loader = new Twig_Loader_Filesystem('templates');
$twig = new Twig_Environment($loader);
require_once "SizePrice.php";
require_once "Item.php";
require_once "config.php";
require_once "functions.php";
/**
 * Contains the list of items to order. All orders are contained within the "item" key, and each subentry
 * contains the item and it's size as well as the order amount.
 */
$orderItems = array();
foreach ($_REQUEST["item"] as $key => $value) {
    if ($value !== "") {
        $orderItems[] = array("name" => mb_str_pad($key, 40), "amount" => mb_str_pad($value, 4));
    }
}
$variables = array();
$variables["name"] = $_REQUEST["name"];
$variables["email"] = $_REQUEST["email"];
$variables["comments"] = $_REQUEST["comments"];
$variables["items"] = $orderItems;
$twig->display('ordercomplete.html', $variables);
flush();
$mailtext = $twig->render('mailtemplate.txt', $variables);
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=utf-8\r\n";
$headers .= "Content-Transfer-Encoding: 8bit";
// targetMails is defined in config.php, gets appended with the order person's mail
$targetMails[] = $_REQUEST["email"];
コード例 #12
0
                $zeile = mb_str_pad($zeile . $einzel[$x]->hsnr, 10, " ");
                $zeile = mb_str_pad($zeile . $einzel[$x]->hname, 34, " ");
                $zeile = mb_str_pad($zeile . '(' . $einzel[$x]->hdwz . ')', 41, " ");
                if (mb_strlen($erg_text[$einzel[$x]->ergebnis]->erg_text) == 3) {
                    $zeile .= '   ';
                }
                if (mb_strlen($erg_text[$einzel[$x]->ergebnis]->erg_text) == 5) {
                    $zeile .= '  ';
                }
                $zeile = mb_str_pad($zeile . $erg_text[$einzel[$x]->ergebnis]->erg_text, 51, " ");
                if (mb_strlen($einzel[$x]->gsnr) < 3) {
                    $zeile .= '  ';
                }
                $zeile = mb_str_pad($zeile . $einzel[$x]->gsnr, 56, " ");
                $zeile = mb_str_pad($zeile . $einzel[$x]->gname, 80, " ");
                $zeile = mb_str_pad($zeile . '(' . $einzel[$x]->gdwz . ')', 87, " ");
                $body_msg .= $zeile;
            }
            if ($paar[0]->comment != "") {
                $body_msg .= "\r\n ";
                $zeile = "\r\n " . JText::_('PAAR_COMMENT_L');
                $body_msg .= $zeile;
                $zeile = $paar[0]->comment;
                $body_msg .= $zeile;
            }
            // Mailbody HTML Header
            $body_html_header = '
			<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
			<html>
			<head>
			<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
コード例 #13
0
 function _TextDataRow($Array, $MaxLengthArray)
 {
     $Result = '';
     foreach (array_values($Array) as $N => $Value) {
         $MaxLengthOfRow = $MaxLengthArray[$N];
         // TODO: How are we going to display null values?
         if (is_numeric($Value)) {
             $Result .= '| ' . mb_str_pad($Value, $MaxLengthOfRow, ' ', STR_PAD_LEFT) . ' ';
         } else {
             $Result .= '| ' . mb_str_pad($Value, $MaxLengthOfRow, ' ', STR_PAD_RIGHT) . ' ';
         }
     }
     return $Result . '|';
 }
コード例 #14
0
    // @important
    $diff = strlen($input) - mb_strlen($input);
    return str_pad($input, $pad_length + $diff, $pad_string, $pad_type);
}
$italianID = 78623;
$cI = new \Memrise\Http\JsonCourseInformation();
$courseInformation = $cI->get($italianID);
foreach ($courseInformation->course->levels as $level) {
    echo '++ ' . $level->index . ' ' . $level->title . " ++\n";
    $vocInfo = new \Memrise\Http\VocabularyResponse();
    $result = $vocInfo->get($level->url);
    $thingInfo = new \Memrise\Parser\Html\VocabularyInformation($result);
    $words = array();
    $maxLenWord = 0;
    foreach ($thingInfo->getItemIds() as $itemId) {
        $thingInfo = new \Memrise\Http\JsonThingInformation();
        $info = $thingInfo->get($itemId);
        $pair = array();
        $pair['foreign'] = $info->thing->columns->{'1'}->val;
        $pair['translation'] = $info->thing->columns->{'2'}->val;
        if (mb_strlen($pair['foreign']) > $maxLenWord) {
            $maxLenWord = mb_strlen($pair['foreign']);
        }
        $words[] = $pair;
    }
    foreach ($words as $word) {
        $str = mb_str_pad($word['foreign'], $maxLenWord + 3, ' ', STR_PAD_RIGHT);
        $str .= $word['translation'] . "\n";
        echo $str;
    }
}
コード例 #15
0
ファイル: upload_history.php プロジェクト: Anon215/filebin
<?php

$dateformat = "r";
$lengths["date"] = max($lengths["date"], strlen(date($dateformat, time())));
echo mb_str_pad($fields["id"], $lengths["id"]) . " | " . mb_str_pad($fields["filename"], $lengths["filename"]) . " | " . mb_str_pad($fields["mimetype"], $lengths["mimetype"]) . " | " . mb_str_pad($fields["date"], $lengths["date"]) . " | " . mb_str_pad($fields["hash"], $lengths["hash"]) . " | " . mb_str_pad($fields["filesize"], $lengths["filesize"]) . "\n";
foreach ($items as $key => $item) {
    echo mb_str_pad($item["id"], $lengths["id"]) . " | " . mb_str_pad($item["filename"], $lengths["filename"]) . " | " . mb_str_pad($item["mimetype"], $lengths["mimetype"]) . " | " . date($dateformat, $item["date"]) . " | " . mb_str_pad($item["hash"], $lengths["hash"]) . " | " . $item["filesize"] . "\n";
}
?>

Total sum of your distinct uploads: <?php 
echo $total_size;
?>
.
コード例 #16
0
function clm_view_liga_mail_body_html($player, $result, $dateNow, $dateGame, $hname, $gname, $hmf, $gmf, $comment, $ko, $sender, $liga, $gemeldet)
{
    $lang = clm_core::$lang->liga_mail_body;
    // Mailbody TXT
    $body_msg = JText::_('RESULT_DATA_BODY1') . " " . $begegnung[0]->name . " - " . $begegnung[1]->name . JText::_('RESULT_DATA_BODY2_1') . $fromname . JText::_('RESULT_DATA_BODY2_2') . "\r\n\r\n http://{$pfad}/index.php?option=com_clm&view=runde&saison={$sid}&liga={$lid}&runde={$rnd}&dg={$dg}" . JText::_('RESULT_DATA_BODY3') . JText::_('RESULT_DATA_BODY4') . "\r\n\r\n http://{$pfad}/index.php?option=com_clm&view=rangliste&saison={$sid}&liga={$lid}" . JText::_('RESULT_DATA_BODY5');
    // Mailbody - TXT Ergänzung
    $body_msg .= "\r\n\r\n ";
    $zeile .= $mail[0]->name . ', ' . $rundeterm[0]->name;
    if (isset($rundeterm[0]->datum)) {
        $zeile .= ' ' . JText::_('ON_DAY') . ' ' . JHTML::_('date', $rundeterm[0]->datum, JText::_('%d. %B %Y'));
    }
    $body_msg .= $zeile;
    $zeile = "\r\n ";
    $zeile = mb_str_pad($zeile, 7, " ");
    $zeile = mb_str_pad($zeile . $paar[0]->htln, 10, " ");
    $zeile = mb_str_pad($zeile . $paar[0]->hname, 34, " ");
    $zeile = mb_str_pad($zeile . '(' . round($dwzgespielt[0]->dwz) . ')', 41, " ");
    $zeile = mb_str_pad($zeile . $summe[0]->sum . ' : ' . $summe[1]->sum, 53, " ");
    $zeile = mb_str_pad($zeile . $paar[0]->gtln, 56, " ");
    $zeile = mb_str_pad($zeile . $paar[0]->gname, 80, " ");
    $zeile = mb_str_pad($zeile . '(' . round($dwzgespielt[0]->gdwz) . ')', 87, " ");
    $body_msg .= $zeile;
    $body_msg .= "\r\n ";
    for ($x = 0; $x < $stamm; $x++) {
        $zeile = "\r\n ";
        $zeile = mb_str_pad($zeile . ($x + 1), 5, " ");
        if (mb_strlen($einzel[$x]->hsnr) < 3) {
            $zeile .= '  ';
        }
        $zeile = mb_str_pad($zeile . $einzel[$x]->hsnr, 10, " ");
        $zeile = mb_str_pad($zeile . $einzel[$x]->hname, 34, " ");
        $zeile = mb_str_pad($zeile . '(' . $einzel[$x]->hdwz . ')', 41, " ");
        if (mb_strlen($erg_text[$einzel[$x]->ergebnis]->erg_text) == 3) {
            $zeile .= '   ';
        }
        if (mb_strlen($erg_text[$einzel[$x]->ergebnis]->erg_text) == 5) {
            $zeile .= '  ';
        }
        $zeile = mb_str_pad($zeile . $erg_text[$einzel[$x]->ergebnis]->erg_text, 51, " ");
        if (mb_strlen($einzel[$x]->gsnr) < 3) {
            $zeile .= '  ';
        }
        $zeile = mb_str_pad($zeile . $einzel[$x]->gsnr, 56, " ");
        $zeile = mb_str_pad($zeile . $einzel[$x]->gname, 80, " ");
        $zeile = mb_str_pad($zeile . '(' . $einzel[$x]->gdwz . ')', 87, " ");
        $body_msg .= $zeile;
    }
    if ($paar[0]->comment != "") {
        $body_msg .= "\r\n ";
        $zeile = "\r\n " . JText::_('PAAR_COMMENT_L');
        $body_msg .= $zeile;
        $zeile = $paar[0]->comment;
        $body_msg .= $zeile;
    }
    // Mailbody HTML Header
    $body_html_header = '
			<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
			<html>
			<head>
			<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
			<title>Online Spielbericht</title>
			</head>
			<body>';
    $body_html_footer = '
			</body>
			</html>';
    // Mailbody HTML Spielbericht
    $body_html = '
		<table width="700" border="0" cellspacing="0" cellpadding="3" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;">
		<tr>
			<td bgcolor="#F2F2F2" style="border-bottom: solid 1px #000000; border-top: solid 1px #000000; padding: 3px;" colspan="6"><div align="center" style="font-size: 12px;"><strong>Online Spielbericht vom ' . JHTML::_('date', date('Y-m-d H:i:s'), JText::_('DATE_FORMAT_CLM_PDF')) . '</strong></div></td>
		</tr>
		<tr>
			<td width="120">&nbsp;</td>
			<td>&nbsp;</td>
			<td width="5">&nbsp;</td>
			<td width="5">&nbsp;</td>
			<td width="80">&nbsp;</td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="120" style="border-bottom: solid 1px #999999;"><strong>Liga:</strong></td>
			<td style="border-bottom: solid 1px #999999;">' . $mail[0]->name . '&nbsp;</td>
			<td width="5" style="border-bottom: solid 1px #999999;">&nbsp;</td>
			<td width="5" style="border-bottom: solid 1px #999999;">&nbsp;</td>
			<td width="80" style="border-bottom: solid 1px #999999;"><strong>Spieltag:</strong></td>
			<td style="border-bottom: solid 1px #999999;">' . JHTML::_('date', $rundeterm[0]->datum, JText::_('DATE_FORMAT_CLM_F')) . '&nbsp;</td>
		</tr>
		<tr>
			<td width="120" style="border-bottom: solid 1px #999999;"><strong>Heim:</strong></td>
			<td style="border-bottom: solid 1px #999999;">' . $paar[0]->hname . '&nbsp;</td>
			<td width="5" style="border-bottom: solid 1px #999999;">&nbsp;</td>
			<td width="5" style="border-bottom: solid 1px #999999;">&nbsp;</td>
			<td width="80" style="border-bottom: solid 1px #999999;"><strong>Gast:</strong></td>
			<td style="border-bottom: solid 1px #999999;">' . $paar[0]->gname . '&nbsp;</td>
		</tr>
		<tr>
			<td width="120" style="border-bottom: solid 1px #999999;"><strong>MF-Heim:</strong></td>
			<td style="border-bottom: solid 1px #999999;">' . $paar[0]->hmf . '&nbsp;</td>
			<td width="5" style="border-bottom: solid 1px #999999;">&nbsp;</td>
			<td width="5" style="border-bottom: solid 1px #999999;">&nbsp;</td>
			<td width="80" style="border-bottom: solid 1px #999999;"><strong>MF-Gast:</strong></td>
			<td style="border-bottom: solid 1px #999999;">' . $paar[0]->gmf . '&nbsp;</td>
		</tr>
		<tr>
			<td width="120">&nbsp;</td>
			<td>&nbsp;</td>
			<td width="5">&nbsp;</td>
			<td width="5">&nbsp;</td>
			<td width="80">&nbsp;</td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="120">&nbsp;</td>
			<td>&nbsp;</td>
			<td width="5">&nbsp;</td>
			<td width="5">&nbsp;</td>
			<td width="80">&nbsp;</td>
			<td>&nbsp;</td>
		</tr>
		</table>
		
		<table width="700" border="0" cellspacing="0" cellpadding="3" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;">
		<tr>
			<td width="50" bgcolor="#F2F2F2" style="border-bottom: solid 1px #000000; border-top: solid 1px #000000; padding: 3px;"><div align="center" style="font-size: 12px;"><strong>Brett</strong></div></td>
			<td width="75" bgcolor="#F2F2F2" style="border-bottom: solid 1px #000000; border-top: solid 1px #000000; padding: 3px;"><div align="center" style="font-size: 12px;"><strong>Melde Nr. </strong></div></td>
			<td width="60" bgcolor="#F2F2F2" style="border-bottom: solid 1px #000000; border-top: solid 1px #000000; padding: 3px;"><div align="center" style="font-size: 12px;"><strong>Mgl. Nr. </strong></div></td>
			<td width="210" bgcolor="#F2F2F2" style="border-bottom: solid 1px #000000; border-top: solid 1px #000000; padding: 3px;"><div align="center" style="font-size: 12px;"><strong>Spieler</strong> (Heim)</div></td>
			<td width="75" bgcolor="#F2F2F2" style="border-bottom: solid 1px #000000; border-top: solid 1px #000000; padding: 3px;"><div align="center" style="font-size: 12px;"><strong>Ergebnis</strong></div></td>
			<td width="75" bgcolor="#F2F2F2" style="border-bottom: solid 1px #000000; border-top: solid 1px #000000; padding: 3px;"><div align="center" style="font-size: 12px;"><strong>Melde Nr. </strong></div></td>
			<td width="60" bgcolor="#F2F2F2" style="border-bottom: solid 1px #000000; border-top: solid 1px #000000; padding: 3px;"><div align="center" style="font-size: 12px;"><strong>Mgl. Nr. </strong></div></td>
			<td width="215" bgcolor="#F2F2F2" style="border-bottom: solid 1px #000000; border-top: solid 1px #000000; padding: 3px;"><div align="center" style="font-size: 12px;"><strong>Spieler</strong> (Gast)</div></td>
		</tr>
	';
    for ($x = 0; $x < $stamm; $x++) {
        $body_html .= '
		<tr>
			<td width="50" style="border-bottom: solid 1px #999999;"><div align="center"><strong>' . ($x + 1) . '</strong></div></td>
			<td width="75" style="border-bottom: solid 1px #999999;"><div align="center">' . $einzel[$x]->hsnr . '&nbsp;</div></td>
			<td width="60" style="border-bottom: solid 1px #999999;"><div align="center">' . str_pad($einzel[$x]->hmglnr, 3, "0", STR_PAD_LEFT) . '&nbsp;</div></td>
			<td width="210" style="border-bottom: solid 1px #999999;"><div align="center">' . $einzel[$x]->hname . '&nbsp;</div></td>
			<td width="75" style="border-bottom: solid 1px #999999; border-left: solid 1px #999999; border-right: solid 1px #999999;"><div align="center">' . $erg_text[$einzel[$x]->ergebnis]->erg_text . '&nbsp;</div></td>
			<td width="75" style="border-bottom: solid 1px #999999;"><div align="center">' . $einzel[$x]->gsnr . '&nbsp;</div></td>
			<td width="60" style="border-bottom: solid 1px #999999;"><div align="center">' . str_pad($einzel[$x]->gmglnr, 3, "0", STR_PAD_LEFT) . '&nbsp;</div></td>
			<td width="215" style="border-bottom: solid 1px #999999;"><div align="center">' . $einzel[$x]->gname . '&nbsp;</div></td>
		</tr>
	  ';
    }
    $body_html .= '
		<tr>
			<td width="50"><div align="center"></div></td>
			<td width="75"><div align="center"></div></td>
			<td width="60"><div align="center"></div></td>
			<td width="210"><div align="right"><strong>Gesamtergebnis: </strong></div></td>
			<td style="border-bottom: solid 1px #999999; border-left: solid 1px #999999; border-right: solid 1px #999999;" width="75"><div align="center" style="color:#FF0000"><strong>' . $summe[0]->sum . ' : ' . $summe[1]->sum . '&nbsp;</strong></div></td>
			<td width="75"><div align="center"></div></td>
			<td width="60"><div align="center"></div></td>
			<td width="215">&nbsp;</td>
		</tr>
		</table>
		<table width="700" border="0" cellspacing="0" cellpadding="3" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;">
		<tr>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
		</tr>
	';
    if ($paar[0]->comment != "") {
        $paar[0]->comment = ereg_replace('
', '<br>', $paar[0]->comment);
        $body_html .= '
		<tr>
			<td width="80" valign="top"><strong>' . JText::_('PAAR_COMMENT_L') . '</strong></td>
			<td  width="420" nowrap="nowrap" valign="top" size="1">
				<textarea cols="30" rows="2" style="width:90%">' . str_replace('&', '&amp;', $paar[0]->comment) . '</textarea>
			</td>
  		</tr>
	  ';
    }
    $body_html .= '
		<tr>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="80" valign="top"><strong>Ergebnismelder:</strong></td>
			<td>' . $paar[0]->melder . '&nbsp;</td>
		</tr>
	
		</table>
	';
    // Mailbody HTML ML
    $body_html_mf = '
	  <table width="700" border="0" cellspacing="0" cellpadding="3" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;">
		<tr>
		  <td>' . JText::_('RESULT_DATA_BODY1') . " " . $begegnung[0]->name . " - " . $begegnung[1]->name . JText::_('RESULT_DATA_BODY2_1') . $fromname;
    if (isset($id[0]->gemeldet)) {
        $body_html_mf .= JText::_('RESULT_DATA_BODY2_2A');
    } else {
        $body_html_mf .= JText::_('RESULT_DATA_BODY2_2');
    }
    $body_html_mf .= ' siehe unten oder <a href="http://' . $pfad . '/index.php?option=com_clm&view=runde&saison=' . $sid . '&liga=' . $lid . '&runde=' . $rnd . '&dg=' . $dg . '">hier</a>
		  </td>
		</tr>
		<tr>
		  <td><a href="mailto:' . $sl_bcc . '">' . JText::_('RESULT_DATA_BODY3') . '</a></td>
		</tr>
		<tr>
 		  <td>' . JText::_('RESULT_DATA_BODY4') . '<a href="http://' . $pfad . '/index.php?option=com_clm&view=rangliste&saison=' . $sid . '&liga=' . $lid . '"> Liga</a></td>
  		</tr>
		<tr>
		  <td>' . JText::_('RESULT_DATA_BODY5') . '</td>
		</tr>
		</table>
	';
    $body_name1 = JText::_('RESULT_NAME') . $empfang[0]->empfang . ",";
    $body = $body_html_header . $body_name1 . $body_html_mf . $body_html . $body_html_footer;
}
コード例 #17
0
ファイル: strings.php プロジェクト: php-kit/tools
/**
 * Performs padding on strings having embedded tags.
 *
 * This is specially useful when used with color-tagged strings meant for terminal output.
 * > Ex: `"<color-name>text</color-name>"`
 *
 * @param string $str
 * @param int    $width The desired minimum width, in characters.
 * @param int    $align One of the STR_PAD_XXX constants.
 * @param string $pad   The paddind character(s).
 * @return string
 */
function taggedStrPad($str, $width, $align = STR_PAD_RIGHT, $pad = ' ')
{
    $w = taggedStrLen($str);
    $rawW = mb_strlen($str);
    $d = $rawW - $w;
    return mb_str_pad($str, $width + $d, $pad, $align);
}