YaWK  24.1
Yet another WebKit
YAWK\WIDGETS\INSTAGRAM\POSTING\instagram Class Reference

Embed Instagram on your page. More...

+ Inheritance diagram for YAWK\WIDGETS\INSTAGRAM\POSTING\instagram:

Public Member Functions

 __construct ($db)
 Load all widget settings from database and fill object. More...
 
 embed ()
 
 init ()
 Init and embed Instagram. More...
 
 printObject ()
 Print all object data. More...
 
- Public Member Functions inherited from YAWK\widget
 getHeading ($heading, $subtext)
 Get widget heading and subtext, return headline. More...
 
 getWidgetSettingsArray ($db)
 Get widget settings and return it as array. More...
 

Public Attributes

 $instagramHeading = ''
 
 $instagramSubtext = ''
 
 $instagramTarget = ''
 
 $instagramUrl = ''
 
 $instagramWidth = ''
 
 $widget = ''
 
- Public Attributes inherited from YAWK\widget
 $data
 
 $date_publish
 
 $date_unpublish
 
 $folder
 
 $id
 
 $marginBottom
 
 $marginTop
 
 $name
 
 $pageID
 
 $position
 
 $published
 
 $sort
 
 $widgetTitle
 
 $widgetType
 

Additional Inherited Members

- Static Public Member Functions inherited from YAWK\widget
static getAllSettingsIntoArray ($db, $widgetID)
 Returns an array with all widget settings data. More...
 
static getAllWidgetTypes ($db)
 Return all widget types as associative array. More...
 
static getCurrentWidgetPath ($db)
 return current widget path More...
 
static getFacebookLikeBox ()
 return the facebook likebox widget More...
 
static getLoginBox ()
 return the user login box widget More...
 
static loadWidgetsOfPage ($db, $page)
 Returns an array of all widgets that are linked with given page->id. More...
 

Detailed Description

Embed Instagram on your page.

Instagram Widget - embed any single instagram posting

If you want to embed instagram on your page, this is the widget to do it. All you need is a valid instagram url and (optional) some settings, like width or link target. Of course you can set a custom heading and subtext above posting.

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 instagram.php.

Constructor & Destructor Documentation

◆ __construct()

YAWK\WIDGETS\INSTAGRAM\POSTING\instagram::__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 36 of file instagram.php.

37  {
38  // load this widget settings from db
39  $this->widget = new \YAWK\widget();
40  $settings = $this->widget->getWidgetSettingsArray($db);
41  foreach ($settings as $property => $value) {
42  $this->$property = $value;
43  }
44  }
if(isset($_POST['save'])) $settings
$value

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

Member Function Documentation

◆ embed()

YAWK\WIDGETS\INSTAGRAM\POSTING\instagram::embed ( )

Definition at line 66 of file instagram.php.

67  {
68  // draw heading above google map
69  echo $this->getHeading($this->instagramHeading, $this->instagramSubtext);
70 
71  // check if embed html code is set and correct data type
72  if (isset($this->instagramUrl)
73  && (!empty($this->instagramUrl))
74  && (is_string($this->instagramUrl)))
75  {
76  // url seems to be valid...
77  echo '
78 <blockquote class="instagram-media"
79  data-instgrm-captioned data-instgrm-version="7"
80  style="background:#fff;
81  border:0;
82  border-radius:3px;
83  box-shadow:0 0 1px 0 rgba(0,0,0,0.5),0 1px 10px 0 rgba(0,0,0,0.15);
84  margin: 1px;
85  max-width:'.$this->instagramWidth.';
86  padding:0;
87  width:'.$this->instagramWidth.';">
88 
89  <p style="margin:8px 0 0 0; padding:0 4px;">
90  <a href="'.$this->instagramUrl.'"
91  style="color:#000;
92  font-family:Arial,sans-serif;
93  font-size:14px;
94  font-style:normal;
95  font-weight:normal;
96  line-height:17px;
97  text-decoration:none;
98  word-wrap:break-word;"
99  target="'.$this->instagramTarget.'"></a>
100  </p>
101 </blockquote>
102 <script async defer src="//platform.instagram.com/en_US/embeds.js"></script>';
103  }
104  else
105  { // url not valid, throw error msg
106  echo "Here should be an Instagram posting, but the required url was not set.";
107  }
108  }
getHeading($heading, $subtext)
Get widget heading and subtext, return headline.
Definition: widget.php:669

References YAWK\widget\getHeading().

Referenced by YAWK\WIDGETS\INSTAGRAM\POSTING\instagram\init().

◆ init()

YAWK\WIDGETS\INSTAGRAM\POSTING\instagram::init ( )

Init and embed Instagram.

Embed Google Maps

Definition at line 61 of file instagram.php.

62  { // embed Instagram
63  $this->embed();
64  }

References YAWK\WIDGETS\INSTAGRAM\POSTING\instagram\embed().

◆ printObject()

YAWK\WIDGETS\INSTAGRAM\POSTING\instagram::printObject ( )

Print all object data.

(for development and testing purpose)

Reimplemented from YAWK\widget.

Definition at line 50 of file instagram.php.

51  { // output data to screen
52  echo "<pre>";
53  print_r($this);
54  echo "</pre>";
55  }

Member Data Documentation

◆ $instagramHeading

YAWK\WIDGETS\INSTAGRAM\POSTING\instagram::$instagramHeading = ''
Parameters
stringHeading above widget

Definition at line 27 of file instagram.php.

◆ $instagramSubtext

YAWK\WIDGETS\INSTAGRAM\POSTING\instagram::$instagramSubtext = ''
Parameters
stringSubtext beside heading

Definition at line 29 of file instagram.php.

◆ $instagramTarget

YAWK\WIDGETS\INSTAGRAM\POSTING\instagram::$instagramTarget = ''
Parameters
stringLink target (_blank, _parent, _self)

Definition at line 25 of file instagram.php.

◆ $instagramUrl

YAWK\WIDGETS\INSTAGRAM\POSTING\instagram::$instagramUrl = ''
Parameters
stringAny valid instagram url

Definition at line 21 of file instagram.php.

◆ $instagramWidth

YAWK\WIDGETS\INSTAGRAM\POSTING\instagram::$instagramWidth = ''
Parameters
stringWidth of your posting

Definition at line 23 of file instagram.php.

◆ $widget

YAWK\WIDGETS\INSTAGRAM\POSTING\instagram::$widget = ''
Parameters
objectglobal widget object data

Definition at line 19 of file instagram.php.


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