YaWK  24.1
Yet another WebKit
fb_like_page.php
Go to the documentation of this file.
1 <?php
3 {
4  /**
5  * @details<b>Facebook Like Page - embed a like my facebook page button</b>
6  *
7  * <p>If you want to bring attention to your facebook page, you might want to add
8  * a 'like my facebook page' button to your page. With this widget, you can do that
9  * very easily. You can configure some settings, like width, height, layout, and
10  * much more.</p>
11  *
12  *
13  * @author Daniel Retzl <[email protected]>
14  * @copyright 2018 Daniel Retzl
15  * @version 1.0.0
16  * @brief Facebook Like Page - embed like my facebook page
17  */
18  class fbLikePage extends \YAWK\widget
19  {
20  /** @param object global widget object data */
21  public $widget = '';
22  public $fbPageWidth = "450";
23  public $fbPageHeight = "265";
24  public $fbPageUrl = "http%3A%2F%2Fwww.facebook.com%2Fplatform";
25  public $fbPageAppID = "";
26  public $fbPageTabs = "timeline";
27  public $fbPageSmallHeader = "false";
28  public $fbPageAdaptContainerWidth = "true";
29  public $fbPageHideCover = "false";
30  public $fbShowFacepile = "true";
31  public $fbPageHeading = "";
32  public $fbPageSubtext = "";
33 
34  /**
35  * @brief Load all widget settings from database and fill object
36  * @param object $db Database Object
37  * @brief Load all widget settings on object init.
38  */
39  public function __construct($db)
40  {
41  // load this widget settings from db
42  $this->widget = new \YAWK\widget();
44  foreach ($settings as $property => $value) {
45  $this->$property = $value;
46  }
47  }
48 
49  /**
50  * @brief Init facebook like page
51  * @brief Facebook Like Page
52  */
53  public function init()
54  {
55  // embed heading
56  echo $this->getHeading($this->fbPageHeading, $this->fbPageSubtext);
57  // embed like Page
58  $this->embedLikePage();
59  }
60 
61  public function embedLikePage()
62  { // check if url is set
63  if (isset($this->fbPageUrl) && (!empty($this->fbPageUrl)))
64  { // encode url string
65  $this->fbPageUrl = rawurlencode($this->fbPageUrl);
66  }
67  // embed facebook like button
68  // REMEMBER: this could be blocked by AdBlock Browser Plugins
69  echo '<iframe src="https://www.facebook.com/plugins/page.php?href='.$this->fbPageUrl.'&tabs='.$this->fbPageTabs.'&width='.$this->fbPageWidth.'&height='.$this->fbPageHeight.'&small_header='.$this->fbPageSmallHeader.'&adapt_container_width='.$this->fbPageAdaptContainerWidth.'&hide_cover='.$this->fbPageHideCover.'&show_facepile='.$this->fbShowFacepile.'&appId='.$this->fbPageAppID.'" width="'.$this->fbPageWidth.'" height="'.$this->fbPageHeight.'" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true"></iframe>';
70  }
71  }
72 }
73 ?>
Facebook Like Page - embed like my facebook page.
__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