123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- <?php
- defined('GNUSOCIAL') || die();
- class Widget
- {
- protected $avatarSize = AVATAR_STREAM_SIZE;
-
- public $out = null;
-
- public function __construct(?Action $out = null, array $widgetOpts = [])
- {
- $this->out = $out;
- if (!array_key_exists('scoped', $widgetOpts)) {
- $this->widgetOpts['scoped'] = Profile::current();
- }
- $this->scoped = $this->widgetOpts['scoped'];
- }
-
- public function show()
- {
- }
-
- public function getOut()
- {
- return $this->out;
- }
-
- public function __call($name, $arguments)
- {
- return call_user_func_array(array($this->out, $name), $arguments);
- }
-
- public function avatarSize()
- {
- return $this->avatarSize;
- }
- protected function showAvatar(Profile $profile, $size=null)
- {
- $avatar_url = $profile->avatarUrl($size ?: $this->avatarSize());
- $this->out->element('img', array('src' => $avatar_url,
- 'class' => 'avatar u-photo',
- 'width' => $this->avatarSize(),
- 'height' => $this->avatarSize(),
- 'alt' => $profile->getBestName()));
- }
- }
|