本文整理汇总了PHP中Site类的典型用法代码示例。如果您正苦于以下问题:PHP Site类的具体用法?PHP Site怎么用?PHP Site使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Site类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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");
}
示例2: FormSiteIpExclude
function FormSiteIpExclude(&$template, $siteAdmin)
{
parent::Form($template);
$this->siteAdmin = $siteAdmin;
$o_site = new Site($siteAdmin);
$this->a_ips = $o_site->getIpArray();
}
示例3: load
public function load()
{
parent::load();
$model = new SupportCenters();
$scs = $model->getindex();
$this->view->scs = array();
foreach ($this->sc_ids as $sc_id) {
$this->view->scs[$sc_id] = $scs[$sc_id][0];
}
if (isset($_REQUEST["summary_attrs_showcontact"])) {
$this->view->contacts = array();
$cmodel = new SupportCenterContact();
$contacts = $cmodel->getindex();
//group by contact_type_id
foreach ($this->sc_ids as $sc_id) {
$types = array();
if (isset($contacts[$sc_id])) {
foreach ($contacts[$sc_id] as $contact) {
if (!isset($types[$contact->contact_type])) {
$types[$contact->contact_type] = array();
}
$types[$contact->contact_type][] = $contact;
}
$this->view->contacts[$sc_id] = $types;
}
}
}
if (isset($_REQUEST["summary_attrs_showsites"])) {
$model = new Site();
$this->view->sites = $model->getgroupby("sc_id");
}
}
示例4: getSiteCollection
public function getSiteCollection(array $where)
{
global $dRep, $INK_User;
$values = array();
$innerjoin = '';
if (isset($where['userId'])) {
$innerjoin = "INNER JOIN ink_sites_in_roles B on (A.siteId = B.SiteId)\n\t\t\t\t\t\t INNER JOIN ink_user_in_roles C ON (B.roleId = C.roleId AND C.userId = ?)";
$values[] = $where['userId'];
unset($where['userId']);
} else {
if (isset($where['roleId'])) {
$innerjoin = "INNER JOIN ink_sites_in_roles B on (A.siteId = B.SiteId AND B.roleId = ?)";
$values[] = $where['roleId'];
unset($where['roleId']);
}
}
$where = count($where) > 0 ? 'WHERE ' . $this->sqlBuilder->createWhere($where, 'A') : '';
$sql = "SELECT * FROM ink_customer_sites A {$innerjoin} {$where} AND softdelete = ?;";
$values[] = false;
$data = $this->runManyQuery($sql, $values);
$sites = array();
foreach ($data as $index => $row) {
$properties = array('id' => $row['siteId'], 'name' => $row['sitename'], 'url' => $row['siteurl'], 'templates' => $dRep->getTemplateCollection(array('site' => $row['siteId'])), 'ftp_url' => $row['ftp_url'], 'ftp_username' => $row['ftp_username'], 'ftp_password' => $row['ftp_password'], 'ftp_root' => $row['ftp_root'], 'ftp_passive' => $row['ftp_passv'], 'ftp_mode' => $row['ftp_mode'], 'ftp_port' => $row['ftp_port']);
$site = new Site();
$site->setProperties($properties);
$sites[] = $site;
}
return $sites;
}
示例5: getUpstreamUpdates
/**
* Return the upstream for the given site
*
* @param Site $site
* @return object The upstream information
* @throws TerminusException
*/
protected function getUpstreamUpdates($site)
{
if (empty($upstream = $site->getUpstream()->getUpdates())) {
throw new TerminusException('There was a problem checking your upstream status. Please try again.');
}
return $upstream;
}
示例6: FormSiteUrls
function FormSiteUrls(&$template, $siteAdmin)
{
parent::Form($template);
$this->siteAdmin = $siteAdmin;
$o_site = new Site($siteAdmin);
$this->a_urls = $o_site->getUrls();
}
示例7: createSampleSite
public static function createSampleSite($label)
{
$site = new Site();
$v4PK = new PrimaryKey();
$site->setPrimaryKey($v4PK->getId());
$site->setShortName($label);
return $site;
}
示例8: create
public function create($data, $save = true)
{
$site = new Site($this, $data);
if ($save) {
$site->save();
}
return $site;
}
示例9: 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;
}
示例10: getSiteKey
public static function getSiteKey(Site $site = null)
{
if ($site) {
$siteKey = "site_" . $site->getId();
} else {
$siteKey = "default";
}
return $siteKey;
}
示例11: testClear
/**
* @covers HashSiteStore::clear
*/
public function testClear()
{
$store = new HashSiteStore();
$site = new Site();
$site->setGlobalId('arwiki');
$store->saveSite($site);
$this->assertCount(1, $store->getSites(), '1 site in store');
$store->clear();
$this->assertCount(0, $store->getSites(), '0 sites in store');
}
示例12: FormSiteNewsletter
function FormSiteNewsletter(&$template, $siteAdmin, $newsletterId = null)
{
parent::Form($template);
$this->siteAdmin = $siteAdmin;
// case modify a newsletter
if (!is_null($newsletterId)) {
$o_site = new Site($siteAdmin);
$this->newsletterId = $newsletterId;
$this->newsletterName = $o_site->getNewsletterName($newsletterId);
}
}
示例13: needANewsletter
function needANewsletter($idSite)
{
$idNewsletter = $this->request->getAdminNewsletter();
if (!$idNewsletter) {
$o_site = new Site($idSite);
$this->tpl->assign('newsletters_available', $o_site->getNewslettersSite());
$this->tpl->template = "admin/newsletter_selection.tpl";
return false;
} else {
return $idNewsletter;
}
}
示例14: drawMoveSite
/**
* Draws a form to move a service
* @param \Site $oldSite Site to which the service to be moved belongs
* @return null
*/
function drawMoveSite(\Site $oldSite)
{
//Check the user has permission to see the page, will throw exception
//if the user is not an admin
checkUserIsAdmin();
//Get a list of services and list of sites to select from
$sites = \Factory::getSiteService()->getSitesBy();
$services = $oldSite->getServices();
//Put into an array to be passed to view
$params = array('Sites' => $sites, 'Services' => $services, 'OldSite' => $oldSite->getShortName());
show_view("admin/move_service_end_point.php", $params);
}
示例15: FormSitePartner
function FormSitePartner(&$template, $siteAdmin, $partnerId = null)
{
parent::Form($template);
$this->siteAdmin = $siteAdmin;
// case modify a newsletter
if (!is_null($partnerId)) {
$o_site = new Site($siteAdmin);
$this->partnerId = $partnerId;
$this->partnerName = $o_site->getPartnerNameFromId($partnerId);
$this->partnerUrls = $o_site->getPartnerUrlsId($partnerId);
}
}