本文整理汇总了PHP中Text类的典型用法代码示例。如果您正苦于以下问题:PHP Text类的具体用法?PHP Text怎么用?PHP Text使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Text类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCanPassCustomTable
public function testCanPassCustomTable()
{
$table = new Table();
$table['%'] = '001100110011';
$text = new Text($table);
$this->assertSame('AVSLAG -30%', $text->fromMorse($text->toMorse('Avslag -30%')));
}
示例2: show
/**
* Standard-Angezeige.
*
* ist ein Content definiert, wird dieser ebenfalls mit angegeben.
*/
function show()
{
echo "<a name='" . $this->NAME . "' ";
if ($this->XPOS > 0 && $this->YPOS > 0) {
echo " style=\" position:absolute; top:" . $this->YPOS . "px; left:" . $this->XPOS . "px; \" ";
}
if ($this->XPOS < 0 && $this->YPOS > 0) {
echo " style=\" position:absolute; top:" . $this->YPOS . "px; right:" . $this->XPOS * -1 . "px; \" ";
}
if ($this->XPOS < 0 && $this->YPOS < 0) {
echo " style=\" position:absolute; bottom:" . $this->YPOS * -1 . "px; right:" . $this->XPOS * -1 . "px; \" ";
}
if ($this->XPOS > 0 && $this->YPOS < 0) {
echo " style=\" position:absolute; bottom:" . $this->YPOS * -1 . "px; left:" . $this->XPOS . "px; \" ";
}
echo $this->getToolTipTag() . ">";
if (get_class($this->TEXT) && method_exists($this->TEXT, "show")) {
$this->TEXT->show();
} else {
$t = new Text($this->TEXT);
$t->setFilter(false);
$t->show();
}
echo "</a>";
}
示例3: FeedItems
function FeedItems() {
$output = new DataObjectSet();
include_once(Director::getAbsFile(SAPPHIRE_DIR . '/thirdparty/simplepie/SimplePie.php'));
$t1 = microtime(true);
$this->feed = new SimplePie($this->AbsoluteRssUrl, TEMP_FOLDER);
$this->feed->init();
if($items = $this->feed->get_items(0, $this->NumberToShow)) {
foreach($items as $item) {
// Cast the Date
$date = new Date('Date');
$date->setValue($item->get_date());
// Cast the Title
$title = new Text('Title');
$title->setValue($item->get_title());
$output->push(new ArrayData(array(
'Title' => $title,
'Date' => $date,
'Link' => $item->get_link()
)));
}
return $output;
}
}
示例4: testGetNextEol
public function testGetNextEol()
{
$text = new Text("\n");
$this->assertEquals(0, $text->getNextEol());
$text = new Text("roman");
$this->assertEquals(4, $text->getNextEol());
}
示例5: testCompile
public function testCompile()
{
$field = new Text("test", "Test");
$expected = "Test";
$value = $field->compile();
$this->assertEquals($expected, $value);
}
示例6: getComponent
public function getComponent($value, $cellFont, $row, $column)
{
$text = new Text();
$text->setFont($cellFont);
$text->value = $value;
return $text;
}
示例7: RSSItems
/**
* Gets a list of all the items in the RSS feed given a user-provided URL, limit, and date format
*
* @return ArrayList
*/
public function RSSItems()
{
if (!$this->FeedURL) {
return false;
}
$doc = new DOMDocument();
@$doc->load($this->FeedURL);
$items = $doc->getElementsByTagName('item');
$feeds = array();
foreach ($items as $node) {
$itemRSS = array('title' => $node->getElementsByTagName('title')->item(0)->nodeValue, 'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue, 'link' => $node->getElementsByTagName('link')->item(0)->nodeValue, 'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue);
$feeds[] = $itemRSS;
}
$output = ArrayList::create(array());
$count = 0;
foreach ($feeds as $item) {
if ($count >= $this->Count) {
break;
}
// Cast the Date
$date = new Date('Date');
$date->setValue($item['date']);
// Cast the Title
$title = new Text('Title');
$title->setValue($item['title']);
$output->push(new ArrayData(array('Title' => $title, 'Date' => $date->Format($this->DateFormat), 'Link' => $item['link'])));
$count++;
}
return $output;
}
示例8: testPlacementAppend
public function testPlacementAppend()
{
$decorator = new Text('foo');
$decorator->setOption('placement', 'append');
$expected = 'barfoo';
$actual = $decorator->render('bar');
$this->assertSame($expected, $actual);
}
示例9: init
public static function init($name, $value, $attrs = null)
{
$t = new Text($name, $value);
if ($attrs) {
$t->add_attrs($attrs);
}
return $t;
}
示例10: testLimitWordCountXML
/**
* Test {@link Text->LimitWordCountXML()}
*/
function testLimitWordCountXML()
{
$cases = array('<p>Stuff & stuff</p>' => 'Stuff &...', "Stuff\nBlah Blah Blah" => "Stuff<br />Blah Blah...", "Stuff<Blah Blah" => "Stuff<Blah Blah", "Stuff>Blah Blah" => "Stuff>Blah Blah");
foreach ($cases as $originalValue => $expectedValue) {
$textObj = new Text('Test');
$textObj->setValue($originalValue);
$this->assertEquals($expectedValue, $textObj->LimitWordCountXML(3));
}
}
示例11: testStrikeThrough
public function testStrikeThrough()
{
// Arrange
$text = new Text('Some italic text.', Text::STRIKETHROUGH);
// Act
$content = $text->toMarkDown();
// Assert
$this->assertSame('--Some italic text.-- ', $content);
}
示例12: fromString
public static function fromString(Text $configString)
{
$text = '';
while (false === $configString->eof() && false === $configString->eol()) {
$text .= $configString->getChar();
$configString->inc();
}
return new Comment(ltrim($text, "# "));
}
示例13: writeText
protected function writeText(Text $textChild, $level)
{
$newLine = $this->_pretty ? $this->_newLine : '';
$indent = $this->_pretty ? str_repeat($this->_tabString, $level) : '';
$text = $textChild->getText();
//TODO: Need some kind of mb_wordwrap here, maybe:
//http://stackoverflow.com/questions/3825226/multi-byte-safe-wordwrap-function-for-utf-8?
return $this->_pretty && mb_strlen($text, 'utf-8') > $this->_textWrap ? $indent . wordwrap(str_replace("\n", '', $text), $this->_textWrap, "{$newLine}{$indent}") : $text;
}
示例14: testLimitSentences
/**
* Test {@link Text->LimitSentences()}
*/
public function testLimitSentences()
{
$cases = array('' => '', 'First sentence.' => 'First sentence.', 'First sentence. Second sentence' => 'First sentence. Second sentence.', '<p>First sentence.</p>' => 'First sentence.', '<p>First sentence. Second sentence. Third sentence</p>' => 'First sentence. Second sentence.', '<p>First sentence. <em>Second sentence</em>. Third sentence</p>' => 'First sentence. Second sentence.', '<p>First sentence. <em class="dummyClass">Second sentence</em>. Third sentence</p>' => 'First sentence. Second sentence.');
foreach ($cases as $originalValue => $expectedValue) {
$textObj = new Text('Test');
$textObj->setValue($originalValue);
$this->assertEquals($expectedValue, $textObj->LimitSentences(2));
}
}
示例15: showDescription
function showDescription()
{
$spc = new Spacer();
$spc->show();
$td = new Text("Beschreibung:", 2, true);
$td->show();
$d = new Text($this->getDescription());
$d->show();
}