/** * 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->profile = new String('profile'); $this->profile->setRequired(); $this->addParameter($this->profile); $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(556); $this->height->setMin(0); $this->addParameter($this->height); $this->faces = new Boolean('faces'); $this->faces->setDefaultValue(true); $this->addParameter($this->faces); $this->stream = new Boolean('stream'); $this->stream->setDefaultValue(true); $this->addParameter($this->stream); $this->force_wall = new Boolean('force_wall'); $this->addParameter($this->force_wall); $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); }
/** * 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() { // 100 - 180 // set default url (default parameter is url) $this->target->setDefaultValue($this->parser->getTitle()->getCanonicalUrl()); if ($this->target->getParameter()->getName() == 'url') { if ($this->annotation->getOutput() == 'inline') { // displaying a +1 button inline // google documentation about width: min = 120, default (when unspecified) = 450 $this->width->setMin(120); } } else { // $this->target->getParameter()->getName() = 'user' if (!$this->icon->getValue()) { // displaying a badge, not just an icon if ($this->size->getOutput() == 'small') { $this->height_value = 69; $this->width->setMin(170); // google documentation } else { $this->height_value = 131; $this->width->setMin(100); // google documentation } } } parent::validate(); }
/** * 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); }
/** * 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->setEscapeMode('urlpathinfo'); $this->addParameter($this->url); $this->width = new IntegerInPixel('width'); $this->width->setDefaultValue($wgWFMKMaxWidth - 2); $this->width->setMax($wgWFMKMaxWidth - 2); $this->width->setMin(0); $this->addParameter($this->width); $this->height = new IntegerInPixel('height'); $this->height->setDefaultValue($wgWFMKMaxWidth); $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() { // Set $wgDisqusShortName in LocalSettings as you discus account name global $wgDisqusShortName, $wgWFMKMaxWidth; $this->shortname = new String('shortname'); $this->shortname->setEscapeMode('javascript'); $this->shortname->setDefaultValue($wgDisqusShortName); $this->addParameter($this->shortname); $this->id = new String('id'); $this->id->setEscapeMode('javascript'); $this->addParameter($this->id); $this->url = new String('url'); $this->url->setEscapeMode('javascript'); $this->url->setDefaultValue($this->parser->getTitle()->getCanonicalURL()); $this->addParameter($this->url); $this->title = new String('title'); $this->title->setEscapeMode('javascript'); $this->title->setDefaultValue($this->parser->getTitle()->getFullText()); $this->addParameter($this->title); $this->width = new IntegerInPixel('width'); $this->width->setMax($wgWFMKMaxWidth); $this->width->setMin(0); $this->addParameter($this->width); $this->height = new IntegerInPixel('height'); $this->height->setMin(0); $this->addParameter($this->height); $this->frame = new Option('frame'); $this->addParameter($this->frame); $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); $this->dev = new Option('dev'); $this->addParameter($this->dev); }