Esempio n. 1
0
function gracenote_outputGoogleAnalytics($skin, &$text)
{
    $text .= gracenote_getAnalyticsHtml(GRACENOTE_VIEW_NOT_LYRICS);
    return true;
}
Esempio n. 2
0
function renderLyricTag($input, $argv, $parser)
{
    wfProfileIn(__METHOD__);
    #make new lines in wikitext new lines in html
    $transform = str_replace(array("\r\n", "\r", "\n"), "<br/>", trim($input));
    $isInstrumental = strtolower(trim($transform)) == "{{instrumental}}";
    // If appropriate, build ringtones links.
    global $wgFirstLyricTag, $wgLyricTagDisplayRingtone;
    $ringtoneLink = "";
    // For whatever reason, the links were not showing up after page-edits.
    // It seems that the parser is called multiple-times when saving a page-edit.
    $wgFirstLyricTag = true;
    $retVal = "";
    // NOTE: we put the link here even if wfAdPrefs_doRingtones() is false since ppl all share the article-cache, so the ad will always be in the HTML.
    // If a user has ringtone-ads turned off, their CSS will make the ad invisible.
    if (!empty($wgLyricTagDisplayRingtone) && $wgFirstLyricTag) {
        global $wgExtensionsPath;
        $imgPath = "{$wgExtensionsPath}/3rdparty/LyricWiki";
        $artist = $parser->mTitle->getDBkey();
        $colonIndex = strpos("{$artist}", ":");
        $songTitle = $parser->mTitle->getText();
        $artistLink = $artist;
        $songLink = $songTitle;
        if ($colonIndex !== false) {
            $artist = substr($artist, 0, $colonIndex);
            $songTitle = substr($songTitle, $colonIndex + 1);
            $artistLink = str_replace(" ", "+", $artist);
            $songLink = str_replace(" ", "+", $songTitle);
        }
        $artistLink = str_replace("_", "+", $artistLink);
        $songLink = str_replace("_", "+", $songLink);
        $href = "<a href='http://www.ringtonematcher.com/co/ringtonematcher/02/noc.asp?sid=WILWros&amp;artist=" . urlencode($artistLink) . "&amp;song=" . urlencode($songLink) . "' rel='nofollow' target='_blank'>";
        $ringtoneLink = "";
        $ringtoneLink = "<div class='rtMatcher'>";
        $ringtoneLink .= "{$href}<img src='" . $imgPath . "/phone_left.gif' alt='phone' width='16' height='17'/> ";
        $ringtoneLink .= "Send \"{$songTitle}\" Ringtone to your Cell";
        $ringtoneLink .= " <img src='" . $imgPath . "/phone_right.gif' alt='phone' width='16' height='17'/></a>";
        $ringtoneLink .= "</div>";
        $wgFirstLyricTag = false;
    }
    // FogBugz 8675 - if a page is on the Gracenote takedown list, make it not spiderable (because it's not actually good content... more of a placeholder to indicate to the community that we KNOW about the song, but just legally can't display it).
    if (0 < preg_match("/\\{\\{gracenote[ _]takedown\\}\\}/i", $transform)) {
        $parser->mOutput->setIndexPolicy('noindex');
    }
    #parse embedded wikitext
    $transform = $parser->parse($transform, $parser->mTitle, $parser->mOptions, false, false)->getText();
    $retVal .= gracenote_getNoscriptTag();
    $retVal .= "<div class='lyricbox'>";
    $retVal .= $isInstrumental ? "" : $ringtoneLink;
    // if this is an instrumental, just a ringtone link on the bottom is plenty.
    $retVal .= gracenote_obfuscateText($transform);
    $retVal .= $ringtoneLink;
    $retVal .= "<div class='lyricsbreak'></div>\n";
    // so that we can have stuff in the box (like videos & awards) even if the lyrics are short.
    $retVal .= "</div>";
    // Tell the Google Analytics code that this view was for non-Gracenote lyrics.
    $retVal .= gracenote_getAnalyticsHtml(GRACENOTE_VIEW_OTHER_LYRICS);
    wfProfileOut(__METHOD__);
    return $retVal;
}
Esempio n. 3
0
function renderGracenoteLyricsTag($input, $argv, Parser $parser)
{
    #make new lines in wikitext new lines in html
    $transform = str_replace(array("\r\n", "\r", "\n"), "<br />", trim($input));
    $isInstrumental = strtolower(trim($transform)) == "{{instrumental}}";
    // If appropriate, build ringtones links.
    $ringtoneLink = "";
    // NOTE: we put the link here even if wfAdPrefs_doRingtones() is false since ppl all share the article-cache, so the ad will always be in the HTML.
    // If a user has ringtone-ads turned off, their CSS will make the ad invisible.
    global $wgExtensionsPath;
    $imgPath = "{$wgExtensionsPath}/3rdparty/LyricWiki";
    $artist = $parser->mTitle->getDBkey();
    $colonIndex = strpos("{$artist}", ":");
    $songTitle = $parser->mTitle->getText();
    $artistLink = $artist;
    $songLink = $songTitle;
    if ($colonIndex !== false) {
        $artist = substr($artist, 0, $colonIndex);
        $songTitle = substr($songTitle, $colonIndex + 1);
        $artistLink = str_replace(" ", "+", $artist);
        $songLink = str_replace(" ", "+", $songTitle);
    }
    $artistLink = str_replace("_", "+", $artistLink);
    $songLink = str_replace("_", "+", $songLink);
    $href = "<a href='http://www.ringtonematcher.com/co/ringtonematcher/02/noc.asp?sid=WILWros&amp;artist=" . urlencode($artistLink) . "&amp;song=" . urlencode($songLink) . "' rel='nofollow' target='_blank'>";
    $ringtoneLink = "";
    $ringtoneLink .= "<div class='rtMatcher'>";
    $ringtoneLink .= "{$href}<img src='{$imgPath}/phone_left.gif' alt='phone' width='16' height='17'/> ";
    $ringtoneLink .= "Send \"{$songTitle}\" Ringtone to your Cell";
    $ringtoneLink .= " <img src='{$imgPath}/phone_right.gif' alt='phone' width='16' height='17'/></a>";
    $ringtoneLink .= "</div>";
    global $wgFirstLyricTag;
    $wgFirstLyricTag = false;
    // Even though the gracenote extension ignores these, this will prevent ringtones on other <lyrics> tags.
    // FogBugz 8675 - if a page is on the Gracenote takedown list, make it not spiderable (because it's not actually good content... more of a placeholder to indicate to the community that we KNOW about the song, but just legally can't display it).
    if (0 < preg_match("/\\{\\{gracenote[ _]takedown\\}\\}/i", $transform)) {
        $parser->mOutput->setIndexPolicy('noindex');
    }
    #parse embedded wikitext
    $retVal = "";
    $transform = $parser->parse($transform, $parser->mTitle, $parser->mOptions, false, false)->getText();
    $retVal .= gracenote_getNoscriptTag();
    $retVal .= "<div class='lyricbox'>";
    $retVal .= ($isInstrumental ? "" : $ringtoneLink) . "\n";
    // if this is an instrumental, just a ringtone link on the bottom is plenty.
    $retVal .= gracenote_obfuscateText($transform);
    $retVal .= "\n{$ringtoneLink}";
    $retVal .= "</div>";
    $retVal .= gracenote_getPrintDisabledNotice();
    // Required Gracenote branding.
    $retVal .= gracenote_getBrandingHtml();
    // Tell the Google Analytics code that this view was for Gracenote lyrics.
    $retVal .= gracenote_getAnalyticsHtml(GRACENOTE_VIEW_GRACENOTE_LYRICS);
    return $retVal;
}
Esempio n. 4
0
function renderLyricTag($input, $argv, $parser)
{
    wfProfileIn(__METHOD__);
    #make new lines in wikitext new lines in html
    $transform = str_replace(array("\r\n", "\r", "\n"), "<br/>", trim($input));
    $isInstrumental = strtolower(trim($transform)) == "{{instrumental}}";
    // If appropriate, build ringtones links.
    global $wgFirstLyricTag, $wgLyricTagDisplayRingtone;
    $ringtoneLink = "";
    // For whatever reason, the links were not showing up after page-edits.
    // It seems that the parser is called multiple-times when saving a page-edit.
    $wgFirstLyricTag = true;
    $retVal = "";
    // NOTE: we put the link here even if wfAdPrefs_doRingtones() is false since ppl all share the article-cache, so the ad will always be in the HTML.
    // If a user has ringtone-ads turned off, their CSS will make the ad invisible.
    if (!empty($wgLyricTagDisplayRingtone) && $wgFirstLyricTag) {
        global $wgExtensionsPath;
        $imgPath = "{$wgExtensionsPath}/3rdparty/LyricWiki";
        $artist = $parser->mTitle->getDBkey();
        $colonIndex = strpos("{$artist}", ":");
        $songTitle = "";
        if ($colonIndex !== false) {
            $artist = substr($artist, 0, $colonIndex);
            $songTitle = $parser->mTitle->getText();
            $songTitle = substr($songTitle, $colonIndex + 1);
        }
        // The links have different adunit_ids above/below lyrics now. This will differentiate them for tracking.
        $aboveLink = getToneFuzeLink($isAboveLyrics = true, $artist, $songTitle);
        $belowLink = getToneFuzeLink($isAboveLyrics = false, $artist, $songTitle);
        $wgFirstLyricTag = false;
    }
    // FogBugz 8675 - if a page is on the Gracenote takedown list, make it not spiderable (because it's not actually good content... more of a placeholder to indicate to the community that we KNOW about the song, but just legally can't display it).
    if (0 < preg_match("/\\{\\{gracenote[ _]takedown\\}\\}/i", $transform)) {
        $parser->mOutput->setIndexPolicy('noindex');
    }
    #parse embedded wikitext
    $transform = $parser->parse($transform, $parser->mTitle, $parser->mOptions, false, false)->getText();
    $retVal .= gracenote_getNoscriptTag();
    $retVal .= "<div class='lyricbox'>";
    $retVal .= $isInstrumental ? "" : $aboveLink;
    // if this is an instrumental, just a ringtone link on the bottom is plenty.
    $retVal .= gracenote_obfuscateText($transform);
    $retVal .= $belowLink;
    $retVal .= "<div class='lyricsbreak'></div>\n";
    // so that we can have stuff in the box (like videos & awards) even if the lyrics are short.
    $retVal .= "</div>";
    // Tell the Google Analytics code that this view was for non-Gracenote lyrics.
    $retVal .= gracenote_getAnalyticsHtml(GRACENOTE_VIEW_OTHER_LYRICS);
    wfProfileOut(__METHOD__);
    return $retVal;
}