Пример #1
0
 public function __construct($itemType = null)
 {
     EventHandler::getInstance()->fireAction($this, 'init');
     if (!$itemType instanceof \wcf\data\jcoins\shop\item\type\JCoinsShopItemType) {
         $this->itemType = \wcf\data\jcoins\shop\item\type\JCoinsShopItemType::getByIdentifer($this->getIdentifer());
     } else {
         $this->itemType = $itemType;
     }
     EventHandler::getInstance()->fireAction($this, 'inited');
 }
Пример #2
0
 /**
  * @see	\wcf\form\IForm::validate()
  */
 public function validate()
 {
     parent::validate();
     if (!I18nHandler::getInstance()->validateValue('name')) {
         throw new UserInputException('name');
     }
     if ($this->price < 1) {
         throw new UserInputException('price');
     }
     if ($this->price > 4294967294) {
         throw new UserInputException('price', 'max');
     }
     if ($this->type->getObjectID() == 0) {
         throw new UserInputException('type');
     }
     $this->validateParameterParameters();
 }
 /**
  * @see	\wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::validateImport()
  */
 protected function validateImport(array $data)
 {
     if (empty($data['className'])) {
         throw new SystemException('className cannot be empty');
     }
     if (empty($data['identifer'])) {
         throw new SystemException('identifer cannot be empty');
     } else {
         $type = JCoinsShopItemType::getByIdentifer($data['identifer']);
         if ($type->getObjectID() != 0) {
             $package = new \wcf\data\package\Package($type->packageID);
             throw new SystemException('identifer is not unique (use by: ' . $package->packageName . ')');
         }
     }
 }