YaWK  24.1
Yet another WebKit
YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud Class Reference

Embed a SoundCloud audio player. More...

Public Member Functions

 __construct ($db)
 Load all widget settings from database and fill object. More...
 
 embedPlayer ()
 Embed SoundCloud Player. More...
 
 init ()
 Initialize: Set properties and embed SoundCloud player. More...
 
 printObject ()
 Print all object data. More...
 
 setProperties ()
 Prepare SoundCloud Player Properties. More...
 

Public Attributes

 $errorMsg = ''
 
 $headline = ''
 
 $soundcloudAutoplay = false
 
 $soundcloudHeight = '300'
 
 $soundcloudHideRelated = false
 
 $soundcloudShowComments = false
 
 $soundcloudShowReposts = false
 
 $soundcloudShowTeaser = false
 
 $soundcloudShowUser = false
 
 $soundcloudSubtext = ''
 
 $soundcloudTitle = ''
 
 $soundcloudUrl = ''
 
 $soundcloudVisual = false
 
 $soundcloudWidth = '100%'
 
 $widget = ''
 

Detailed Description

Embed a SoundCloud audio player.

Embed any soundcloud track or playlist.

If you want to embed a SoundCloud player on your website, this is the widget to do it. All you need is any public SoundCloud URL. The Widget comes with a few settings like: autoplay on or off, show comments, related music, and much more is customizable within the backend.

Author
Daniel Retzl danie.nosp@m.lret.nosp@m.zl@gm.nosp@m.ail..nosp@m.com
Version
1.0.0

Definition at line 16 of file soundcloud.php.

Constructor & Destructor Documentation

◆ __construct()

YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud::__construct (   $db)

Load all widget settings from database and fill object.

Parameters
object$dbDatabase Object

Load all widget settings on object init.

Definition at line 54 of file soundcloud.php.

