add photo widget
This commit is contained in:
parent
2f5bd7e1b3
commit
b0dc3d3b4c
@ -6,21 +6,19 @@ Some/many of these widgets have restrictions which may restrict the type of page
|
|||||||
|
|
||||||
* clock - displays the current time
|
* clock - displays the current time
|
||||||
* args: military (1 or 0) - use 24 hour time as opposed to AM/PM
|
* args: military (1 or 0) - use 24 hour time as opposed to AM/PM
|
||||||
*
|
<br /> <br />
|
||||||
|
|
||||||
* profile - displays a profile sidebar on pages which load profiles (pages with nickname in the URL)
|
* profile - displays a profile sidebar on pages which load profiles (pages with nickname in the URL)
|
||||||
|
|
||||||
* tagcloud - display a tagcloud of webpage items
|
* tagcloud - display a tagcloud of webpage items
|
||||||
|
|
||||||
* args: count - number of items to return (default 24)
|
* args: count - number of items to return (default 24)
|
||||||
*
|
<br /> <br />
|
||||||
|
|
||||||
|
|
||||||
* collections - collection selector for the current logged in channel
|
* collections - collection selector for the current logged in channel
|
||||||
|
|
||||||
* args: mode - one of "conversation", "group", "abook" depending on module
|
* args: mode - one of "conversation", "group", "abook" depending on module
|
||||||
*
|
<br /> <br />
|
||||||
|
|
||||||
|
|
||||||
* suggestions - friend suggestions for the current logged on channel
|
* 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
|
* archive - date range selector for network and channel pages
|
||||||
* args: 'wall' - 1 or 0, limit to wall posts or network/matrix posts (default)
|
* 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 /> <br />
|
||||||
*
|
|
||||||
|
|
||||||
* fullprofile - same as profile currently
|
* 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
|
* 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
|
* 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 /> <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 /> <br />
|
||||||
|
|
||||||
|
@ -720,3 +720,45 @@ EOT;
|
|||||||
return $o;
|
return $o;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user