/** * @see SpecialModifyEntity::prepareArguments() * * @since 0.4 * * @param string $subPage */ protected function prepareArguments($subPage) { parent::prepareArguments($subPage); $request = $this->getRequest(); $parts = $subPage === '' ? array() : explode('/', $subPage, 2); // Language $this->languageCode = $request->getVal('language', isset($parts[1]) ? $parts[1] : ''); if ($this->languageCode === '') { $this->languageCode = null; } $this->checkSubPageLanguage(); // Value $this->value = $this->getPostedValue(); if ($this->value === null) { $this->value = $request->getVal('value'); } }
/** * @see SpecialModifyEntity::prepareArguments() * * @since 0.4 * * @param string $subPage */ protected function prepareArguments($subPage) { parent::prepareArguments($subPage); $request = $this->getRequest(); // explode the sub page from the format Special:SetSitelink/q123/enwiki $parts = $subPage === '' ? array() : explode('/', $subPage, 2); // check if id belongs to an item if ($this->entityRevision !== null && !$this->entityRevision->getEntity() instanceof Item) { $itemId = $this->entityRevision->getEntity()->getId(); $msg = $this->msg('wikibase-setsitelink-not-item', $itemId->getSerialization()); $this->showErrorHTML($msg->parse()); $this->entityRevision = null; } $this->site = trim($request->getVal('site', isset($parts[1]) ? $parts[1] : '')); if ($this->site === '') { $this->site = null; } if ($this->site !== null && !$this->isValidSiteId($this->site)) { $this->showErrorHTML($this->msg('wikibase-setsitelink-invalid-site', $this->site)->parse()); } $this->page = $request->getVal('page'); $this->badges = array(); foreach ($this->badgeItems as $badgeId => $value) { if ($request->getVal('badge-' . $badgeId)) { $this->badges[] = $badgeId; } } }
/** * @see SpecialModifyEntity::prepareArguments * * @param string $subPage */ protected function prepareArguments($subPage) { $this->extractInput($subPage); // Parse the 'id' parameter and throw an exception if the entity cannot be loaded parent::prepareArguments($subPage); if ($this->languageCode === '') { $this->languageCode = $this->getLanguage()->getCode(); } elseif (!$this->isValidLanguageCode($this->languageCode)) { $msg = $this->msg('wikibase-wikibaserepopage-invalid-langcode', $this->languageCode); $this->showErrorHTML($msg->parse()); $this->languageCode = null; } if ($this->languageCode !== null && $this->entityRevision !== null) { $entity = $this->entityRevision->getEntity(); if ($entity instanceof FingerprintProvider) { $this->setFingerprintFields($entity->getFingerprint()); } } }