本文整理汇总了PHP中Writer::addImage方法的典型用法代码示例。如果您正苦于以下问题:PHP Writer::addImage方法的具体用法?PHP Writer::addImage怎么用?PHP Writer::addImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Writer
的用法示例。
在下文中一共展示了Writer::addImage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testComplexWriter
public function testComplexWriter()
{
$writer = new Writer('Web Search', 'Use Example.com to search the Web.');
$writer->setTags(array('example', 'web'));
$writer->setContact('admin@example.com');
$writer->addUrl('http://example.com/?q={searchTerms}&pw={startPage?}&format=atom', 'application/atom+xml');
$writer->addUrl('http://example.com/?q={searchTerms}&pw={startPage?}&format=rss', 'application/rss+xml');
$writer->addUrl('http://example.com/?q={searchTerms}&pw={startPage?}', 'text/html');
$writer->setLongName('Example.com Web Search');
$writer->addImage('http://example.com/websearch.png', 64, 64, 'image/png');
$writer->addImage('http://example.com/websearch.ico', 16, 16, 'image/vnd.microsoft.icon');
$writer->addQuery('example', 'cat');
$writer->setDeveloper('Example.com Development Team');
$writer->setAttribution('Search data Copyright 2005, Example.com, Inc., All Rights Reserved');
$writer->setSyndicationRight('open');
$writer->setAdultContent(false);
$writer->setLanguage('en-us');
$writer->setOutputEncoding('UTF-8');
$writer->setInputEncoding('UTF-8');
$actual = $writer->toString();
$expected = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>Web Search</ShortName>
<Description>Use Example.com to search the Web.</Description>
<Tags>example web</Tags>
<Contact>admin@example.com</Contact>
<Url type="application/atom+xml"
template="http://example.com/?q={searchTerms}&pw={startPage?}&format=atom"/>
<Url type="application/rss+xml"
template="http://example.com/?q={searchTerms}&pw={startPage?}&format=rss"/>
<Url type="text/html"
template="http://example.com/?q={searchTerms}&pw={startPage?}"/>
<LongName>Example.com Web Search</LongName>
<Image height="64" width="64" type="image/png">http://example.com/websearch.png</Image>
<Image height="16" width="16" type="image/vnd.microsoft.icon">http://example.com/websearch.ico</Image>
<Query role="example" searchTerms="cat" />
<Developer>Example.com Development Team</Developer>
<Attribution>Search data Copyright 2005, Example.com, Inc., All Rights Reserved</Attribution>
<SyndicationRight>open</SyndicationRight>
<AdultContent>false</AdultContent>
<Language>en-us</Language>
<OutputEncoding>UTF-8</OutputEncoding>
<InputEncoding>UTF-8</InputEncoding>
</OpenSearchDescription>
XML;
$this->assertXmlStringEqualsXmlString($expected, $actual);
}