From 446b5550a2c2b52bb31db5b99602c42b9dfdade6 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 16 Mar 2017 17:11:48 -0700 Subject: the rest of the standard widgets converted --- Zotlabs/Widget/Photo_rand.php | 66 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Zotlabs/Widget/Photo_rand.php (limited to 'Zotlabs/Widget/Photo_rand.php') diff --git a/Zotlabs/Widget/Photo_rand.php b/Zotlabs/Widget/Photo_rand.php new file mode 100644 index 000000000..af80a3b9f --- /dev/null +++ b/Zotlabs/Widget/Photo_rand.php @@ -0,0 +1,66 @@ + $channel_id),\App::get_observer(),$album); + + $filtered = array(); + if($ret['success'] && $ret['photos']) + foreach($ret['photos'] as $p) + if($p['imgscale'] == $scale) + $filtered[] = $p['src']; + + if($filtered) { + $e = mt_rand(0, count($filtered) - 1); + $url = $filtered[$e]; + } + + if(strpos($url, 'http') !== 0) + return ''; + + if(array_key_exists('style', $arr) && isset($arr['style'])) + $style = $arr['style']; + + // ensure they can't sneak in an eval(js) function + + if(strpos($style,'(') !== false) + return ''; + + $url = zid($url); + + $o = '
'; + + $o .= '' . t('photo/image') . ''; + + $o .= '
'; + + return $o; + } +} + + -- cgit v1.2.3