YaWK  24.1
Yet another WebKit
custom_html.php
Go to the documentation of this file.
1 <?php
3 {
4  /**
5  * @details<b>Embed a custom html code snippet.</b>
6  *
7  * <p>Sometimes you would like to embed (more or less) small piece of code in any position.
8  * This widget helps you to achieve this. You can enter any valid html code. Even if it is not
9  * recommended, you are able to add a piece of javascript here too. This Widget features the
10  * combination of summernote and codemirror to give you the best code editing experience.</p>
11  *
12  *
13  * @author Daniel Retzl <[email protected]>
14  * @copyright 2018 Daniel Retzl
15  * @version 1.0.0
16  * @brief Embed a html/javascript code snippet.
17  */
18  class customHtml
19  {
20  /** @param object global widget object data */
21  public $widget = '';
22  /** @param string Custom HTML Code */
23  public $customHtmlCode = '';
24 
25  /**
26  * @brief Load all widget settings from database and fill object
27  * @param object $db Database Object
28  * @brief Load all widget settings on object init.
29  */
30  public function __construct($db)
31  {
32  // load this widget settings from db
33  $this->widget = new \YAWK\widget();
35  foreach ($settings as $property => $value) {
36  $this->$property = $value;
37  }
38  }
39 
40  /**
41  * @brief Init and load custom html code
42  * @brief use this method to run the clock
43  */
44  public function init()
45  {
46  // check if customHtmlCode is set, not empty and a string
47  if (isset($this->customHtmlCode) && (!empty($this->customHtmlCode)
48  && (is_string($this->customHtmlCode))))
49  { // output custom html code
51  }
52  else
53  { // custom html code is not valid, leave empty
54  $this->customHtmlCode = '';
55  }
56  }
57  }
58 }
Embed a html/javascript code snippet.
Definition: custom_html.php:18
__construct($db)
Load all widget settings from database and fill object.
Definition: custom_html.php:29
init()
Init and load custom html code.
Definition: custom_html.php:43
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
if(isset($_POST['save'])) $settings
$value