當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Text類代碼示例

本文整理匯總了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%')));
 }
開發者ID:rexxars,項目名稱:morse,代碼行數:7,代碼來源:TextTest.php

示例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>";
 }
開發者ID:CyborgOne,項目名稱:cybihomecontrol_ui,代碼行數:30,代碼來源:Achor.php

示例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;
		}
	}
開發者ID:neopba,項目名稱:silverstripe-book,代碼行數:28,代碼來源:RSSWidget.php

示例4: testGetNextEol

 public function testGetNextEol()
 {
     $text = new Text("\n");
     $this->assertEquals(0, $text->getNextEol());
     $text = new Text("roman");
     $this->assertEquals(4, $text->getNextEol());
 }
開發者ID:romanpitak,項目名稱:Nginx-Config-Processor,代碼行數:7,代碼來源:TextTest.php

示例5: testCompile

 public function testCompile()
 {
     $field = new Text("test", "Test");
     $expected = "Test";
     $value = $field->compile();
     $this->assertEquals($expected, $value);
 }
開發者ID:jenwachter,項目名稱:html-form,代碼行數:7,代碼來源:TextTest.php

示例6: getComponent

 public function getComponent($value, $cellFont, $row, $column)
 {
     $text = new Text();
     $text->setFont($cellFont);
     $text->value = $value;
     return $text;
 }
開發者ID:sigmadesarrollo,項目名稱:logisoft,代碼行數:7,代碼來源:BaseCellRenderer.php

示例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;
 }
開發者ID:helpfulrobot,項目名稱:unclecheese-dashboard,代碼行數:35,代碼來源:DashboardRSSFeedPanel.php

示例8: testPlacementAppend

 public function testPlacementAppend()
 {
     $decorator = new Text('foo');
     $decorator->setOption('placement', 'append');
     $expected = 'barfoo';
     $actual = $decorator->render('bar');
     $this->assertSame($expected, $actual);
 }
開發者ID:urbanetter,項目名稱:muentschi,代碼行數:8,代碼來源:TextTest.php

示例9: init

 public static function init($name, $value, $attrs = null)
 {
     $t = new Text($name, $value);
     if ($attrs) {
         $t->add_attrs($attrs);
     }
     return $t;
 }
開發者ID:DaniloEpic,項目名稱:slast,代碼行數:8,代碼來源:Formulario.php

示例10: testLimitWordCountXML

 /**
  * Test {@link Text->LimitWordCountXML()}
  */
 function testLimitWordCountXML()
 {
     $cases = array('<p>Stuff & stuff</p>' => 'Stuff &amp;...', "Stuff\nBlah Blah Blah" => "Stuff<br />Blah Blah...", "Stuff<Blah Blah" => "Stuff&lt;Blah Blah", "Stuff>Blah Blah" => "Stuff&gt;Blah Blah");
     foreach ($cases as $originalValue => $expectedValue) {
         $textObj = new Text('Test');
         $textObj->setValue($originalValue);
         $this->assertEquals($expectedValue, $textObj->LimitWordCountXML(3));
     }
 }
開發者ID:racontemoi,項目名稱:shibuichi,代碼行數:12,代碼來源:TextTest.php

示例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);
 }
開發者ID:pachico,項目名稱:markdownwriter,代碼行數:9,代碼來源:TextTest.php

示例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, "# "));
 }
開發者ID:romanpitak,項目名稱:Nginx-Config-Processor,代碼行數:9,代碼來源:Comment.php

示例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;
 }
開發者ID:talesoft,項目名稱:tale-framework,代碼行數:9,代碼來源:Writer.php

示例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));
     }
 }
開發者ID:normann,項目名稱:sapphire,代碼行數:12,代碼來源:TextTest.php

示例15: showDescription

 function showDescription()
 {
     $spc = new Spacer();
     $spc->show();
     $td = new Text("Beschreibung:", 2, true);
     $td->show();
     $d = new Text($this->getDescription());
     $d->show();
 }
開發者ID:CyborgOne,項目名稱:cybihomecontrol_ui,代碼行數:9,代碼來源:LogFile.php


注:本文中的Text類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。