YaWK  24.1
Yet another WebKit
widget.php
Go to the documentation of this file.
1 <?php
2 namespace YAWK {
3  /**
4  * @details <b>Widgets are small, useful tools that you can include everywhere on your website.</b>
5  *
6  * YaWK comes with a lot of widgets for different purposes. As an example, you can add SocialMedia buttons, Facebook
7  * Boxes, Likebuttons or other things like a simple contant and many other small utilities for typical daily needs
8  * of nearly every web project. Check out the files in system/widgets to get a clue about how widget's file
9  * structure is organized. You miss a widget? Dont worry. It is easy to create your own - or copy and modify
10  * an existing one to make it fit your needs. If you want to get deeper into the widget system of YaWK, read
11  * the following docs.
12  * <p><i>Class covers both, backend & frontend functionality.
13  * See Methods Summary for Details!</i></p>
14  *
15  * @author Daniel Retzl <[email protected]>
16  * @copyright 2009-2016 Daniel Retzl
17  * @license https://opensource.org/licenses/MIT
18  * @version 1.0.0
19  * @brief Widgets are small, useful tools that you can include everywhere in your website.
20  */
21  class widget
22  {
23  /** * @param int 0|1 published or not */
24  public $published;
25  /** * @param int widget ID */
26  public $id;
27  /** * @param string widget name */
28  public $name;
29  /** * @param int order sortation number */
30  public $sort;
31  /** * @param string template position to appear */
32  public $position;
33  /** * @param int widget type number */
34  public $widgetType;
35  /** * @param int margin from top in px */
36  public $marginTop;
37  /** * @param int margin from bottom in px */
38  public $marginBottom;
39  /** * @param int ID of the page where this widget should appear */
40  public $pageID;
41  /** * @param string date when widget publishing starts */
42  public $date_publish;
43  /** * @param string date when widget publishing ends */
45  /** * @param string title to identify the widget */
46  public $widgetTitle;
47  /** * @param string foldername of this widget */
48  public $folder;
49  /** * @param array widget settings data array placeholder */
50  public $data;
51 
52 
53  /**
54  * @brief Print all object data
55  * @details (for development and testing purpose)
56  */
57  public function printObject()
58  { // output data to screen
59  echo "<pre>";
60  print_r($this);
61  echo "</pre>";
62  }
63 
64  /**
65  * @brief Get widget settings and return it as array
66  * @param object $db database
67  * @return array|bool returns array with widget settings or null
68  */
69  public function getWidgetSettingsArray($db)
70  {
71  // $_GET['widgetID'] will be generated in \YAWK\widget\loadWidgets($db, $position)
72  if (isset($_GET['widgetID']))
73  {
74  // widget ID
75  $this->id = $_GET['widgetID'];
76  // data array
77  $this->data = array();
78 
79  // get widget settings from db
80  $res = $db->query("SELECT property, value FROM {widget_settings}
81  WHERE widgetID = '".$this->id."'
82  AND activated = '1'");
83  // get data in loop
84  while($row = mysqli_fetch_assoc($res))
85  { // set widget properties and values into this data array
86  $this->data[$row['property']] = $row['value'];
87  } // end while fetch row (fetch widget settings)
88 
89  // check if data array is set
90  if (is_array($this->data))
91  { // ok, return widget settings array
92  return ($this->data);
93  }
94  else
95  { // widget settings could not be retrieved
96  echo "Error: this data object is empty - unable to load widget settings of widget ID: ".$this->id."";
97  echo "<pre>";
98  print_r($this);
99  echo "</pre>";
100  }
101  }
102  else
103  { // no widget ID requested - do nothing.
104  return null;
105  }
106  return null;
107  }
108 
109 
110  /**
111  * @brief return current widget path
112  * @param object $db database
113  * @return string full path to widgets folder
114  */
115  static function getCurrentWidgetPath($db)
116  {
117  return "" . \YAWK\sys::getDirPrefix($db) . "/system/widgets/";
118  }
119 
120 
121  /**
122  * @brief Returns an array with all widget settings data.
123  * @param object $db Database Object
124  * @return array|bool
125  * @details TODO: IMPLEMENT GET WIDGET SETTINGS ARRRAY for issue #61
126  */
127  public static function getAllSettingsIntoArray($db, $widgetID) // get all settings from db like property
128  {
129  /* @param $db \YAWK\db */
130  if ($res = $db->query("SELECT * FROM {widget_settings} WHERE widgetID = '".$widgetID."' ORDER by sortation"))
131  {
132  $settingsArray = array();
133  while ($row = $res->fetch_assoc())
134  { // fill array
135  $settingsArray[] = $row;
136  }
137  }
138  else
139  { // q failed, throw error
140  \YAWK\sys::setSyslog($db, 39, 1, "failed to get widget settings array of widget ID $widgetID", 0, 0, 0, 0);
141  // \YAWK\alert::draw("warning", "Warning!", "Fetch database error: getSettingsArray failed.","","4800");
142  return false;
143  }
144  return $settingsArray;
145  }
146 
147  /**
148  * @brief Return settings as form elements corresponding to given widget ID.
149  * @param object $db Database Object
150  * @param array $settings Settings: property|value|type|sortation|activated|label|icon|heading|subtext|fieldClass|fieldType|placeholder|description|options
151  * @param int $widgetID
152  */
153  public static function getWidgetFormElements($db, $settings, $widgetID, $widgetFolder, $lang)
154  { // loop trough array
155  $i_settings = 0;
156 
157  if(!isset($widgetID) && (empty($widgetID)))
158  { // if param 'type' is missing, show all settings
159  die ("Could not get widget settings because widget ID is missing.");
160  }
161 
162  if(!isset($settings) || (empty($settings)) || (!is_array($settings)))
163  { // if settings are not set, try to get them...
165  }
166 
167  // check if language is set
168  if (!isset($language) || (!isset($lang)))
169  {
170  // check widget contains language files
171  if (is_dir('../system/widgets/'.$widgetFolder.'/language/'))
172  { // inject (add) language tags to core $lang array
173  $lang = \YAWK\language::inject($lang, "../system/widgets/$widgetFolder/language/");
174  }
175  }
176 
177  foreach ($settings as $type => $setting)
178  { // field type not set or empty
179  if (!isset($setting['fieldType']) || (empty($setting['fieldType'])))
180  { // set input field as common default
181  $setting['fieldType'] = "input";
182  } // settings type must be equal to param $type
183  // equals settings category
184  if ($setting['widgetID'] === "$widgetID" && ($setting['activated'] === "1"))
185  {
186  // check if ICON is set
187  // if an icon is set, it will be drawn before the heading, to the left.
188  if (isset($setting['icon']) && (!empty($setting['icon'])))
189  { // fill it w icon
190  $setting['icon'] = "<i class=\"$setting[icon]\"></i>";
191  }
192  else
193  { // leave empty - no icon available
194  $setting['icon'] = '';
195  }
196 
197  // check if LABEL is set
198  // The label sits directly above, relative to the setting form element
199  if (isset($setting['label']) && (!empty($setting['label'])))
200  { // if its set, put it into $lang array for L11n
201  $setting['label'] = $lang[$setting['label']];
202  }
203  else
204  { // otherwise throw error
205  $setting['label'] = "$setting[property]";
206  }
207 
208  // check if HEADING is set
209  // if set, a <H3>Heading</H3> will be shown above the setting
210  if (isset($setting['heading']) && (!empty($setting['heading'])))
211  { // L11n
212  $setting['heading'] = $lang[$setting['heading']];
213  }
214  else
215  { // leave empty - no heading for that setting
216  $setting['heading'] = '';
217  }
218 
219  // check if SUBTEXT is set
220  // this is shown in <small>tags</small> beneath the heading
221  if (isset($setting['subtext']) && (!empty($setting['subtext'])))
222  { // L11n
223  $setting['subtext'] = $lang[$setting['subtext']];
224  }
225  else
226  { // leave empty - no subtext beneath the heading
227  $setting['subtext'] = '';
228  }
229 
230  // check if description is set
231  // the description will be shown right beside the label
232  if (isset($setting['description']) && (!empty($setting['description'])))
233  { // L11n
234  $setting['description'] = $lang[$setting['description']];
235  $setting['description'] = "&nbsp;<small><i class=\"fa fa-question-circle-o text-info\" data-placement=\"auto right\" data-toggle=\"tooltip\" title=\"$setting[description]\"></i></small>";
236  }
237 
238  // CHECKBOX
239  if ($setting['fieldType'] === "checkbox")
240  { // build a checkbox
241  if ($setting['value'] === "1" or ($setting['value'] === "true"))
242  { // set checkbox to checked
243  $checked = "checked";
244  }
245  else
246  { // checkbox not checked
247  $checked = "";
248  }
249  if (!empty($setting['icon']) || (!empty($setting['heading']) || (!empty($setting['subtext']))))
250  {
251  echo "<h3>$setting[icon]&nbsp;$setting[heading]&nbsp;<small>$setting[subtext]</small></h3>";
252  }
253  echo "<input type=\"hidden\" name=\"$setting[property]\" value=\"0\">
254  <input type=\"checkbox\" id=\"$setting[property]\" name=\"$setting[property]\" value=\"1\" $checked>
255  <label for=\"$setting[property]\">&nbsp; $setting[label]&nbsp;$setting[description]</label><br>";
256  }
257 
258  /* RADIO BUTTTONS */
259  if ($setting['fieldType'] === "radio")
260  {
261  echo "<label for=\"$setting[property]\">$setting[label]&nbsp;$setting[description]</label>
262  <input type=\"radio\" id=\"$setting[property]\" name=\"$setting[property]\">";
263  echo "<input type=\"radio\" value=\"$setting[value]\">$lang[SETTING_CURRENT] $setting[value]</option>";
264  // explode option string into array
265  $optionValues = explode(":", $setting['options']);
266  foreach ($optionValues as $value)
267  {
268  // extract value from option setting string
269  $optionValue = preg_replace("/,[a-zA-Z0-9]*/", "", $value);
270  // extract description from option setting
271  $optionDesc = preg_replace('/.*,(.*)/','$1',$value);
272 
273  echo "<option value=\"$optionValue\">$optionDesc</option>";
274  }
275  echo "</select>";
276  }
277 
278  /* SELECT FIELD */
279  if ($setting['fieldType'] === "select")
280  { // display icon, heading and subtext, if its set
281  if (!empty($setting['icon']) || (!empty($setting['heading']) || (!empty($setting['subtext']))))
282  {
283  echo "<h3>$setting[icon]&nbsp;$setting[heading]&nbsp;<small>$setting[subtext]</small></h3>";
284  }
285  // begin draw select
286  echo "<label for=\"$setting[property]\">$setting[label]&nbsp;$setting[description]</label>
287  <select class=\"form-control\" id=\"$setting[property]\" name=\"$setting[property]\">";
288  echo "<option value=\"$setting[value]\">$lang[SETTING_CURRENT] $setting[value]</option>";
289  // explode option string into array
290  $optionValues = explode(":", $setting['options']);
291  foreach ($optionValues as $value)
292  {
293  // extract description from option setting
294  $optionDesc = preg_replace('/.*,(.*)/','$1', $value);
295  // extract value from option setting string
296  $optionValue = preg_split("/,[a-zA-Z0-9]*/", $value);
297 
298  echo "<option value=\"$optionValue[0]\">$optionDesc</option>";
299  }
300  echo "</select>";
301  }
302 
303  /* TEXTAREA */
304  if ($setting['fieldType'] === "textarea")
305  { // if a long value is set
306  if (!empty($setting['icon']) || (!empty($setting['heading']) || (!empty($setting['subtext']))))
307  {
308  echo "<h3>$setting[icon]&nbsp;$setting[heading]&nbsp;$setting[subtext]</h3>";
309  }
310  $placeholder = $setting['placeholder']; // store placeholder from array in var to use it at language array
311  if (isset($setting['longValue']) && (!empty($setting['longValue'])))
312  { // build a longValue tagged textarea and fill with longValue
313  $setting['longValue'] = nl2br($setting['longValue']);
314  echo "<label for=\"$setting[property]-long\">$setting[label]&nbsp;$setting[description]</label>
315  <textarea cols=\"64\" rows=\"10\" placeholder=\"$lang[$placeholder]\" class=\"$setting[fieldClass]\" id=\"$setting[property]-long\" name=\"$setting[property]-long\">$setting[longValue]</textarea>";
316  }
317  else
318  { // draw default textarea
319  $placeholder = $setting['placeholder']; // store placeholder from array in var to use it at language array
320  $setting['value'] = nl2br($setting['value']);
321  echo "<label for=\"$setting[property]\">$setting[label]&nbsp;$setting[description]</label>
322  <textarea cols=\"64\" rows=\"10\" placeholder=\"$lang[$placeholder]\" class=\"$setting[fieldClass]\" id=\"$setting[property]\" name=\"$setting[property]\">$setting[value]</textarea>";
323  }
324  }
325 
326  /* INPUT PASSWORD FIELD */
327  if ($setting['fieldType'] === "password")
328  { // draw an input field
329  $placeholder = $setting['placeholder']; // store placeholder from array in var to use it at language array
330  if (!empty($setting['icon']) || (!empty($setting['heading']) || (!empty($setting['subtext']))))
331  {
332  echo "<h3>$setting[icon]&nbsp;$setting[heading]&nbsp;<small>$setting[subtext]</small></h3>";
333  }
334  echo "<label for=\"$setting[property]\">$setting[label]&nbsp;$setting[description]</label>
335  <input type=\"password\" class=\"$setting[fieldClass]\" id=\"$setting[property]\" name=\"$setting[property]\"
336  value=\"$setting[value]\" placeholder=\"$lang[$placeholder]\"><p>$setting[description]</p>";
337  }
338 
339  /* INPUT TEXT FIELD */
340  if ($setting['fieldType'] === "input")
341  { // draw an input field
342  $placeholder = $setting['placeholder']; // store placeholder from array in var to use it at language array
343  // check if placeholder is set in language array
344  if (isset($lang[$placeholder]))
345  { // if so, set placeholder
346  $placeholder = $lang[$placeholder];
347  }
348  else
349  { // leave empty if placeholder does not exist in language array
350  $placeholder = '';
351  }
352  // set icon, heading and subtext markup
353  if (!empty($setting['icon']) || (!empty($setting['heading']) || (!empty($setting['subtext']))))
354  {
355  echo "<h3>$setting[icon]&nbsp;$setting[heading]&nbsp;<small>$setting[subtext]</small></h3>";
356  }
357  // output input text field
358  echo "<label for=\"$setting[property]\">$setting[label]&nbsp;$setting[description]</label>
359  <input type=\"text\" class=\"$setting[fieldClass]\" id=\"$setting[property]\"
360  name=\"$setting[property]\" value=\"$setting[value]\" placeholder=\"$placeholder\">";
361  }
362 
363  /* COLORPICKER TEXT FIELD */
364  if ($setting['fieldType'] === "color")
365  { // draw an input field
366  $placeholder = $setting['placeholder']; // store placeholder from array in var to use it at language array
367  if (!empty($setting['icon']) || (!empty($setting['heading']) || (!empty($setting['subtext']))))
368  {
369  echo "<h3>$setting[icon]&nbsp;$setting[heading]&nbsp;$setting[subtext]</h3>";
370  }
371  echo "<label for=\"$setting[property]\">$setting[label] $setting[description]</label>
372  <input type=\"text\" class=\"form-control $setting[fieldType]\" id=\"$setting[property]\" name=\"$setting[property]\"
373  value=\"$setting[value]\" placeholder=\"$lang[$placeholder]\">";
374  }
375 
376  /* CODE EDITOR TEXTAREA */
377  if ($setting['fieldType'] === "editor")
378  {
379  require_once ('editor.php');
383 
384  if (!empty($setting['icon']) || (!empty($setting['heading']) || (!empty($setting['subtext']))))
385  {
386  echo "<h3>$setting[icon]&nbsp;$setting[heading]&nbsp;$setting[subtext]</h3>";
387  }
388 
389  if (isset($setting['longValue']) && (!empty($setting['longValue'])))
390  { // build a longValue tagged textarea and fill with longValue
391  echo "<label for=\"$setting[property]-long\">$setting[label]&nbsp;$setting[description]</label>
392  <textarea cols=\"64\" rows=\"10\" class=\"$setting[fieldClass]\" id=\"$setting[property]-long\" name=\"$setting[property]-long\">$setting[longValue]</textarea>";
393  }
394  else
395  { // draw default textarea
396  echo "<label for=\"$setting[property]\">$setting[label]&nbsp;$setting[description]</label>
397  <textarea cols=\"64\" rows=\"10\" class=\"$setting[fieldClass]\" id=\"$setting[property]\" name=\"$setting[property]\">$setting[value]</textarea>";
398  }
399  }
400  /* SELECT FIELD */
401  /* SUBMENU SELECTOR */
402  /** @var $db \YAWK\db */
403  if ($setting['fieldType'] === "submenuSelector"){
404  // display icon, heading and subtext, if its set
405  if (!empty($setting['icon']) || (!empty($setting['heading']) || (!empty($setting['subtext']))))
406  { // output heading
407  echo "<h3>$setting[icon]&nbsp;$setting[heading]&nbsp;<small>$setting[subtext]</small></h3>";
408  }
409  // begin draw select
410  echo "<label for=\"$setting[property]\">$setting[label]&nbsp;$setting[description]</label>
411  <select class=\"$setting[fieldClass]\" id=\"$setting[property]\" name=\"$setting[property]\">";
412  // get all submenus
413  $res = $db->query("SELECT * FROM {menu_names} ORDER BY name ASC");
414  // check if submenus exist
415  if ($res)
416  { // submenus found, draw select
417  while ($row = mysqli_fetch_array($res))
418  { // draw select
419  echo "<option value=\"$row[id]\" ";
420  if ($setting['value'] === $row['id'])
421  { // set selected
422  echo "selected";
423  }
424  echo ">$row[name]</option>";
425  }
426  }
427  else
428  { // no menus found
429  echo "<option value=\"0\">$lang[NONE_SELECTED]</option>";
430  }
431  // close select
432  echo "</select>";
433 
434  }
435 
436  /* SELECT FIELD */
437  /* GALLERY SELECTOR */
438  /** @var $db \YAWK\db */
439  if ($setting['fieldType'] === "selectGallery")
440  {
441  // set required assets
442  $requiredAssets = array('Lightbox 2 JS' => 'js', 'Lightbox 2 CSS' => 'css');
443  // check if they are active in current template, if not, set them
444  \YAWK\sys::checkIfAssetsAreLoaded($db, $requiredAssets, true);
445 
446  // display icon, heading and subtext, if its set
447  if (!empty($setting['icon']) || (!empty($setting['heading']) || (!empty($setting['subtext']))))
448  { // output heading
449  echo "<h3>$setting[icon]&nbsp;$setting[heading]&nbsp;<small>$setting[subtext]</small></h3>";
450  }
451  // begin draw select
452  echo "<label for=\"$setting[property]\">$setting[label]&nbsp;$setting[description]</label>
453  <select class=\"form-control\" id=\"$setting[property]\" name=\"$setting[property]\">";
454  echo "<option value=\"$setting[value]\">$lang[SETTING_CURRENT] $setting[value]</option>";
455 
456  // select galleries from database
457  if ($res = $db->query("SELECT id, title FROM {plugin_gallery}"))
458  { // fetch data
459  while ($row = mysqli_fetch_array($res))
460  { // set current default value
461  if ($setting['value'] === $row[0])
462  { // selected default value
463  $selected = "selected";
464  }
465  else
466  { // option not selected
467  $selected = '';
468  }
469  // draw option
470  echo "<option value=\"$row[0]\"$selected>$row[1]</option>";
471  }
472  echo "<option value=\"\">$lang[NONE_SELECTED]</option>";
473  }
474  echo "</select>";
475  }
476 
477 
478  /* FACEBOOK SELECT FIELD */
479  if ($setting['fieldType'] === "fbGallerySelect")
480  { // display icon, heading and subtext, if its set
481  if (!empty($setting['icon']) || (!empty($setting['heading']) || (!empty($setting['subtext']))))
482  {
483  echo "<h3>$setting[icon]&nbsp;$setting[heading]&nbsp;<small>$setting[subtext]</small></h3>";
484  }
485  // IMPORT FACEBOOK DATA, depending on APP ID and TOKEN
486  // get APP ID from settings array
487  $appId = $settings[0]['value'];
488  // get TOKEN from settings array
489  $token = $settings[1]['value'];
490  if (isset($appId) && (is_string($appId) && (!empty($appId)
491  && (isset($token) && (is_string($token) && (!empty($token)))))))
492  {
493  // facebook data is set - try to get album list
494  // prepare API call - get albums for this app id and token
495  $json_link = "https://graph.facebook.com/v3.3/me/albums?access_token={$token}";
496 
497  // get json string
498  // $json = file_get_contents($json_link);
499 
500  // use curl to get json string / apiObject
501  $curl = curl_init();
502  curl_setopt($curl, CURLOPT_URL, $json_link);
503  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
504  $apiObject = json_decode(curl_exec($curl), true, 512, JSON_BIGINT_AS_STRING);
505  curl_close($curl);
506 
507  // convert json to object
508  // $apiObject = json_decode($json, true, 512, JSON_BIGINT_AS_STRING);
509 
510  // stores all the field html markup
511  $fbGallerySelectMarkup = '';
512  // check if api object is set
513  if (isset($apiObject) && (is_array($apiObject['data']) && (!empty($apiObject['data']))))
514  {
515  // build the select field
516  $fbGallerySelectMarkup = "<label for=\"$setting[property]\">$setting[label]&nbsp;$setting[description]</label>";
517  $fbGallerySelectMarkup .= "<select class=\"form-control\" id=\"$setting[property]\" name=\"$setting[property]\">";
518 
519  // walk trough data array
520  foreach ($apiObject['data'] as $data => $field)
521  { // and add select options
522  if ($field['id'] == $settings[2]['value'])
523  {
524  $selected = " selected";
525  }
526  else { $selected = ''; }
527 
528  $fbGallerySelectMarkup .= "<option value=\"$field[id]\"$selected>$field[name]</option>";
529  }
530  // close select field
531  $fbGallerySelectMarkup .= "</select>";
532  }
533  else
534  { // could not determine facebook albums, let user enter the album ID manually
535  $fbGallerySelectMarkup = "<label for=\"$setting[property]\">$setting[label]&nbsp;$setting[description]</label>";
536  $fbGallerySelectMarkup .= "<input type=\"text\" class=\"form-control\" placeholder=\"$lang[PH_FB_GALLERY_ALBUMID]\" name=\"$setting[property]\" value=\"$setting[value]\">";
537  }
538  }
539  else
540  { // if appID and/or token are not set correctly,
541  // draw a simple input field where the album id can be entered manually
542  $fbGallerySelectMarkup = "<label for=\"$setting[property]\">$setting[label]&nbsp;$setting[description]</label>";
543  $fbGallerySelectMarkup .= "<input type=\"text\" class=\"form-control\" placeholder=\"$lang[PH_FB_GALLERY_ALBUMID]\" name=\"$setting[property]\" value=\"$setting[value]\">";
544  }
545 
546  // output select field / input field depending on code above
547  echo $fbGallerySelectMarkup;
548  }
549  }
550  }
551  }
552 
553 
554  /**
555  * @brief create new widget
556  * @param object $db database
557  * @param int $widgetType widget type
558  * @param int $pageID page ID
559  * @param string $positions widget / template positions
560  * @return bool
561  */
562  static function create($db, $widgetType, $pageID, $positions)
563  {
564  /** @var $db \YAWK\db */
565  global $status;
566  if ($res_widgets = $db->query("SELECT MAX(id), MAX(sort) FROM {widgets}")) {
567  // generate ID
568  if ($row = mysqli_fetch_row($res_widgets))
569  {
570  $id = $row[0] + 1;
571  $sort = $row[1] + 1;
572  $published = 1;
573  }
574  else
575  {
576  // could not get MAX id
577  \YAWK\sys::setSyslog($db, 39, 1, "could not get max ID.", 0, 0, 0, 0);
578  return false;
579  }
580 
581  // add new widget to db
582  if ($res_widgets = $db->query("INSERT INTO {widgets}
583  (id, published, widgetType, pageID, sort, position)
584  VALUES('" . $id . "',
585  '" . $published . "',
586  '" . $widgetType . "',
587  '" . $pageID . "',
588  '" . $sort . "',
589  '" . $positions . "')"))
590  {
591  // get default settings for this widget
592  if ($res_defaults = $db->query("SELECT * FROM {widget_defaults}
593  WHERE widgetType = '" . $widgetType . "'
594  AND activated = '1'"))
595  { // get widget settings
596  while ($row = mysqli_fetch_assoc($res_defaults))
597  { // widget properties
598  $w_property = $row['property'];
599  $w_value = $row['value'];
600  $w_widgetType = $row['widgetType'];
601  $w_activated = $row['activated'];
602  $w_sortation = $row['sortation'];
603  $w_label = $row['label'];
604  $w_icon = $row['icon'];
605  $w_heading = $row['heading'];
606  $w_subtext = $row['subtext'];
607  $w_fieldClass = $row['fieldClass'];
608  $w_fieldType = $row['fieldType'];
609  $w_placeholder = $row['placeholder'];
610  $w_options = $row['options'];
611  $w_description = $row['description'];
612 
613  // insert widget settings
614  if ($db->query("INSERT INTO {widget_settings}
615  (widgetID, property, value, widgetType, activated, sortation, label, icon, heading, subtext, fieldClass, fieldType, placeholder, options, description)
616  VALUES('" . $id . "',
617  '" . $w_property . "',
618  '" . $w_value . "',
619  '" . $w_widgetType . "',
620  '" . $w_activated . "',
621  '" . $w_sortation . "',
622  '" . $w_label . "',
623  '" . $w_icon . "',
624  '" . $w_heading . "',
625  '" . $w_subtext . "',
626  '" . $w_fieldClass . "',
627  '" . $w_fieldType . "',
628  '" . $w_placeholder . "',
629  '" . $w_options . "',
630  '" . $w_description . "')"))
631  {
632  // widget settings added
633  }
634  else
635  { // insert widget settings failed
636  \YAWK\sys::setSyslog($db, 39, 1, "failed to insert settings of widget :$id property:$w_property value: $w_value type: $w_widgetType active: $w_activated", 0, 0, 0, 0);
637  return false;
638  }
639  } // ./ while
640  }
641  else
642  { // could not get widget defaults
643  \YAWK\sys::setSyslog($db, 39, 1, "failed to set widget defaults of widget ID <b>$id</b>.", 0, 0, 0, 0);
644  return false;
645  }
646  }
647  else
648  { // could not add new widget
649  \YAWK\sys::setSyslog($db, 39, 1, "failed to add new widget", 0, 0, 0, 0);
650  return false;
651  }
652  }
653  else
654  { // could not get maxID
655  \YAWK\sys::setSyslog($db, 39, 1, "failed to get MAX(id) of widgets db", 0, 0, 0, 0);
656  return false;
657  }
658  // something else has happened
659  // \YAWK\sys::setSyslog($db, 11, "return $id in case of widget create.", 0, 0, 0, 0);
660  return $id;
661  }
662 
663  /**
664  * @brief Get widget heading and subtext, return headline
665  * @param string $heading The Heading
666  * @param string $subtext The Subtext
667  * @return string|bool return the correct headline
668  */
669  public function getHeading($heading, $subtext)
670  {
671  // if a heading is set and not empty
672  if (isset($heading) && (!empty($heading)))
673  {
674  // if subtext is set, add <small> subtext to string
675  if (isset($subtext) && (!empty($subtext)))
676  { // build a headline with heading and subtext
677  $subtext = "<small>$subtext</small>";
678  return "<h2>$heading&nbsp;" . "$subtext</h2>";
679  }
680  else
681  { // build just a headline - without subtext
682  return "<h2>$heading</h2>"; // draw just the heading
683  }
684  }
685  else
686  { // leave empty if it's not set
687  return null;
688  }
689  }
690 
691 
692  /**
693  * @brief load a widget into given position
694  * @param object $db database
695  * @param string $position template position where widget should appear
696  * @return null|bool include widget and return null or false
697  */
698  static function loadWidgets($db, $position)
699  {
700  // current date + time
701  $atm = date("Y-m-d G:i:s");
702 
703  /** @var $db \YAWK\db */
704  global $currentpage;
705  if ($res = $db->query("SELECT cw.id,cw.published,cw.widgetType,cw.pageID,cw.sort,cw.position, cw.date_publish, cw.date_unpublish, cwt.name, cwt.folder
706  FROM {widgets} as cw
707  JOIN {widget_types} as cwt on cw.widgetType = cwt.id
708  WHERE (cw.pageID = '" . $currentpage->id . "' OR cw.pageID = '0')
709  AND cw.position = '" . $position . "' AND published = '1'
710  ORDER BY cw.sort"))
711  { // fetch widget data
712  while ($row = mysqli_fetch_assoc($res))
713  {
714  $_GET['widgetID'] = $row['id'];
715 
716  // check publish date and show entry
717  if ($atm > $row['date_publish'] || ($row['date_publish'] === NULL) || (empty($row['date_publish'])))
718  {
719  // if current date is bigger than unpublish date
720  if ($atm < $row['date_unpublish'] || ($row['date_unpublish'] === NULL) || (empty($row['date_unpublish'])))
721  {
722  $widgetFile = "system/widgets/".$row['folder']."/".$row['folder'].".php";
723  include $widgetFile;
724  }
725  }
726  else
727  { //
728  return null;
729  }
730  }
731  }
732  else
733  {
734  \YAWK\sys::setSyslog($db, 39, 1, "failed to get widgets of position <b>$position</b>", 0, 0, 0, 0);
735  return false;
736  }
737  return null;
738  }
739 
740  /**
741  * @brief return widget ID
742  * @param object $db database
743  * @param int $id the ID
744  * @return array | bool
745  */
746  static function getWidgetId($db, $id)
747  {
748  /** @var $db \YAWK\db */
749  if ($res = $db->query("SELECT cp.id
750  FROM {pages} as cp
751  JOIN {widgets} as cw on cp.id = cw.pageID
752  WHERE cw.id = $id"))
753  { // fetch data
754  while ($row = mysqli_fetch_row($res))
755  { // return ID
756  if (isset($row[0]))
757  {
758  return $row[0];
759  }
760  else {
761  return false;
762  }
763  }
764  }
765  else
766  { // q failed
767  \YAWK\sys::setSyslog($db, 39, 1, "failed to get widget ID <b>$id</b>", 0, 0, 0, 0);
768  return false;
769  }
770  // something else has happened
771  return false;
772  }
773 
774  /**
775  * @brief get widget title and page ID and output select option
776  * @param object $db database
777  * @param int $id affected widget ID
778  * @return string|bool
779  */
780  static function getWidget($db, $id)
781  {
782  /** @var $db \YAWK\db */
783  global $allpagescode;
784  if ($res = $db->query("SELECT cw.pageID, cp.title
785  FROM {widgets} as cw
786  LEFT JOIN {pages} as cp on cp.id = cw.pageID
787  WHERE cw.id = '" . $id . "'"))
788  {
789  while ($row = mysqli_fetch_array($res))
790  {
791  // if no result is given, prepare dropdown for all pages
792  if (!isset($row[1]))
793  {
794  $row[1] = "--all pages--";
795  $allpagescode = "";
796  // delete last entry from array?
797  }
798  else
799  {
800  $allpagescode = "<option value=\"0\">-- all pages--</option>";
801  }
802  echo $row[1];
803  }
804  }
805  // something else has happened
806  \YAWK\sys::setSyslog($db, 39, 1, "failed to get widget ID <b>$id</b>", 0, 0, 0, 0);
807  return false;
808  }
809 
810  /**
811  * @brief get widgets into array
812  * @param object $db database
813  * @return bool|mixed
814  */
815  static function getWidgetsArray($db)
816  { /** @var $db \YAWK\db */
817  if ($res = $db->query("SELECT id, name, (
818  SELECT COUNT( * )
819  FROM {widgets}
820  WHERE widgetType = {widget_types}.id)
821  count
822  FROM {widget_types}
823  ORDER BY name"))
824  { // fetch data
825  $WidgetsArray = array();
826  while ($row = $res->fetch_assoc())
827  {
828  $WidgetsArray[] = $row;
829  }
830  return $res;
831  }
832  else
833  {
834  \YAWK\sys::setSyslog($db, 39, 1, "failed to get widgets from db", 0, 0, 0, 0);
835  return false;
836  }
837  }
838 
839  /**
840  * @brief TODO: OUTDATED??
841  * @details load content widget
842  * @param object $db database
843  * @param int $id widget ID
844  * @return bool|mixed
845  */
846  static function getContentWidget($db, $id)
847  {
848  /** @var $db \YAWK\db */
849  if ($res = $db->query("SELECT cw.id,cw.published,cw.widgetType,cw.pageID,cw.sort,cw.position, cwt.name, cwt.folder
850  FROM {widgets} as cw
851  JOIN {widget_types} as cwt on cw.widgetType = cwt.id
852  WHERE cw.id = '" . $id . "' AND published = '1'
853  ORDER BY cw.sort"))
854  { // fetch data
855  while ($row = mysqli_fetch_array($res)) {
856  $wID = $row[0];
857  $widgetFile = "system/widgets/$row[7]/$row[7].php";
858  return include $widgetFile;
859  }
860 
861  } else { // \YAWK\alert::draw("danger", "Error", "Could not fetch widget ID: $id", "","");
862  \YAWK\sys::setSyslog($db, 39, 1, "failed to get content widget ID <b>$id</b>", 0, 0, 0, 0);
863  return false;
864  }
865  // something strange has happened
866  return false;
867  }
868 
869  /**
870  * @brief TODO: OUTDATED??
871  * @details load widget
872  * @param object $db database
873  * @param int $id widget ID
874  * @return bool|mixed
875  */
876  static function loadWidget($db, $id)
877  {
878  /** @var $db \YAWK\db */
879  if ($res = $db->query("SELECT cw.id,cw.published,cw.widgetType, cwt.name, cwt.folder
880  FROM {widgets} as cw
881  JOIN {widget_types} as cwt on cw.widgetType = cwt.id
882  WHERE cw.id = '" . $id . "'
883  AND published = '1'
884  ORDER BY cw.sort")
885  ) { // fetch data
886  while ($row = mysqli_fetch_array($res)) { // load widget file
887  return include("system/widgets/$row[4]/$row[4].php?widgetID=$id");
888  }
889  } else { // q failed
890  \YAWK\sys::setSyslog($db, 39, 1, "failed to load widget ID <b>$id</b>", 0, 0, 0, 0);
891  echo "failed to load widget!";
892  return false;
893  }
894  // something strange has happened
895  return false;
896  }
897 
898  /**
899  * @brief return the user login box widget
900  */
901  static function getLoginBox()
902  {
903  return include 'system/widgets/loginbox/loginbox.php';
904  }
905 
906  /**
907  * @brief return the facebook likebox widget
908  */
909  static function getFacebookLikeBox()
910  {
911  include 'system/widgets/fb_like/fb_like.php';
912  }
913 
914  /**
915  * @brief toggle widget online / offline
916  * @param object $db database
917  * @param int $id widget ID
918  * @param int $published 0|1 1 is online, zero is offline
919  * @return bool
920  */
921  function toggleOffline($db, $id, $published)
922  {
923  /** @var $db \YAWK\db */
924  // TOGGLE WIDGET STATUS
925  if ($res = $db->query("UPDATE {widgets}
926  SET published = '" . $published . "'
927  WHERE id = '" . $id . "'"))
928  { // toggle successful
929  $status = \YAWK\sys::iStatusToString($published, "online", "offline");
930  \YAWK\sys::setSyslog($db, 37, 0, "toggled widget ID <b>$id</b> to $status", 0, 0, 0, 0);
931  return true;
932  }
933  else
934  { // q failed
935  $status = \YAWK\sys::iStatusToString($published, "online", "offline");
936  \YAWK\sys::setSyslog($db, 39, 1, "failed to toggle widget ID <b>$id</b> to $status", 0, 0, 0, 0);
937  return false;
938  }
939  }
940 
941  /**
942  * @brief copy a widget
943  * @param object $db database
944  * @param int $id widget ID to copy
945  * @return bool
946  */
947  function copy($db, $id)
948  {
949  $originalWidgetID = $id;
950  /** @var $db \YAWK\db */
951  if ($res_widgets = $db->query("SELECT * FROM {widgets} WHERE id = '" . $id . "'"))
952  {
953  // get MAX id from widgets db
954  if ($res_id = $db->query("SELECT MAX(id), MAX(sort) FROM {widgets}"))
955  { // set ID + sort var
956  $row = mysqli_fetch_row($res_id);
957  $id = $row[0] + 1;
958  $sort = $row[1] + 1;
959  }
960  else
961  { // error getting new ID
962  return false;
963  }
964 
965  // get data from given widget id
966  $row = mysqli_fetch_assoc($res_widgets);
967  $published = $row['published'];
968  $widgetType = $row['widgetType'];
969  $pageID = $row['pageID'];
970  $positions = $row['position'];
971 
972  // all good so far... now: copy widget
973  if ($res = $db->query("INSERT INTO {widgets}
974  (id, published, widgetType, pageID, sort, position)
975  VALUES('" . $id . "',
976  '" . $published . "',
977  '" . $widgetType . "',
978  '" . $pageID . "',
979  '" . $sort . "',
980  '" . $positions . "')"))
981  { // copy widget successful// now we need to copy all settings of that widget into the new one
982  // first, we gonna get the settings of oldWidgetID
983  if ($settings = $db->query("SELECT * FROM {widget_settings} WHERE widgetID = '".$originalWidgetID."'"))
984  {
985  while ($settingsResult = mysqli_fetch_assoc($settings))
986  {
987  $widgetID = $settingsResult['widgetID'];
988  $property = $settingsResult['property'];
989  $value = $settingsResult['value'];
990  $widgetType = $settingsResult['widgetType'];
991  $activated = $settingsResult['activated'];
992  $sortation = $settingsResult['sortation'];
993  $label = $settingsResult['label'];
994  $icon = $settingsResult['icon'];
995  $heading = $settingsResult['heading'];
996  $subtext = $settingsResult['subtext'];
997  $fieldClass = $settingsResult['fieldClass'];
998  $fieldType = $settingsResult['fieldType'];
999  $placeholder = $settingsResult['placeholder'];
1000  $options = $settingsResult['options'];
1001  $description = $settingsResult['description'];
1002 
1003  // copy the widget's settings
1004  $db->query("INSERT INTO {widget_settings} (widgetID, property, value, widgetType, activated, sortation, label, icon, heading, subtext, fieldClass, fieldType, placeholder, options, description)
1005  VALUES('" . $id . "',
1006  '" . $property . "',
1007  '" . $value . "',
1008  '" . $widgetType . "',
1009  '" . $activated . "',
1010  '" . $sortation . "',
1011  '" . $label . "',
1012  '" . $icon . "',
1013  '" . $heading . "',
1014  '" . $subtext . "',
1015  '" . $fieldClass . "',
1016  '" . $fieldType . "',
1017  '" . $placeholder . "',
1018  '" . $options . "',
1019  '" . $description . "')");
1020  }
1021  // all finished
1022  return true;
1023  }
1024 
1025  else
1026  {
1027  // copy widget failed
1028  \YAWK\sys::setSyslog($db, 39, 1, "failed to copy settings of widget ID <b>$id</b>", 0, 0, 0, 0);
1029  return false;
1030  }
1031  }
1032  else
1033  {
1034  // copy widget failed
1035  \YAWK\sys::setSyslog($db, 39, 1, "failed to copy widget ID <b>$id</b>", 0, 0, 0, 0);
1036  return false;
1037  }
1038  }
1039  else
1040  { // could not get widget settings
1041  \YAWK\sys::setSyslog($db, 39, 1, "failed to get widget ID <b>$id</b>", 0, 0, 0, 0);
1042  return false;
1043  }
1044  }
1045 
1046  /**
1047  * @brief delete a widget
1048  * @param object $db database
1049  * @param int $widget widget ID
1050  * @return bool
1051  */
1052  function delete($db, $widget)
1053  {
1054  /** @var $db \YAWK\db */
1055  if ($res = $db->query("DELETE FROM {widgets} WHERE id = '" . $widget . "'")) {
1056  // delete corresponding widget settings
1057  if (!$res_settings = $db->query("DELETE FROM {widget_settings} WHERE widgetID = '" . $widget . "'")) {
1058  // q failed
1059  \YAWK\sys::setSyslog($db, 39, 1, "failed to delete settings of widget ID <b>$widget</b>", 0, 0, 0, 0);
1060  return false;
1061  }
1062  return true;
1063  } else {
1064  \YAWK\sys::setSyslog($db, 39, 1, "failed to delete widget ID <b>$widget</b>", 0, 0, 0, 0);
1065  return false;
1066  }
1067  }
1068 
1069  /**
1070  * @brief load widget properties into widget object
1071  * @param object $db database
1072  * @param int $id widget ID
1073  * @return bool
1074  */
1075  function loadProperties($db, $id)
1076  { /** @var $db \YAWK\db */
1077  if (isset($id))
1078  { // escape string
1079  $id = $db->quote($id);
1080  }
1081  /** @param $db \YAWK\db $res */
1082  if ($res = $db->query("SELECT cw.id, cw.published,cw.widgetType,cw.pageID,cw.sort,cw.position, cw.date_publish, cw.date_unpublish, cw.widgetTitle, cwt.name, cw.marginTop, cw.marginBottom, cwt.folder
1083  FROM {widgets} as cw
1084  JOIN {widget_types} as cwt on cw.widgetType = cwt.id
1085  WHERE cw.id = '" . $id . "'"))
1086  {
1087  if ($row = mysqli_fetch_assoc($res))
1088  { // set properties
1089  $this->id = $row['id'];
1090  $this->published = $row['published'];
1091  $this->widgetType = $row['widgetType'];
1092  $this->pageID = $row['pageID'];
1093  $this->sort = $row['sort'];
1094  $this->position = $row['position'];
1095  $this->name = $row['name'];
1096  $this->marginTop = $row['marginTop'];
1097  $this->marginBottom = $row['marginBottom'];
1098  $this->date_publish = $row['date_publish'];
1099  $this->date_unpublish = $row['date_unpublish'];
1100  $this->widgetTitle = $row['widgetTitle'];
1101  $this->folder = $row['folder'];
1102  return true;
1103  }
1104  else
1105  { // fetch failed
1106  \YAWK\sys::setSyslog($db, 39, 1, "failed to fetch widget properties of ID <b>$id</b>", 0, 0, 0, 0);
1107  return false;
1108  }
1109  }
1110  else
1111  { // q failed
1112  \YAWK\sys::setSyslog($db, 39, 1, "failed to query widget properties of ID <b>$id</b>", 0, 0, 0, 0);
1113  return false;
1114  }
1115  }
1116 
1117  /**
1118  * @brief save (update) widget settings
1119  * @param object $db database
1120  * @return bool
1121  */
1122  function save($db)
1123  {
1124  /** @var $db \YAWK\db */
1125  $this->position = mb_strtolower($this->position);
1126  // if widget should be displayed on all pages, pageID should be zero
1127  if (empty($this->pageID || (!isset($this->pageID)))) { $this->pageID = 0; }
1128 
1129  if ($this->date_unpublish === "0000-00-00 00:00:00" || (empty($this->date_unpublish)))
1130  {
1131  // sql code when date_unpublish is a zero date (NULL)
1132  if ($db->query("UPDATE {widgets} SET
1133  published = '" . $this->published . "',
1134  widgetType = '" . $this->widgetType . "',
1135  pageID = '" . $this->pageID . "',
1136  sort = '" . $this->sort . "',
1137  position = '" . $this->position . "',
1138  date_publish = '" . $this->date_publish. "',
1139  date_unpublish = NULL,
1140  widgetTitle = '" . $this->widgetTitle. "'
1141  WHERE id = '" . $this->id . "'"))
1142  { // save successful
1143  return true;
1144  }
1145  else
1146  { // q failed
1147  \YAWK\sys::setSyslog($db, 39, 1, "failed to save widget settings of ID: <b>$this->id</b> (unpublish not set)", 0, 0, 0, 0);
1148  return false;
1149  }
1150 
1151  }
1152  else
1153  {
1154  // sql code with qualified, user selected unpublish date
1155  if ($db->query("UPDATE {widgets} SET
1156  published = '" . $this->published . "',
1157  widgetType = '" . $this->widgetType . "',
1158  pageID = '" . $this->pageID . "',
1159  sort = '" . $this->sort . "',
1160  position = '" . $this->position . "',
1161  date_publish = '" . $this->date_publish. "',
1162  date_unpublish = '" . $this->date_unpublish. "',
1163  widgetTitle = '" . $this->widgetTitle. "'
1164  WHERE id = '" . $this->id . "'"))
1165  { // save successful
1166  return true;
1167  }
1168  else
1169  { // q failed
1170  \YAWK\sys::setSyslog($db, 39, 1, "failed to save widget settings of ID: <b>$this->id</b> (unpublish set)", 0, 0, 0, 0);
1171  return false;
1172  }
1173  }
1174  }
1175 
1176  /**
1177  * @brief Returns an array of all widgets that are linked with given page->id
1178  * @param object $db database
1179  * @param object $page the current page object
1180  * @return array return all widgets that are connected with this page
1181  */
1182  static function loadWidgetsOfPage($db, $page)
1183  {
1184  if (isset($page->id) && (is_numeric($page->id)))
1185  {
1186  $row = $db->query("SELECT cw.id,cw.published,cw.widgetType,cw.pageID,cw.sort,cw.position, cw.date_publish, cw.date_unpublish, cw.widgetTitle, cwt.name, cwt.folder
1187  FROM {widgets} as cw
1188  JOIN {widget_types} as cwt on cw.widgetType = cwt.id
1189  WHERE (cw.pageID = '" . $page->id . "' OR cw.pageID = '0')
1190  ORDER BY cw.sort");
1191 
1192  // create list of widgets as associative array and return it
1193  while ($result = mysqli_fetch_assoc($row)){
1194  $list[] = $result;
1195  }
1196  if (isset($list) && (is_array($list))){
1197  return $list;
1198  }
1199  else {
1200  return false;
1201  }
1202  }
1203  }
1204 
1205 
1206  /**
1207  * @brief Return all widget types as associative array
1208  * @param object $db database
1209  * @return array return all widgets types from database
1210  */
1211  public static function getAllWidgetTypes($db)
1212  {
1213  $row = $db->query("SELECT * FROM {widget_types} ORDER BY name");
1214  while ($res = mysqli_fetch_assoc($row))
1215  {
1216  $widgetTypes[] = $res;
1217  }
1218  if (is_array($widgetTypes) && (!empty($widgetTypes))){
1219  return $widgetTypes;
1220  }
1221  else
1222  {
1223  \YAWK\sys::setSyslog($db, 39, 1, "failed to get list of widget types. $widgetTypes is empty or not set.", 0, 0, 0, 0);
1224  return false;
1225  }
1226  }
1227 
1228  } // end class Widget
1229 }
print $lang['FILEMAN_UPLOAD']
$i_settings
Definition: settings.php:415
die
Definition: block-user.php:27
if(!isset($blog)) if(!isset($language)||(!isset($lang))) if(!isset($db)) $blog published
Definition: blog-toggle.php:17
static setEditorSettingsForCustomHtmlWidget($editorSettings)
output a html script area with all editor options
Definition: editor.php:177
static loadJavascript($editorSettings)
load all required javascript and css files
Definition: editor.php:30
static inject(array $lang, string $pathToFile)
allow plugins to inject language tags to $lang array
Definition: language.php:439
static getEditorSettings($db, $typeID=0)
Returns an associative array containing the editor settings.
Definition: settings.php:377
static getDirPrefix($db)
if yawk is installed into a subdirectory, use this to get this prefix directory
Definition: sys.php:1104
static iStatusToString($i, $on, $off)
convert a integer status to string variable (0|1) to online / offline
Definition: sys.php:729
static checkIfAssetsAreLoaded($db, $assets, $switch)
Check if assets are loaded, load if switch is true.
Definition: sys.php:26
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
static getFacebookLikeBox()
return the facebook likebox widget
Definition: widget.php:909
static getLoginBox()
return the user login box widget
Definition: widget.php:901
getHeading($heading, $subtext)
Get widget heading and subtext, return headline.
Definition: widget.php:669
static loadWidgetsOfPage($db, $page)
Returns an array of all widgets that are linked with given page->id.
Definition: widget.php:1182
$date_unpublish
Definition: widget.php:44
static getCurrentWidgetPath($db)
return current widget path
Definition: widget.php:115
static getAllWidgetTypes($db)
Return all widget types as associative array.
Definition: widget.php:1211
static getAllSettingsIntoArray($db, $widgetID)
Returns an array with all widget settings data.
Definition: widget.php:127
printObject()
Print all object data.
Definition: widget.php:57
$result
Definition: email-send.php:137
$subtext
Definition: jplayer.php:19
$heading
Definition: jplayer.php:18
$type
This class serves methods to create backup from files.
Definition: AdminLTE.php:2
print $page date_publish
Definition: page-edit.php:442
if($page->alias==="index") $editorSettings
Definition: page-edit.php:156
print $_GET['id']
Definition: page-edit.php:357
print $page date_unpublish
Definition: page-edit.php:448
$page
Definition: pages.php:355
$field
Definition: booking.php:9
if(isset($_POST['save'])) $settings
$positions
Definition: index.php:55
$template name
print $tourdates date
$value
$widgetTypes
Definition: widget-new.php:113