aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-05-13 21:33:39 -0700
committerfriendica <info@friendica.com>2014-05-13 21:33:39 -0700
commitb0dc3d3b4cc6c4c4151b2d7882062b6658637955 (patch)
treec6eca727efc361ee41fc0048d7d58509bd008c67
parent2f5bd7e1b3b6df368d3c030828c53a9354ff97cd (diff)
downloadvolse-hubzilla-b0dc3d3b4cc6c4c4151b2d7882062b6658637955.tar.gz
volse-hubzilla-b0dc3d3b4cc6c4c4151b2d7882062b6658637955.tar.bz2
volse-hubzilla-b0dc3d3b4cc6c4c4151b2d7882062b6658637955.zip
add photo widget
-rw-r--r--doc/Widgets.md23
-rw-r--r--include/widgets.php44
2 files changed, 57 insertions, 10 deletions
diff --git a/doc/Widgets.md b/doc/Widgets.md
index 0f8d948ff..48006adcd 100644
--- a/doc/Widgets.md
+++ b/doc/Widgets.md
@@ -6,21 +6,19 @@ Some/many of these widgets have restrictions which may restrict the type of page
* clock - displays the current time
* args: military (1 or 0) - use 24 hour time as opposed to AM/PM
- *
+<br />&nbsp;<br />
* profile - displays a profile sidebar on pages which load profiles (pages with nickname in the URL)
* tagcloud - display a tagcloud of webpage items
* args: count - number of items to return (default 24)
- *
-
+<br />&nbsp;<br />
* collections - collection selector for the current logged in channel
* args: mode - one of "conversation", "group", "abook" depending on module
- *
-
+<br />&nbsp;<br />
* suggestions - friend suggestions for the current logged on channel
@@ -34,8 +32,7 @@ Some/many of these widgets have restrictions which may restrict the type of page
* archive - date range selector for network and channel pages
* args: 'wall' - 1 or 0, limit to wall posts or network/matrix posts (default)
- * 'style': 'list' or 'select' - presentation format, a select form element or a list, default 'select'
- *
+<br />&nbsp;<br />
* fullprofile - same as profile currently
@@ -69,8 +66,16 @@ Some/many of these widgets have restrictions which may restrict the type of page
* bookmarkedchats - list of bookmarked chatrooms collected on this site for the current observer
-* suggestechats - "interesting" chatrooms chosen for the current observer
+* suggestedchats - "interesting" chatrooms chosen for the current observer
* item - displays a single webpage item by mid
-1 args: mid - message_id of webpage to display
+ * args: mid - message_id of webpage to display
+<br />&nbsp;<br />
+
+* photo - display a single photo
+ * args:
+ * url - URL of photo, must be http or https
+ * zrl - use zid authenticated link
+ * style - CSS style string
+<br />&nbsp;<br />
diff --git a/include/widgets.php b/include/widgets.php
index 1b0e140c0..0f6d70ff7 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -719,4 +719,46 @@ $(document).ready(function() {
EOT;
return $o;
-} \ No newline at end of file
+}
+
+
+/**
+ * @function widget_photo($arr)
+ * widget to display a single photo.
+ * @param array $arr;
+ * 'src' => URL of photo
+ * 'zrl' => true or false, use zid in url
+ * 'style' => CSS string
+ * URL must be an http or https URL
+ */
+
+
+function widget_photo($arr) {
+
+ $style = $zrl = false;
+ $params = '';
+ if(array_key_exists('src',$arr) && isset($arr['src']))
+ $url = $arr['src'];
+
+ if(strpos($url,'http') !== 0)
+ return '';
+
+ if(array_key_exists('style',$arr) && isset($arr['style']))
+ $style = $arr['style'];
+
+ if(array_key_exists('zrl',$arr) && isset($arr['zrl']))
+ $zrl = (($arr['zrl']) ? true : false);
+
+ if($zrl)
+ $url = zid($url);
+
+ $o = '<div class="widget">';
+
+ $o .= '<img ' . (($zrl) ? ' class="zrl" ' : '')
+ . (($style) ? ' style="' . $style . '"' : '')
+ . ' src="' . $url . '" />';
+
+ $o .= '</div>';
+
+ return $o;
+}