Esempio n. 1
0
 /**
  * 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);
 }
Esempio n. 2
0
 /**
  * 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);
 }
Esempio n. 3
0
 /**
  * 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);
 }
Esempio n. 4
0
 /**
  * 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->url = new String('url');
     $this->url->setValidateType('url');
     $this->url->setRequired();
     $this->addParameter($this->url);
     $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);
 }
Esempio n. 5
0
 /**
  * 
  * @return string
  */
 protected function getClass()
 {
     $classes = array();
     $classes[] = 'wfmk_button';
     if ($this->right->getValue()) {
         $classes[] = 'wfmk_right';
     } elseif ($this->left->getValue()) {
         $classes[] = 'wfmk_left';
     }
     $classes[] = 'wfmk_button_' . $this->color->getOutput();
     $classes = Tools::ArrayToCSSClasses($classes);
     return 'class="' . $classes . '"';
 }
Esempio n. 6
0
 /**
  * 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
  */
 public function declareParameters()
 {
     $this->name = new String('name');
     $this->name->setRequired();
     $this->addParameter($this->name);
     $this->status = new Boolean('status');
     $this->addParameter($this->status);
     $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);
 }
Esempio n. 7
0
 /**
  * Called after arguments have been parsed, parameters are set and validated.
  * 
  * Returns the output as raw HTML.
  * 
  * @return string raw HTML
  */
 public function getOutput()
 {
     $output = "<a class=\"FlattrButton\" style=\"display:none;\" href=\"{$this->url->getOutput()}\" title=\"{$this->title->getOutput()}\"";
     if ($this->uid->hasBeenSet()) {
         $output .= " data-flattr-uid=\"{$this->uid->getOutput()}\"";
     }
     if ($this->category->hasBeenSet()) {
         $output .= " data-flattr-category=\"{$this->category->getOutput()}\"";
     }
     if ($this->language->hasBeenSet()) {
         $output .= " data-flattr-language=\"{$this->language->getOutput()}\"";
     }
     if ($this->tags->hasBeenSet()) {
         $output .= " data-flattr-tags=\"{$this->tags->getOutput()}\"";
     }
     if ($this->compact->hasBeenSet()) {
         $output .= " data-flattr-button=\"compact\"";
     }
     if ($this->nopopout->hasBeenSet()) {
         $output .= " data-flattr-popout=\"0\"";
     }
     if ($this->hidden->hasBeenSet()) {
         $output .= " data-flattr-hidden=\"1\"";
     }
     $output .= ">";
     $output .= $this->description->getOutput();
     $output .= "</a>";
     $output .= "<script type=\"text/javascript\" src=\"http://api.flattr.com/js/0.6/load.js?mode=auto\"></script>";
     if ($this->left->hasBeenSet() || $this->right->hasBeenSet()) {
         $output = "<div class=\"{$this->getCSSClasses()}\">{$output}</div>";
     }
     return $output;
 }
Esempio n. 8
0
 protected function getOutput()
 {
     $source = $this->source->getParameter()->getName();
     // 'track' or 'album'
     $id = $this->source->getOutput();
     $lang = $this->lang->getOutput();
     $autoplay = $this->autoplay->getValue() ? 'playerautoplay=1&amp;' : '';
     return '
         <div class="' . $this->getCSSClasses() . '">
         <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" height="300" width="200" align="middle">
         <param name="allowScriptAccess" value="always">
         <param name="wmode" value="transparent">
         <param name="movie" value="http://widgets.jamendo.com/' . $lang . '/' . $source . '/?' . $source . '_id=' . $id . '&amp;' . $autoplay . 'playertype=2008">
         <param name="quality" value="high"><param name="bgcolor" value="#FFFFFF">
         <embed src="http://widgets.jamendo.com/' . $lang . '/' . $source . '/?' . $source . '_id=' . $id . '&amp;' . $autoplay . 'playertype=2008" quality="high" wmode="transparent" bgcolor="#FFFFFF" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" height="300" width="200" align="middle">
         </object>
         </div>';
 }
