3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
22 const DEFAULT_VIEW
= 'profile';
30 public $substitutions;
36 public $gadgetContext;
38 public function __construct(GadgetSpec
$gadgetSpec, GadgetContext
$gadgetContext) {
39 $this->gadgetSpec
= $gadgetSpec;
40 $this->gadgetContext
= $gadgetContext;
43 public function getView($viewName) {
44 if (isset($this->gadgetSpec
->views
[$viewName])) {
45 return $this->gadgetSpec
->views
[$viewName];
46 } elseif (isset($this->gadgetSpec
->views
[self
::DEFAULT_VIEW
])) {
47 return $this->gadgetSpec
->views
[self
::DEFAULT_VIEW
];
49 // see if there's any empty entries, we'll use that as default then (old iGoogle style)
50 foreach ($this->gadgetSpec
->views
as $view) {
51 if (empty($view['view'])) {
56 throw new GadgetException("Invalid view specified for this gadget");
62 public function getAuthor() {
63 return $this->substitutions
->substitute($this->gadgetSpec
->author
);
69 public function getAuthorAboutme() {
70 return $this->substitutions
->substitute($this->gadgetSpec
->authorAboutme
);
76 public function getAuthorAffiliation() {
77 return $this->substitutions
->substitute($this->gadgetSpec
->authorAffiliation
);
83 public function getAuthorEmail() {
84 return $this->substitutions
->substitute($this->gadgetSpec
->authorEmail
);
90 public function getAuthorLink() {
91 return $this->substitutions
->substitute($this->gadgetSpec
->authorLink
);
97 public function getAuthorLocation() {
98 return $this->substitutions
->substitute($this->gadgetSpec
->authorLocation
);
104 public function getAuthorPhoto() {
105 return $this->substitutions
->substitute($this->gadgetSpec
->authorPhoto
);
111 public function getAuthorQuote() {
112 return $this->substitutions
->substitute($this->gadgetSpec
->authorQuote
);
118 public function getCategory() {
119 return $this->substitutions
->substitute($this->gadgetSpec
->category
);
125 public function getCategory2() {
126 return $this->substitutions
->substitute($this->gadgetSpec
->category2
);
132 public function getChecksum() {
133 return $this->gadgetSpec
->checksum
;
139 public function getDescription() {
140 return $this->substitutions
->substitute($this->gadgetSpec
->description
);
146 public function getDirectoryTitle() {
147 return $this->substitutions
->substitute($this->gadgetSpec
->directoryTitle
);
153 public function getHeight() {
154 return $this->substitutions
->substitute($this->gadgetSpec
->height
);
160 public function getIcon() {
161 return $this->substitutions
->substitute($this->gadgetSpec
->icon
);
167 public function getLinks() {
168 return $this->gadgetSpec
->links
;
174 public function getLocales() {
175 return $this->gadgetSpec
->locales
;
181 public function getOptionalFeatures() {
182 return $this->gadgetSpec
->optionalFeatures
;
188 public function getPreloads() {
189 return $this->gadgetSpec
->preloads
;
195 public function getRenderInline() {
196 return $this->substitutions
->substitute($this->gadgetSpec
->renderInline
);
202 public function getRequiredFeatures() {
203 return $this->substitutions
->substitute($this->gadgetSpec
->requiredFeatures
);
209 public function getScaling() {
210 return $this->substitutions
->substitute($this->gadgetSpec
->scaling
);
216 public function getScreenshot() {
217 return $this->substitutions
->substitute($this->gadgetSpec
->screenshot
);
223 public function getScrolling() {
224 return $this->substitutions
->substitute($this->gadgetSpec
->scrolling
);
230 public function getShowInDirectory() {
231 return $this->substitutions
->substitute($this->gadgetSpec
->showInDirectory
);
237 public function getShowStats() {
238 return $this->substitutions
->substitute($this->gadgetSpec
->showStats
);
244 public function getSingleton() {
245 return $this->substitutions
->substitute($this->gadgetSpec
->singleton
);
251 public function getString() {
252 return $this->substitutions
->substitute($this->gadgetSpec
->string);
258 public function getThumbnail() {
259 return $this->substitutions
->substitute($this->gadgetSpec
->thumbnail
);
265 public function getTitle() {
266 return $this->substitutions
->substitute($this->gadgetSpec
->title
);
272 public function getTitleUrl() {
273 return $this->substitutions
->substitute($this->gadgetSpec
->titleUrl
);
279 public function getUserPrefs() {
280 return $this->gadgetSpec
->userPrefs
;
286 public function getWidth() {
287 return $this->substitutions
->substitute($this->gadgetSpec
->width
);
291 * @param unknown_type $author
293 public function setAuthor($author) {
294 $this->gadgetSpec
->author
= $author;
298 * @param unknown_type $authorAboutme
300 public function setAuthorAboutme($authorAboutme) {
301 $this->gadgetSpec
->authorAboutme
= $authorAboutme;
305 * @param unknown_type $authorAffiliation
307 public function setAuthorAffiliation($authorAffiliation) {
308 $this->gadgetSpec
->authorAffiliation
= $authorAffiliation;
312 * @param unknown_type $authorEmail
314 public function setAuthorEmail($authorEmail) {
315 $this->gadgetSpec
->authorEmail
= $authorEmail;
319 * @param unknown_type $authorLink
321 public function setAuthorLink($authorLink) {
322 $this->gadgetSpec
->authorLink
= $authorLink;
326 * @param unknown_type $authorLocation
328 public function setAuthorLocation($authorLocation) {
329 $this->gadgetSpec
->authorLocation
= $authorLocation;
333 * @param unknown_type $authorPhoto
335 public function setAuthorPhoto($authorPhoto) {
336 $this->gadgetSpec
->authorPhoto
= $authorPhoto;
340 * @param unknown_type $authorQuote
342 public function setAuthorQuote($authorQuote) {
343 $this->gadgetSpec
->authorQuote
= $authorQuote;
347 * @param unknown_type $category
349 public function setCategory($category) {
350 $this->gadgetSpec
->category
= $category;
354 * @param unknown_type $category2
356 public function setCategory2($category2) {
357 $this->gadgetSpec
->category2
= $category2;
361 * @param unknown_type $checksum
363 public function setChecksum($checksum) {
364 $this->gadgetSpec
->checksum
= $checksum;
368 * @param unknown_type $description
370 public function setDescription($description) {
371 $this->gadgetSpec
->description
= $description;
375 * @param unknown_type $directoryTitle
377 public function setDirectoryTitle($directoryTitle) {
378 $this->gadgetSpec
->directoryTitle
= $directoryTitle;
382 * @param unknown_type $height
384 public function setHeight($height) {
385 $this->gadgetSpec
->height
= $height;
389 * @param unknown_type $icon
391 public function setIcon($icon) {
392 $this->gadgetSpec
->icon
= $icon;
396 * @param unknown_type $links
398 public function setLinks($links) {
399 $this->gadgetSpec
->links
= $links;
403 * @param unknown_type $locales
405 public function setLocales($locales) {
406 $this->gadgetSpec
->locales
= $locales;
410 * @param unknown_type $optionalFeatures
412 public function setOptionalFeatures($optionalFeatures) {
413 $this->gadgetSpec
->optionalFeatures
= $optionalFeatures;
417 * @param unknown_type $preloads
419 public function setPreloads($preloads) {
420 $this->gadgetSpec
->preloads
= $preloads;
424 * @param unknown_type $renderInline
426 public function setRenderInline($renderInline) {
427 $this->gadgetSpec
->renderInline
= $renderInline;
431 * @param unknown_type $requiredFeatures
433 public function setRequiredFeatures($requiredFeatures) {
434 $this->gadgetSpec
->requiredFeatures
= $requiredFeatures;
438 * @param unknown_type $scaling
440 public function setScaling($scaling) {
441 $this->gadgetSpec
->scaling
= $scaling;
445 * @param unknown_type $screenshot
447 public function setScreenshot($screenshot) {
448 $this->gadgetSpec
->screenshot
= $screenshot;
452 * @param unknown_type $scrolling
454 public function setScrolling($scrolling) {
455 $this->gadgetSpec
->scrolling
= $scrolling;
459 * @param unknown_type $showInDirectory
461 public function setShowInDirectory($showInDirectory) {
462 $this->gadgetSpec
->showInDirectory
= $showInDirectory;
466 * @param unknown_type $showStats
468 public function setShowStats($showStats) {
469 $this->gadgetSpec
->showStats
= $showStats;
473 * @param unknown_type $singleton
475 public function setSingleton($singleton) {
476 $this->gadgetSpec
->singleton
= $singleton;
480 * @param unknown_type $string
482 public function setString($string) {
483 $this->gadgetSpec
->string = $string;
487 * @param unknown_type $thumbnail
489 public function setThumbnail($thumbnail) {
490 $this->gadgetSpec
->thumbnail
= $thumbnail;
494 * @param unknown_type $title
496 public function setTitle($title) {
497 $this->gadgetSpec
->title
= $title;
501 * @param unknown_type $titleUrl
503 public function setTitleUrl($titleUrl) {
504 $this->gadgetSpec
->titleUrl
= $titleUrl;
508 * @param unknown_type $userPrefs
510 public function setUserPrefs($userPrefs) {
511 $this->gadgetSpec
->userPrefs
= $userPrefs;
515 * @param unknown_type $width
517 public function setWidth($width) {
518 $this->gadgetSpec
->width
= $width;