YaWK  24.1
Yet another WebKit
twitterTweetButton.php
Go to the documentation of this file.
1 <?php
3 {
4  /**
5  * @details<b>Twitter TweetButton Widget - embed Twitter TweetButton</b>
6  *
7  * <p>Embed Twitter TweetButton. All you need is the URL of your TweetButton
8  * and the amount of items you wish to embed. You will get
9  * the latest TweetButtons.</p>
10  *
11  *
12  * @author Daniel Retzl <[email protected]>
13  * @copyright 2018 Daniel Retzl
14  * @version 1.0.0
15  * @brief Embed Twitter TweetButton
16  */
17  class twitterTweetButton extends \YAWK\widget
18  {
19  /** @param object global widget object data */
20  public $widget = '';
21  /** @param string Title that will be shown above widget */
22  public $twitterTweetButtonHeading = '';
23  /** @param string Subtext will be displayed beside title */
24  public $twitterTweetButtonSubtext = '';
25  /** @param string Text */
26  public $twitterTweetButtonText = "";
27 
28  /**
29  * @brief Load all widget settings from database and fill object
30  * @param object $db Database Object
31  * @brief Load all widget settings on object init.
32  */
33  public function __construct($db)
34  {
35  // load this widget settings from db
36  $this->widget = new \YAWK\widget();
38  foreach ($settings as $property => $value) {
39  $this->$property = $value;
40  }
41  }
42 
43  /**
44  * @brief Init Twitter TweetButton Widget
45  * @brief Embed a single TweetButton from twitter
46  */
47  public function init()
48  { // display heading
49  echo $this->getHeading($this->twitterTweetButtonHeading, $this->twitterTweetButtonSubtext);
50  //
51  $this->twitterTweetButtonText = rawurldecode($this->twitterTweetButtonText);
52 
53  echo "<a class=\"twitter-share-button btn btn-info\"
54  href=\"https://twitter.com/intent/tweet?text=$this->twitterTweetButtonText\"
55  data-size=\"large\">Tweet about that</a>";
56  }
57  }
58 }
__construct($db)
Load all widget settings from database and fill object.
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