本文整理匯總了PHP中TYPO3\CMS\Core\Tests\AccessibleObjectInterface::cropHTML方法的典型用法代碼示例。如果您正苦於以下問題:PHP AccessibleObjectInterface::cropHTML方法的具體用法?PHP AccessibleObjectInterface::cropHTML怎麽用?PHP AccessibleObjectInterface::cropHTML使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TYPO3\CMS\Core\Tests\AccessibleObjectInterface
的用法示例。
在下文中一共展示了AccessibleObjectInterface::cropHTML方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: cropHtmlWorksWithLinebreaks
/**
* Checks if stdWrap.cropHTML handles linebreaks correctly (by ignoring them)
*
* @test
*/
public function cropHtmlWorksWithLinebreaks()
{
$subject = "Lorem ipsum dolor sit amet,\nconsetetur sadipscing elitr,\nsed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam";
$expected = "Lorem ipsum dolor sit amet,\nconsetetur sadipscing elitr,\nsed diam nonumy eirmod tempor invidunt ut labore et dolore magna";
$result = $this->subject->cropHTML($subject, '121');
$this->assertEquals($expected, $result);
}
示例2: cropHtmlWorksWithComplexContent
/**
* Checks if stdWrap.cropHTML works with a complex content with many tags. Currently cropHTML
* counts multiple invisible characters not as one (as the browser will output the content).
*
* @test
*/
public function cropHtmlWorksWithComplexContent()
{
$GLOBALS['TSFE']->renderCharset = 'iso-8859-1';
$subject = '
<h1>Blog Example</h1>
<hr>
<div class="csc-header csc-header-n1">
<h2 class="csc-firstHeader">Welcome to Blog #1</h2>
</div>
<p class="bodytext">
A blog about TYPO3 extension development. In order to start blogging, read the <a href="#">Help section</a>. If you have any further questions, feel free to contact the administrator John Doe (<a href="mailto:john.doe@example.com">john.doe@example.com)</a>.
</p>
<div class="tx-blogexample-list-container">
<p class="bodytext">
Below are the most recent posts:
</p>
<ul>
<li>
<h3>
<a href="index.php?id=99&tx_blogexample_pi1[post][uid]=211&tx_blogexample_pi1[blog]=&tx_blogexample_pi1[action]=show&tx_blogexample_pi1[controller]=Post&cHash=003b0131ed">The Post #1</a>
</h3>
<p class="bodytext">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut...
</p>
<p class="metadata">
Published on 26.08.2009 by Jochen Rau
</p>
<p>
Tags: [MVC] [Domain Driven Design] <br>
<a href="index.php?id=99&tx_blogexample_pi1[post][uid]=211&tx_blogexample_pi1[action]=show&tx_blogexample_pi1[controller]=Post&cHash=f982643bc3">read more >></a><br>
<a href="index.php?id=99&tx_blogexample_pi1[post][uid]=211&tx_blogexample_pi1[blog][uid]=70&tx_blogexample_pi1[action]=edit&tx_blogexample_pi1[controller]=Post&cHash=5b481bc8f0">Edit</a> <a href="index.php?id=99&tx_blogexample_pi1[post][uid]=211&tx_blogexample_pi1[blog][uid]=70&tx_blogexample_pi1[action]=delete&tx_blogexample_pi1[controller]=Post&cHash=4e52879656">Delete</a>
</p>
</li>
</ul>
<p>
<a href="index.php?id=99&tx_blogexample_pi1[blog][uid]=70&tx_blogexample_pi1[action]=new&tx_blogexample_pi1[controller]=Post&cHash=2718a4b1a0">Create a new Post</a>
</p>
</div>
<hr>
<p>
? TYPO3 Association
</p>
';
$result = $this->cObj->cropHTML($subject, '300');
$expected = '
<h1>Blog Example</h1>
<hr>
<div class="csc-header csc-header-n1">
<h2 class="csc-firstHeader">Welcome to Blog #1</h2>
</div>
<p class="bodytext">
A blog about TYPO3 extension development. In order to start blogging, read the <a href="#">Help section</a>. If you have any further questions, feel free to contact the administrator John Doe (<a href="mailto:john.doe@example.com">john.doe@example.com)</a>.
</p>
<div class="tx-blogexample-list-container">
<p class="bodytext">
Below are the most recent posts:
</p>
<ul>
<li>
<h3>
<a href="index.php?id=99&tx_blogexample_pi1[post][uid]=211&tx_blogexample_pi1[blog]=&tx_blogexample_pi1[action]=show&tx_blogexample_pi1[controller]=Post&cHash=003b0131ed">The Pos</a></h3></li></ul></div>';
$this->assertEquals($expected, $result);
$result = $this->cObj->cropHTML($subject, '-100');
$expected = '<div class="tx-blogexample-list-container"><ul><li><p>Design] <br>
<a href="index.php?id=99&tx_blogexample_pi1[post][uid]=211&tx_blogexample_pi1[action]=show&tx_blogexample_pi1[controller]=Post&cHash=f982643bc3">read more >></a><br>
<a href="index.php?id=99&tx_blogexample_pi1[post][uid]=211&tx_blogexample_pi1[blog][uid]=70&tx_blogexample_pi1[action]=edit&tx_blogexample_pi1[controller]=Post&cHash=5b481bc8f0">Edit</a> <a href="index.php?id=99&tx_blogexample_pi1[post][uid]=211&tx_blogexample_pi1[blog][uid]=70&tx_blogexample_pi1[action]=delete&tx_blogexample_pi1[controller]=Post&cHash=4e52879656">Delete</a>
</p>
</li>
</ul>
<p>
<a href="index.php?id=99&tx_blogexample_pi1[blog][uid]=70&tx_blogexample_pi1[action]=new&tx_blogexample_pi1[controller]=Post&cHash=2718a4b1a0">Create a new Post</a>
</p>
</div>
<hr>
<p>
? TYPO3 Association
</p>
';
$this->assertEquals($expected, $result);
}