diff options
author | friendica <info@friendica.com> | 2014-05-13 21:33:39 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-05-13 21:33:39 -0700 |
commit | b0dc3d3b4cc6c4c4151b2d7882062b6658637955 (patch) | |
tree | c6eca727efc361ee41fc0048d7d58509bd008c67 /include | |
parent | 2f5bd7e1b3b6df368d3c030828c53a9354ff97cd (diff) | |
download | volse-hubzilla-b0dc3d3b4cc6c4c4151b2d7882062b6658637955.tar.gz volse-hubzilla-b0dc3d3b4cc6c4c4151b2d7882062b6658637955.tar.bz2 volse-hubzilla-b0dc3d3b4cc6c4c4151b2d7882062b6658637955.zip |
add photo widget
Diffstat (limited to 'include')
-rw-r--r-- | include/widgets.php | 44 |
1 files changed, 43 insertions, 1 deletions
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; +} |