Esempio n. 9
0
 /**
  * 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);
 }
Esempio n. 10
0
 /**
  * Called after arguments have been parsed, parameters are set and validated.
  * 
  * Returns the output as raw HTML.
  * 
  * @return string raw HTML
  */
 protected function getOutput()
 {
     if ($this->target->getParameter()->getName() == 'url') {
         $content = $this->getOutputAsPlusOneButton();
     } elseif ($this->icon->getValue()) {
         $content = $this->getOutputAsIcon();
     } else {
         $content = $this->getOutputAsBadge();
     }
     return $this->wrapFloatDiv($content);
 }
Esempio n. 11
0
 /**
  * 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);
 }
Esempio n. 12
0
 protected function getOutput()
 {
     $this->setBlock(false);
     $email = $force_default = $a_open = $a_close = '';
     if (($source = $this->source->getValue()) instanceof \User) {
         // parameter 'user'
         $email = $source->getEmail();
         $a_open = '<a href="' . $source->getUserPage()->getFullURL() . '">';
         $a_close = '</a>';
     } elseif (is_string($source)) {
         // parameter 'email'
         $email = $source;
     } else {
         $force_default = '&f=y';
     }
     $email_md5 = md5(strtolower(trim($email)));
     $size = 's=' . $this->size->getOutput();
     // $rating = $this->rating->hasBeenSet() ? '&r='.$this->rating->getOutput() : '';
     $rating = '&r=g';
     // "suitable for display on all websites with any audience type."
     return $a_open . '<img class="' . $this->getCSSClasses() . '" src="http://www.gravatar.com/avatar/' . $email_md5 . '?' . $size . $rating . $force_default . '&d=mm" alt="" />' . $a_close;
 }
Esempio n. 13
0
 /**
  * Called after arguments have been parsed, parameters are set and validated.
  * 
  * Returns the output as raw HTML.
  * 
  * @return string raw HTML
  */
 protected function getOutput()
 {
     $type = $this->getType();
     if ($type == 'follow') {
         return $this->getFollowButton();
     } elseif ($type == 'search') {
         $search = "search: '" . $this->source->getOutput() . "',";
         // source = search
     } else {
         $search = "";
     }
     return "<div class=\"" . $this->getCSSClasses() . "\">\n                    <script\n                        charset=\"utf-8\"\n                        src=\"http://widgets.twimg.com/j/2/widget.js\">\n                    </script>\n                    <script>\n                        new TWTR.Widget({\n                          version: 2,\n                          type: '" . $type . "',\n                          rpp: '" . $this->count->getOutput() . "',\n                          " . $search . "\n                          interval: 6000,\n                          title: '" . $this->title->getOutput() . "',\n                          subject: '" . $this->subject->getOutput() . "',\n                          width: " . $this->width->getOutput() . ",\n                          height: " . $this->height->getOutput() . ",\n                          theme: {\n                            shell: {\n                              background: '#dad9d9',\n                              color: '#ffffff'\n                            },\n                            tweets: {\n                              background: '#fcfcfc',\n                              color: '#4d4e4f',\n                              links: '#e22c2e'\n                            }\n                          },\n                          features: {\n                            scrollbar: " . $this->scrollbar->getOutput() . ",\n                            loop: " . $this->loop->getOutput() . ",\n                            live: " . $this->live->getOutput() . ",\n                            behavior: '" . ($this->all->getValue() ? 'all' : 'default') . "',\n                          }\n                        })" . $this->getJSWidgetStartCall($type) . ";\n                    </script>\n                </div>";
 }
Esempio n. 14
0
 /**
  * 
  * @return string
  */
 public function getCSSClasses()
 {
     $classes = array();
     $classes[] = '500px';
     $classes[] = 'wfmk_block';
     $float = $this->float->getOutput();
     if ($float == 'right') {
         $classes[] = 'wfmk_right';
     } elseif ($float == 'left') {
         $classes[] = 'wfmk_left';
     }
     return Tools::ArrayToCSSClasses($classes);
 }
