本文整理汇总了PHP中PO::prepend_each_line方法的典型用法代码示例。如果您正苦于以下问题:PHP PO::prepend_each_line方法的具体用法?PHP PO::prepend_each_line怎么用?PHP PO::prepend_each_line使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PO
的用法示例。
在下文中一共展示了PO::prepend_each_line方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PO
function test_prepend_each_line()
{
$po = new PO();
$this->assertEquals('baba_', $po->prepend_each_line('', 'baba_'));
$this->assertEquals('baba_dyado', $po->prepend_each_line('dyado', 'baba_'));
$this->assertEquals("# baba\n# dyado\n# \n", $po->prepend_each_line("baba\ndyado\n\n", '# '));
}
示例2: export_headers
/**
* Exports headers to a PO entry
*
* @return string msgid/msgstr PO entry for this PO file headers, doesn't
* contain newline at the end
*/
public function export_headers()
{
$header_string = '';
foreach ($this->headers as $header => $value) {
$header_string .= "{$header}: {$value}\n";
}
$poified = PO::poify($header_string);
if ($this->comments_before_headers) {
$before_headers = PO::prepend_each_line(rtrim($this->comments_before_headers) . "\n", '# ');
} else {
$before_headers = '';
}
return rtrim("{$before_headers}msgid \"\"\nmsgstr {$poified}");
}
示例3: comment_block
/**
* Prepare a text as a comment -- wraps the lines and prepends #
* and a special character to each line
*
* @access private
* @param string $text the comment text
* @param string $char character to denote a special PO comment,
* like :, default is a space
*/
function comment_block($text, $char = ' ')
{
$text = wordwrap($text, PO_MAX_LINE_LEN - 3);
return PO::prepend_each_line($text, "#{$char} ");
}
示例4: test_prepend_each_line
function test_prepend_each_line() {
$this->assertEquals('baba_', @PO::prepend_each_line('', 'baba_'));
$this->assertEquals('baba_dyado', @PO::prepend_each_line('dyado', 'baba_'));
$this->assertEquals("# baba\n# dyado\n# \n", @PO::prepend_each_line("baba\ndyado\n\n", '# '));
}