/** * display_user_field * This display the module in user page */ public function display_user_field(library_item $libitem = null) { $name = $libitem != null ? $libitem->get_fullname() : T_('User') . " `" . $this->user->fullname . "` " . T_('on') . " " . AmpConfig::get('site_title'); $lang = substr(AmpConfig::get('lang'), 0, 2); if (empty($lang)) { $lang = 'US'; } echo "<form action='https://www.paypal.com/cgi-bin/webscr' method='post' target='_top'>\n"; echo "<input type='hidden' name='cmd' value='_donations'>\n"; echo "<input type='hidden' name='business' value='" . scrub_out($this->business) . "'>\n"; echo "<input type='hidden' name='lc' value='" . $lang . "'>\n"; echo "<input type='hidden' name='item_name' value='" . $name . "'>\n"; echo "<input type='hidden' name='no_note' value='0'>\n"; echo "<input type='hidden' name='currency_code' value='" . scrub_out($this->currency_code) . "'>\n"; echo "<input type='hidden' name='bn' value='PP-DonationsBF:btn_donate_SM.gif:NonHostedGuest'>\n"; echo "<input type='image' src='https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif' border='0' name='submit' alt='PayPal - The safer, easier way to pay online!'>\n"; echo "<img alt='' border='0' src='https://www.paypalobjects.com/fr_XC/i/scr/pixel.gif' width='1' height='1'>\n"; echo "</form>\n"; }
/** * Display an item art. * @param library_item $item * @param int $thumb * @param string $link * @return boolean */ public static function display_item($item, $thumb, $link = null) { return self::display($item->type, $item->id, $item->get_fullname(), $thumb, $link); }
/** * display_user_field * This display the module in user page */ public function display_user_field(library_item $libitem = null) { $name = $libitem != null ? $libitem->get_fullname() : T_('User') . " `" . $this->user->fullname . "` " . T_('on') . " " . AmpConfig::get('site_title'); $link = $libitem != null && $libitem->link ? $libitem->link : $this->user->link; echo "<a rel='nohtml' href='https://flattr.com/submit/auto?user_id=" . scrub_out($this->user_id) . "&url=" . rawurlencode($link) . "&category=audio&title=" . rawurlencode($name) . "' target='_blank'><img src='//button.flattr.com/flattr-badge-large.png' alt='Flattr this' title='Flattr this' border='0'></a>"; }
public static function podcast(library_item $libitem) { $xml = new SimpleXMLElement('<rss />'); $xml->addAttribute("version", "2.0"); $xml->addAttribute("xmlns:xmlns:atom", "http://www.w3.org/2005/Atom"); $xml->addAttribute("xmlns:xmlns:itunes", "http://www.itunes.com/dtds/podcast-1.0.dtd"); $xchannel = $xml->addChild("channel"); $xchannel->addChild("title", $libitem->get_fullname() . " Podcast"); $xlink = $xchannel->addChild("atom:link"); $xlink->addAttribute("type", "text/html"); $xlink->addAttribute("href", $libitem->link); if (Art::has_db($libitem->id, get_class($libitem))) { $ximg = $xchannel->addChild("xmlns:itunes:image"); $ximg->addAttribute("href", Art::url($libitem->id, get_class($libitem))); } $summary = $libitem->get_description(); if (!empty($summary)) { $xchannel->addChild("xmlns:itunes:summary", $summary); } $xchannel->addChild("xmlns:itunes:category", "Music"); $owner = $libitem->get_user_owner(); if ($owner) { $user_owner = new User($owner); $user_owner->format(); $xowner = $xchannel->addChild("xmlns:itunes:owner"); $xowner->addChild("xmlns:itunes:name", $user_owner->f_name); } $medias = $libitem->get_medias(); foreach ($medias as $media_info) { $media = new $media_info['object_type']($media_info['object_id']); $media->format(); $xitem = $xchannel->addChild("item"); $xitem->addChild("title", $media->get_fullname()); if ($media->f_artist) { $xitem->addChild("xmlns:itunes:author", $media->f_artist); } $xmlink = $xitem->addChild("link"); $xmlink->addAttribute("href", $media->link); $xitem->addChild("guid", $media->link); if ($media->addition_time) { $xitem->addChild("pubDate", date("r", $media->addition_time)); } $description = $media->get_description(); if (!empty($description)) { $xitem->addChild("description", $description); } $xitem->addChild("xmlns:itunes:duration", $media->f_time); $xencl = $xitem->addChild("enclosure"); $xencl->addAttribute("type", $media->mime); $xencl->addAttribute("length", $media->size); $surl = $media_info['object_type']::play_url($media_info['object_id']); $xencl->addAttribute("url", $surl); } $xmlstr = $xml->asXml(); // Format xml output $dom = new DOMDocument(); $dom->loadXML($xmlstr); $dom->formatOutput = true; return $dom->saveXML($dom->documentElement); }