Esempio n. 15
0
 /**
  * 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);
 }
Esempio n. 16
0
 /**
  * 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->long = new Boolean('long');
     $this->addParameter($this->long);
     $this->big = new Boolean('big');
     $this->addParameter($this->big);
     $this->counter = new Boolean('counter');
     $this->addParameter($this->counter);
     $this->vertical = new Boolean('vertical');
     $this->addParameter($this->vertical);
     $this->url = new String('url');
     $this->url->setDefaultValue($this->parser->getTitle()->getCanonicalURL());
     $this->addParameter($this->url);
     $this->pubid = new String('pubid');
     $this->pubid->setDefaultValue('ra-4fdafa43072e511d');
     $this->pubid->setEscapeMode('urlpathinfo');
     $this->addParameter($this->pubid);
     $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);
 }
Esempio n. 17
0
 /**
  * Called after arguments have been parsed, parameters are set and validated.
  * 
  * Returns the output as raw HTML.
  * 
  * @return string raw HTML
  */
 protected function getOutput()
 {
     // source is required, at this point, we are sure that one of the subparameters has been set
     $source = $this->source->getParameter();
     $source_type = $source->getName() . 's';
     $source_id = $source->getOutput();
     return '<iframe
                 class="' . $this->getCSSClasses() . '"
                 width="' . $this->width->getOutput() . '"
                 height="' . $this->height->getOutput() . '"
                 scrolling="no"
                 frameborder="no"
                 src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2F' . $source_type . '%2F' . $source_id . '&amp;auto_play=' . $this->autoplay->getOutput() . '&amp;show_artwork=' . $this->artwork->getOutput() . '&amp;color=e22c2e&amp;show_comments=' . $this->comments->getOutput() . '&amp;show_playcount=' . $this->playcount->getOutput() . '&amp;liking=' . $this->like->getOutput() . '">
             </iframe>';
 }
Esempio n. 18
0
 /**
  * Called after arguments have been parsed, parameters are set and validated.
  * 
  * Returns the output as raw HTML.
  * 
  * @return string raw HTML
  */
 protected function getOutput()
 {
     $size = $this->size->getOutput();
     list($width, $height) = self::$SIZES[$size];
     $source = $this->source->getParameter();
     $source_type = $source->getName();
     $source_id = $source->getValue();
     $link_col = self::$LINK_COLOR;
     return '<iframe
         class="' . $this->getCSSClasses() . '"
         style="' . $this->getCSSStyle() . '"
         width="' . $width . '"
         height="' . $height . '"
         src="http://bandcamp.com/EmbeddedPlayer/v=2/' . $source_type . '=' . $source_id . '/size=' . $size . '/linkcol=' . $link_col . '/transparent"
         allowtransparency="true"
         frameborder="0"></iframe>';
 }
Esempio n. 19
0
 /**
  * Called after arguments have been parsed, parameters are set and validated.
  * 
  * Returns the output as raw HTML.
  * 
  * @return string raw HTML
  */
 protected function getOutput()
 {
     $show_name = $this->nolink->getValue() ? '' : 'show_name=1&';
     // seems to be useless
     $random_or_recent = $this->random->getValue() ? 'random' : 'latest';
     return '<!-- Start of Flickr Badge -->  
             <style type="text/css">' . $this->getCSS() . '</style>
             <div class="' . $this->getCSSClasses() . '" ' . $this->getWidthStyleOutput() . '>
                 ' . $this->getFlickrLinkOutput() . '
                 <div class="flickr_badge_container">
                     <script 
                         type="text/javascript" 
                         src="http://www.flickr.com/badge_code_v2.gne?' . $show_name . 'count=' . $this->count->getOutput() . '&display=' . $random_or_recent . '&size=' . $this->size->getOutput() . '&layout=x&' . $this->getSourceOutput() . '">
                     </script>
                     ' . $this->getPhotostreamOutput() . '
                 </div>
             </div>
             <!-- End of Flickr Badge -->';
 }