YaWK  24.1
Yet another WebKit
spotify.php
Go to the documentation of this file.
1 <?php
3 {
4  /**
5  * @details<b>Empty spotify Widget - for development and demo purpose</b>
6  *
7  * <p>This widget is (nearly) empty. It can be used to understand the logic behind YaWK's
8  * widget system and/or is a great base to start and create your very own widget! Simply
9  * add the properties your application needs, add the database, build your own functions
10  * and your widget is ready to run the code as you need it.</p>
11  *
12  *
13  * @author Daniel Retzl <[email protected]>
14  * @copyright 2018 Daniel Retzl
15  * @version 1.0.0
16  * @brief spotify Widget (empty) for DEMO and development purpose!
17  */
18  class spotify extends \YAWK\widget
19  {
20  /** @param object global widget object data */
21  public $widget = '';
22  /** @param string Title that will be shown above widget */
23  public $spotifyHeading = '';
24  /** @param string Subtext will be displayed beside title */
25  public $spotifySubtext = '';
26  /* @param string Spotify embed code */
27  public $spotifyEmbedCode='';
28  /* @param string widget width */
29  public $spotifyWidth='';
30  /* @param string widget height */
31  public $spotifyHeight='';
32 
33  /**
34  * @brief Load all widget settings from database and fill object
35  * @param object $db Database Object
36  * @brief Load all widget settings on object init.
37  */
38  public function __construct($db)
39  {
40  // load this widget settings from db
41  $this->widget = new \YAWK\widget();
43  foreach ($settings as $property => $value) {
44  $this->$property = $value;
45  }
46  }
47 
48  /**
49  * @brief Init spotify widget
50  * @brief spotify Widget Init
51  */
52  public function init()
53  { // display heading
54  echo $this->getHeading($this->spotifyHeading, $this->spotifySubtext);
55  // switch plain youtube url to correct embed url string
56  $this->spotifyEmbedCode = str_replace("width=\"300\"","width=\"$this->spotifyWidth\"",$this->spotifyEmbedCode);
57  $this->spotifyEmbedCode = str_replace("height=\"380\"","height=\"$this->spotifyHeight\"",$this->spotifyEmbedCode);
59  }
60  }
61 }
62 ?>
spotify Widget (empty) for DEMO and development purpose!
Definition: spotify.php:18
__construct($db)
Load all widget settings from database and fill object.
Definition: spotify.php:37
init()
Init spotify widget.
Definition: spotify.php:51
Widgets are small, useful tools that you can include everywhere in your website.
Definition: widget.php:22
getWidgetSettingsArray($db)
Get widget settings and return it as array.
Definition: widget.php:69
getHeading($heading, $subtext)
Get widget heading and subtext, return headline.
Definition: widget.php:669
if(isset($_POST['save'])) $settings
$value