protected function declareParameters() { $this->source = new XorParameter('source'); $email = new String('email'); $email->setValidateType('email'); $this->source->addParameter($email); $user = new User('user'); $this->source->addParameter($user); $this->source->setDefaultParameter($user); global $wgUser; $this->source->setDefaultValue($wgUser, false); $this->addParameter($this->source); $this->size = new IntegerInPixel('size'); global $wgWFMKMaxWidth; $this->size->setMax(min(array($wgWFMKMaxWidth, 2048))); $this->size->setDefaultValue(80); $this->addParameter($this->size); /* * Currently, rating is forced to G: "suitable for display on all websites with any audience type" $this->rating = new XorParameter('rating'); $this->rating->addParameter(new Option('g')); // +++ all websites with any audience type $this->rating->addParameter(new Option('pg')); // ++ $this->rating->addParameter(new Option('r')); // + $this->rating->addParameter(new Option('x')); // ! hardcore $this->addParameter($this->rating); */ $float = new XorParameter('float'); $this->right = new Option('right'); $float->addParameter($this->right); $this->left = new Option('left'); $float->addParameter($this->left); $this->addParameter($float); }
/** * Declares the widget's parameters: * <ul> * <li>instanciates Parameter objects,</li> * <li>configures them and</li> * <li>calls addParameter() for each of them.</li> * </ul> * * @return void */ protected function declareParameters() { global $wgWFMKMaxWidth; $this->id = new String('id'); $this->id->setEscapeMode('urlpathinfo'); $this->playlist = new String('playlist'); $this->playlist->setEscapeMode('urlpathinfo'); $source = new XorParameter('source'); $source->addParameter($this->id); $source->addParameter($this->playlist); $source->setRequired(); // user need to set one of these parameter $source->setDefaultParameter($this->id); // user don't need to type "id=xxx", just "xxx" at right position $this->addParameter($source); $this->width = new IntegerInPixel('width'); $this->width->setDefaultValue($wgWFMKMaxWidth); $this->width->setMin(0); $this->width->setMax($wgWFMKMaxWidth); $this->addParameter($this->width); $this->height = new IntegerInPixel('height'); $this->height->setDefaultValue(441); $this->height->setMin(0); $this->addParameter($this->height); $float = new XorParameter('float'); $this->right = new Option('right'); $float->addParameter($this->right); $this->left = new Option('left'); $float->addParameter($this->left); $this->addParameter($float); }
/** * Declares the widget's parameters: * <ul> * <li>instanciates Parameter objects,</li> * <li>configures them and</li> * <li>calls addParameter() for each of them.</li> * </ul> * * @return void */ protected function declareParameters() { global $wgWFMKMaxWidth; $this->id = new String('id'); $this->id->setEscapeMode('urlpathinfo'); $this->addParameter($this->id); $this->oldkey = new String('oldkey'); $this->oldkey->setEscapeMode('urlpathinfo'); $this->addParameter($this->oldkey); $this->width = new IntegerInPixel('width'); $this->width->setDefaultValue($wgWFMKMaxWidth - 2); // -2 because of frameborder $this->width->setMax($wgWFMKMaxWidth - 2); // -2 because of frameborder $this->addParameter($this->width); $this->height = new IntegerInPixel('height'); $this->height->setDefaultValue($wgWFMKMaxWidth); $this->addParameter($this->height); $float = new XorParameter('float'); $this->right = new Option('right'); $float->addParameter($this->right); $this->left = new Option('left'); $float->addParameter($this->left); $this->addParameter($float); }
/** * Checks parameters requirements (required, min, max,...). * Updates default values of some parameters according the other parameters * values. * * @throws UserError When a parameter fails its validate. */ protected function validate() { parent::validate(); if ($this->source->getParameter()->getName() == 'track') { $this->height->setDefaultValue(166); } }
/** * Declares the widget's parameters: * <ul> * <li>instanciates Parameter objects,</li> * <li>configures them and</li> * <li>calls addParameter() for each of them.</li> * </ul> * * @return void */ protected function declareParameters() { global $wgWFMKMaxWidth; $user = new String('user'); $user->setEscapeMode('quotes'); $search = new String('search'); $search->setEscapeMode('quotes'); $this->source = new XorParameter('source'); $this->source->addParameter($user); $this->source->addParameter($search); $this->source->setRequired(); // one of theses parameters has to be set $this->source->setDefaultParameter($user); // user don't need to type "user=xxx", just "xxx" at right position $this->addParameter($this->source); $this->faves = new Option('faves'); $this->list = new String('list'); $this->list->setEscapeMode('quotes'); $this->follow = new Option('follow'); $mode = new XorParameter('mode'); $mode->addParameter($this->faves); $mode->addParameter($this->list); $mode->addParameter($this->follow); $this->addParameter($mode); $this->title = new String('title'); $this->title->setEscapeMode('quotes'); $this->addParameter($this->title); $this->subject = new String('subject'); $this->subject->setEscapeMode('quotes'); $this->addParameter($this->subject); $this->width = new IntegerInPixel('width'); $this->width->setDefaultValue($wgWFMKMaxWidth); $this->width->setMin(0); $this->width->setMax($wgWFMKMaxWidth); $this->addParameter($this->width); $this->height = new IntegerInPixel('height'); $this->height->setDefaultValue(441); $this->height->setMin(0); $this->addParameter($this->height); $this->count = new Integer('count'); $this->count->setDefaultValue(5); $this->count->setMin(0); $this->count->setMax(30); $this->addParameter($this->count); $this->scrollbar = new Boolean('scrollbar'); $this->addParameter($this->scrollbar); $this->live = new Boolean('live'); $this->addParameter($this->live); $this->loop = new Boolean('loop'); $this->addParameter($this->loop); $this->all = new Boolean('all'); $this->addParameter($this->all); $float = new XorParameter('float'); $this->right = new Option('right'); $float->addParameter($this->right); $this->left = new Option('left'); $float->addParameter($this->left); $this->addParameter($float); }
/** * Checks parameters requirements (required, min, max,...). * Updates default values of some parameters according the other parameters * values. * * @throws UserError When a parameter fails its validate. */ protected function validate() { parent::validate(); // Checks parameters requirements (required, min, max,...). $faces = $this->faces->getValue(); $stream = $this->stream->getValue(); if ($faces && $stream) { $this->height->setDefaultValue(556); } elseif ($stream) { // && !$faces $this->height->setDefaultValue(395); } elseif ($faces) { // && !$stream $this->height->setDefaultValue(258); } else { // !$faces && !$stream $this->height->setDefaultValue(63); } }
/** * Declares the widget's parameters: * <ul> * <li>instanciates Parameter objects,</li> * <li>configures them and</li> * <li>calls addParameter() for each of them.</li> * </ul> * * @return void */ protected function declareParameters() { global $wgWFMKMaxWidth; $this->url = new String('url'); $this->url->setValidateType('url'); $this->url->setRequired(); $this->addParameter($this->url); $this->width = new IntegerInPixel('width'); $this->width->setDefaultValue($wgWFMKMaxWidth); $this->width->setMax($wgWFMKMaxWidth); $this->addParameter($this->width); $this->height = new IntegerInPixel('height'); $this->addParameter($this->height); $float = new XorParameter('float'); $this->right = new Option('right'); $float->addParameter($this->right); $this->left = new Option('left'); $float->addParameter($this->left); $this->addParameter($float); }
/** * Declares the widget's parameters: * <ul> * <li>instanciates Parameter objects,</li> * <li>configures them and</li> * <li>calls addParameter() for each of them.</li> * </ul> * * @return void */ protected function declareParameters() { global $wgWFMKMaxWidth; $this->id = new String('id'); $this->id->setEscapeMode('urlpathinfo'); $this->id->setRequired(); $this->addParameter($this->id); $this->width = new IntegerInPixel('width'); $this->width->setDefaultValue($wgWFMKMaxWidth); $this->width->setMax($wgWFMKMaxWidth); $this->addParameter($this->width); $this->height = new IntegerInPixel('height'); $this->height->setDefaultValue(441); $this->addParameter($this->height); $float = new XorParameter('float'); $this->right = new Option('right'); $float->addParameter($this->right); $this->left = new Option('left'); $float->addParameter($this->left); $this->addParameter($float); }
/** * Declares the widget's parameters: * <ul> * <li>instanciates Parameter objects,</li> * <li>configures them and</li> * <li>calls addParameter() for each of them.</li> * </ul> * * @return void */ protected function declareParameters() { global $wgWFMKMaxWidth; // the identifier is a numeric value, but very long // handling it as an Integer could break when MediaWiki runs on 32bits servers // the safer is to handle it as string, and validate only digits $user = new String('user'); $user->setValidateType('digits'); // a +1 take an url as value, the default is the current page $url = new String('url'); $url->setValidateType('url'); $url->setEscapeMode('none'); $this->target = new XorParameter('target'); $this->target->addParameter($url); $this->target->addParameter($user); $this->target->setDefaultParameter($url); // parse as "target = URL_VALUE" by default $this->addParameter($this->target); $this->size = new XorParameter('size'); $small = new Option('small'); // +1 badge icon $medium = new Option('medium'); // +1 $standard = new Option('standard'); // +1 badge icon $large = new Option('large'); // +1 icon $this->size = new XorParameter('size'); $this->size->addParameter($small); $this->size->addParameter($medium); $this->size->addParameter($standard); $this->size->addParameter($large); $this->size->setDefaultParameter($standard); $standard->setDefaultValue(true); $this->addParameter($this->size); $none = new Option('none'); $bubble = new Option('bubble'); $inline = new Option('inline'); $this->annotation = new XorParameter('annotation'); // used for +1 $this->annotation->addParameter($none); $this->annotation->addParameter($bubble); $this->annotation->addParameter($inline); $this->annotation->setDefaultParameter($none); // size's default output is none's default output $none->setDefaultValue(true); // default value of none is true = none's default output is 'none' $this->addParameter($this->annotation); $this->icon = new Boolean('icon'); $this->addParameter($this->icon); $this->width = new IntegerInPixel('width'); // used for +1 with annotation=inline $this->width->setMax($wgWFMKMaxWidth); $this->width->setDefaultValue(300); $this->addParameter($this->width); $float = new XorParameter('float'); $this->right = new Option('right'); $float->addParameter($this->right); $this->left = new Option('left'); $float->addParameter($this->left); $this->addParameter($float); }
/** * Declares the widget's parameters: * <ul> * <li>instanciates Parameter objects,</li> * <li>configures them and</li> * <li>calls addParameter() for each of them.</li> * </ul> * * @return void */ protected function declareParameters() { $this->source = new XorParameter('source'); $this->user = new String('user'); $this->source->addParameter($this->user); $this->tag = new String('tag'); $this->source->addParameter($this->tag); $this->addParameter($this->source); $this->source->setRequired(); $this->size = new IntegerInPixel('size'); $this->size->setDefaultValue(80); $this->addParameter($this->size); $this->width = new Integer('width'); $this->width->setDefaultValue(9); $this->width->setMin(1); $this->width->setMax(10); $this->addParameter($this->width); $this->height = new Integer('height'); $this->height->setDefaultValue(1); $this->height->setMin(1); $this->height->setMax(10); $this->addParameter($this->height); $this->padding = new Integer('padding'); $this->padding->setDefaultValue(8); $this->padding->setMin(0); $this->addParameter($this->padding); $this->color = new String('color'); $this->addParameter($this->color); $this->slideshow = new Boolean('slideshow'); $this->addParameter($this->slideshow); $this->border = new Boolean('border'); $this->addParameter($this->border); $this->float = new XorParameter('float'); $right = new Option('right'); $this->float->addParameter($right); $left = new Option('left'); $this->float->addParameter($left); $this->addParameter($this->float); $this->category = new XorParameter('category'); $this->category->addParameter(new Option('Abstract')); $this->category->addParameter(new Option('Animals')); $this->category->addParameter(new Option('Black and White')); $this->category->addParameter(new Option('Celebrities')); $this->category->addParameter(new Option('City and Architecture')); $this->category->addParameter(new Option('Commercial')); $this->category->addParameter(new Option('Concert')); $this->category->addParameter(new Option('Family')); $this->category->addParameter(new Option('Fashion')); $this->category->addParameter(new Option('Film')); $this->category->addParameter(new Option('Fine Art')); $this->category->addParameter(new Option('Food')); $this->category->addParameter(new Option('Journalism')); $this->category->addParameter(new Option('Landscapes')); $this->category->addParameter(new Option('Macro')); $this->category->addParameter(new Option('Nature')); $this->category->addParameter(new Option('Nude')); $this->category->addParameter(new Option('People')); $this->category->addParameter(new Option('Performing Arts')); $this->category->addParameter(new Option('Sport')); $this->category->addParameter(new Option('Still Life')); $this->category->addParameter(new Option('Street')); $this->category->addParameter(new Option('Transportation')); $this->category->addParameter(new Option('Travel')); $this->category->addParameter(new Option('Underwater')); $this->category->addParameter(new Option('Urban Exploration')); $this->category->addParameter(new Option('Wedding')); $this->category->addParameter(new Option('Uncategorized')); $this->addParameter($this->category); }