当前位置: 首页>>代码示例>>PHP>>正文


PHP Writer::setSyndicationRight方法代码示例

本文整理汇总了PHP中Writer::setSyndicationRight方法的典型用法代码示例。如果您正苦于以下问题:PHP Writer::setSyndicationRight方法的具体用法?PHP Writer::setSyndicationRight怎么用?PHP Writer::setSyndicationRight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Writer的用法示例。


在下文中一共展示了Writer::setSyndicationRight方法的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}&amp;pw={startPage?}&amp;format=atom"/>
   <Url type="application/rss+xml"
        template="http://example.com/?q={searchTerms}&amp;pw={startPage?}&amp;format=rss"/>
   <Url type="text/html" 
        template="http://example.com/?q={searchTerms}&amp;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);
    }
开发者ID:k42b3,项目名称:psx-ws,代码行数:48,代码来源:WriterTest.php


注:本文中的Writer::setSyndicationRight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。