本文整理汇总了PHP中Site::getGlobalId方法的典型用法代码示例。如果您正苦于以下问题:PHP Site::getGlobalId方法的具体用法?PHP Site::getGlobalId怎么用?PHP Site::getGlobalId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Site
的用法示例。
在下文中一共展示了Site::getGlobalId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preSetElement
/**
* @see GenericArrayObject::preSetElement
*
* @since 1.21
*
* @param int|string $index
* @param Site $site
*
* @return boolean
*/
protected function preSetElement($index, $site)
{
if ($this->hasSite($site->getGlobalId())) {
$this->removeSite($site->getGlobalId());
}
$this->byGlobalId[$site->getGlobalId()] = $index;
$this->byInternalId[$site->getInternalId()] = $index;
return true;
}
示例2: preSetElement
/**
* @see GenericArrayObject::preSetElement
*
* @since 1.21
*
* @param int|string $index
* @param Site $site
*
* @return bool
*/
protected function preSetElement($index, $site)
{
if ($this->hasSite($site->getGlobalId())) {
$this->removeSite($site->getGlobalId());
}
$this->byGlobalId[$site->getGlobalId()] = $index;
$this->byInternalId[$site->getInternalId()] = $index;
$ids = $site->getNavigationIds();
foreach ($ids as $navId) {
$this->byNavigationId[$navId] = $index;
}
return true;
}
示例3: exportSite
/**
* Writes a <site> tag representing the given Site object.
*
* @param Site $site
*/
private function exportSite(Site $site)
{
if ($site->getType() !== Site::TYPE_UNKNOWN) {
$siteAttr = ['type' => $site->getType()];
} else {
$siteAttr = null;
}
fwrite($this->sink, "\t" . Xml::openElement('site', $siteAttr) . "\n");
fwrite($this->sink, "\t\t" . Xml::element('globalid', null, $site->getGlobalId()) . "\n");
if ($site->getGroup() !== Site::GROUP_NONE) {
fwrite($this->sink, "\t\t" . Xml::element('group', null, $site->getGroup()) . "\n");
}
if ($site->getSource() !== Site::SOURCE_LOCAL) {
fwrite($this->sink, "\t\t" . Xml::element('source', null, $site->getSource()) . "\n");
}
if ($site->shouldForward()) {
fwrite($this->sink, "\t\t" . Xml::element('forward', null, '') . "\n");
}
foreach ($site->getAllPaths() as $type => $path) {
fwrite($this->sink, "\t\t" . Xml::element('path', ['type' => $type], $path) . "\n");
}
foreach ($site->getLocalIds() as $type => $ids) {
foreach ($ids as $id) {
fwrite($this->sink, "\t\t" . Xml::element('localid', ['type' => $type], $id) . "\n");
}
}
// @todo: export <data>
// @todo: export <config>
fwrite($this->sink, "\t" . Xml::closeElement('site') . "\n");
}
示例4: getRowFromSite
/**
* Get a new ORMRow from a Site object
*
* @since 1.22
*
* @param Site $site
*
* @return ORMRow
*/
protected function getRowFromSite(Site $site)
{
$fields = array('global_key' => $site->getGlobalId(), 'type' => $site->getType(), 'group' => $site->getGroup(), 'source' => $site->getSource(), 'language' => $site->getLanguageCode() === null ? '' : $site->getLanguageCode(), 'protocol' => $site->getProtocol(), 'domain' => strrev($site->getDomain()) . '.', 'data' => $site->getExtraData(), 'forward' => $site->shouldForward(), 'config' => $site->getExtraConfig());
if ($site->getInternalId() !== null) {
$fields['id'] = $site->getInternalId();
}
return new ORMRow($this->sitesTable, $fields);
}
示例5: testSetGlobalId
/**
* @dataProvider instanceProvider
* @param Site $site
* @covers Site::setGlobalId
*/
public function testSetGlobalId(Site $site)
{
$site->setGlobalId('foobar');
$this->assertEquals('foobar', $site->getGlobalId());
}
示例6: saveSite
/**
* Saves the provided site.
*
* @since 1.25
*
* @param Site $site
*
* @return boolean Success indicator
*/
public function saveSite(Site $site)
{
$this->sites[$site->getGlobalId()] = $site;
return true;
}