56  {
57  // load this widget settings from db
58  $this->widget = new \YAWK\widget();
59  $settings = $this->widget->getWidgetSettingsArray($db);
60  foreach ($settings as $property => $value) {
61  $this->$property = $value;
62  }
if(isset($_POST['save'])) $settings
$value

References $db, $settings, $value, and YAWK\widget\getWidgetSettingsArray().

Member Function Documentation

◆ embedPlayer()

YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud::embedPlayer ( )

Embed SoundCloud Player.

Load SoundCloud Iframe

Definition at line 132 of file soundcloud.php.

134  {
135  // output headline
136  echo $this->headline;
137  // throw error (if one occurs)
138  echo $this->errorMsg;
139  // embed SoundCloud player
140  echo "<iframe
141  width=\"$this->soundcloudWidth\"
142  height=\"$this->soundcloudHeight\"
143  scrolling=\"no\"
144  frameborder=\"no\"
145  allow=\"autoplay\"
146  src=\"https://w.soundcloud.com/player/?url=https%3A//$this->soundcloudUrl&color=%23ff5500&auto_play=$this->soundcloudAutoplay&hide_related=$this->soundcloudHideRelated&show_comments=$this->soundcloudShowComments&show_user=$this->soundcloudShowUser&show_reposts=$this->soundcloudShowReposts&show_teaser=$this->soundcloudShowTeaser&visual=$this->soundcloudVisual\">
147  </iframe>";

References YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud\$errorMsg, and YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud\$headline.

Referenced by YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud\init().

◆ init()

YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud::init ( )

Initialize: Set properties and embed SoundCloud player.

use this method to run the clock

Definition at line 81 of file soundcloud.php.

83  {
84  // set object properties
85  $this->setProperties();
86  // $this->printObject();
87  // embed the SoundCloud Player
88  $this->embedPlayer();
setProperties()
Prepare SoundCloud Player Properties.
Definition: soundcloud.php:94
embedPlayer()
Embed SoundCloud Player.
Definition: soundcloud.php:132

References YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud\embedPlayer(), and YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud\setProperties().

◆ printObject()

YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud::printObject ( )

Print all object data.

(for development and testing purpose)

Definition at line 68 of file soundcloud.php.

70  {
71  // output all obj data
72  echo "<pre>";
73  print_r($this);
74  echo "</pre>";
75  exit;
exit

References exit.

◆ setProperties()

YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud::setProperties ( )

Prepare SoundCloud Player Properties.

Set Player Properties and HTML Markup Code

Definition at line 94 of file soundcloud.php.

96  {
97  // check if soundcloud URL is set, not empty and a valid type (string)
98  if (isset($this->soundcloudUrl) && (!empty($this->soundcloudUrl)
99  && (is_string($this->soundcloudUrl))))
100  { // select everything AFTER the soundcloud.com/ part
101  $this->soundcloudUrl = strstr($this->soundcloudUrl, 'soundcloud.com/');
102  }
103  else
104  { // throw error msg
105  $this->errorMsg = "Here should be a SoundCloud music player, but no SoundCloud URL was set.";
106  }
107 
108  // if a heading is set and not empty
109  if (isset($this->soundcloudTitle) && (!empty($this->soundcloudTitle)))
110  {
111  // if subtext is set, add <small> subtext to string
112  if (isset($this->soundcloudSubtext) && (!empty($this->soundcloudSubtext)))
113  { // build a headline with heading and subtext
114  $this->soundcloudSubtext = "<small>$this->soundcloudSubtext</small>";
115  $this->headline = "<h1>$this->soundcloudTitle&nbsp;" . "$this->soundcloudSubtext</h1>";
116  }
117  else
118  { // build just a headline - without subtext
119  $this->headline = "<h1>$this->soundcloudTitle</h1>"; // draw just the heading
120  }
121  }
122  else
123  { // leave empty if it's not set
124  $this->headline = '';
125  }
126 
c jPlayer errorMsg

References errorMsg.

Referenced by YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud\init().

Member Data Documentation

◆ $errorMsg

YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud::$errorMsg = ''
Parameters
stringStore an error msg, if one occurs

Definition at line 47 of file soundcloud.php.

Referenced by YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud\embedPlayer().

◆ $headline

YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud::$headline = ''
Parameters
stringHeadline HTML Markup

Definition at line 45 of file soundcloud.php.

Referenced by YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud\embedPlayer().

◆ $soundcloudAutoplay

YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud::$soundcloudAutoplay = false
Parameters
booltrue|false - Autoplay enabled?

Definition at line 27 of file soundcloud.php.

◆ $soundcloudHeight

YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud::$soundcloudHeight = '300'
Parameters
stringPlayer Height (300)

Definition at line 43 of file soundcloud.php.

◆ $soundcloudHideRelated

YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud::$soundcloudHideRelated = false
Parameters
booltrue|false - Hide related?

Definition at line 29 of file soundcloud.php.

◆ $soundcloudShowComments

YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud::$soundcloudShowComments = false
Parameters
booltrue|false - Show Comments?

Definition at line 31 of file soundcloud.php.

◆ $soundcloudShowReposts

YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud::$soundcloudShowReposts = false
Parameters
booltrue|false - Show Reposts?

Definition at line 35 of file soundcloud.php.

◆ $soundcloudShowTeaser

YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud::$soundcloudShowTeaser = false
Parameters
booltrue|false - Show Teaser?

Definition at line 37 of file soundcloud.php.

◆ $soundcloudShowUser

YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud::$soundcloudShowUser = false
Parameters
booltrue|false - Show User?

Definition at line 33 of file soundcloud.php.

◆ $soundcloudSubtext

YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud::$soundcloudSubtext = ''
Parameters
stringSubtext gets drawn as small tag beside the title

Definition at line 25 of file soundcloud.php.

◆ $soundcloudTitle

YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud::$soundcloudTitle = ''
Parameters
stringTitle above the player

Definition at line 23 of file soundcloud.php.

◆ $soundcloudUrl

YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud::$soundcloudUrl = ''
Parameters
stringThe URL of your soundcloud track or playlist

Definition at line 21 of file soundcloud.php.

◆ $soundcloudVisual

YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud::$soundcloudVisual = false
Parameters
booltrue|false - Visual?

Definition at line 39 of file soundcloud.php.

◆ $soundcloudWidth

YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud::$soundcloudWidth = '100%'
Parameters
stringPlayer Width (100%)

Definition at line 41 of file soundcloud.php.

◆ $widget

YAWK\WIDGETS\SOUNDCLOUD\PLAYER\soundcloud::$widget = ''
Parameters
objectglobal widget object data

Definition at line 19 of file soundcloud.php.


The documentation for this class was generated from the following file: