当前位置: 首页>>代码示例>>PHP>>正文


PHP Wikia::isValidDomain方法代码示例

本文整理汇总了PHP中Wikia::isValidDomain方法的典型用法代码示例。如果您正苦于以下问题:PHP Wikia::isValidDomain方法的具体用法?PHP Wikia::isValidDomain怎么用?PHP Wikia::isValidDomain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Wikia的用法示例。


在下文中一共展示了Wikia::isValidDomain方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wsinfo

/**
 * @author UNKNOWN
 * @author Krzysztof Krzyżaniak (eloy)
 *
 * replace PLACEHOLDER with domain data
 */
function wsinfo($parser, $thetext)
{
    global $wgOut, $wgTitle, $wswErotik, $wgRTEParserEnabled;
    $forsale = "";
    /**
     * do not touch placeholder in RTE
     */
    if ($wgRTEParserEnabled) {
        return true;
    }
    /**
     * back off when there's no placeholder in article
     */
    if (strpos($thetext, WSINFO_PLACEHOLDER) === false) {
        return true;
    } else {
        $thetext = str_replace(WSINFO_PLACEHOLDER, '', $thetext);
    }
    $title = $wgTitle->getText();
    /**
     * debug message per rt#46876
     */
    Wikia::log(__METHOD__, "info", "Title of article: {$title}", true);
    $wswErotik = 0;
    $hour = date("H");
    $day = 0;
    $erolink = "http://www.privatelivecams.de/?WMID=5143&CTRLID=Jlc9Mg%3D%3D7&WMEC=5&PID=1";
    if ($hour > 6 && $hour < 22) {
        $day = 1;
        // $erolink = "http://www.affaire.com/?WMID=5143&CTRLID=&PID=1&WMEC=5&pop=0";
        $erolink = "http://www.dates4you.net/?WMID=5143&CTRLID=&PID=1&WMEC=5&pop=0";
    }
    if (strstr($thetext, "Die Website dieses Artikels entspricht nicht den Bedingungen der deutschen Jugendschutzbestimmungen.")) {
        $wswErotik = 1;
    }
    if (array_key_exists("Erotik", $parser->mOutput->mCategories) || array_key_exists("Adult", $parser->mOutput->mCategories) || array_key_exists("Pornografie", $parser->mOutput->mCategories)) {
        $wswErotik = 1;
    }
    $dom = strtolower($title);
    if (!Wikia::isValidDomain($dom)) {
        return true;
    }
    if (array_key_exists("Geparkt", $parser->mOutput->mCategories) || array_key_exists("Baustelle", $parser->mOutput->mCategories) || array_key_exists("Fehlerseiten", $parser->mOutput->mCategories)) {
        $forsale = "<a href=\"http://www.sedo.de/checkdomainoffer.php4?partnerid=13318&domain={$dom}\" class=\"external text\" target=\"_new\">" . wfMsgForContent('websiteinfo-buy') . "</a><br>\n";
    }
    if ($wswErotik) {
        $issex = "sex";
    } else {
        $issex = "no";
    }
    $armor = substr(md5($dom), 0, 16) . 'WsWImG=' . $dom . "={$issex}=Ws3ik1Ju5ch=" . substr(md5($dom), 16);
    $crypt = strtr(trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, 'WsImgS33CCrret', $armor, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND)))), '+/', '-!');
    $img = "http://thumbs.websitewiki.de/{$crypt}";
    if (substr_count($dom, ".") > 1) {
        if (substr_count($dom, ".") == 2 && (strstr($dom, "or.at") || strstr($dom, "co.at"))) {
            $domlink = "http://www.{$dom}/";
        } else {
            $domlink = "http://{$dom}/";
        }
        $domtext = "{$dom}";
    } else {
        $domlink = "http://www.{$dom}/";
        $domtext = "www.{$dom}";
    }
    $result = "";
    $checksiteUrl = Title::newFromText("Checksite", NS_SPECIAL)->getLocalUrl(array("param" => $dom));
    if ($day && $wswErotik) {
        $result .= "\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"4\" style=\"float:right; margin:0 0 .5em 1em;\n     width:260px; background:#fff; border-collapse:collapse; border:1px solid #999;\n     font-size:smaller; line-height:1.5; \" summary=\"" . wfMsgForContent('websiteinfo-title', $title) . "\">\n     <tr><td style=\"text-align:center; background:#c0c0c0;\"><b>" . wfMsgForContent('websiteinfo-summary-link', $title) . "</b></td></tr>\n     <tr><td style=\"text-align:center; background:#f0f0f0;\"><img src=\"{$img}\"\n\t width=\"250\" height=\"188\" alt=\"" . wfMsgForContent('websiteinfo-screenshot-alt', $domtext) . "\" border=\"0\" /></td></tr>\n     <tr>{$forsale}<td style=\"text-align:center; background:#f0f0f0;\"><a href=\"{$checksiteUrl}\" rel=\"nofollow\">" . wfMsgForContent('websiteinfo-verify') . "</a>\n\t </td></tr>\n\t \n";
    } else {
        $result .= "\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"4\" style=\"float:right; margin:0 0 .5em 1em;\n     width:260px; background:#fff; border-collapse:collapse; border:1px solid #999;\n     font-size:smaller; line-height:1.5; \" summary=\"" . wfMsgForContent('websiteinfo-title', $title) . "\">\n     <tr><td style=\"text-align:center; background:#c0c0c0;\"><b>" . wfMsgForContent('websiteinfo-summary-link', $title) . "</b></td></tr>\n     <tr><td style=\"text-align:center; background:#f0f0f0;\"><a href=\"{$domlink}\"\n         title=\"{$domtext}\" rel=\"nofollow\" target=\"_new\"><img src=\"{$img}\"\n\t width=\"250\" height=\"188\" alt=\"" . wfMsgForContent('websiteinfo-screenshot-alt', $domtext) . "\" border=\"0\" /></a></td></tr>\n     <tr><td style=\"text-align:center; background:#f0f0f0;\"><a href=\"{$domlink}\"\n         title=\"{$domtext}\" class=\"external text\" target=\"_new\">{$domtext}</a><br>\n\t {$forsale}<a href=\"{$checksiteUrl}\" rel=\"nofollow\">" . wfMsgForContent('websiteinfo-verify') . "</a>\n\t </td></tr>\n\t \n";
    }
    global $wgUploadDirectory, $wgUploadPath;
    $rev = Revision::newFromTitle($parser->getTitle());
    if (is_object($rev)) {
        $wikitext = $rev->getText();
        $regs = array();
        if (preg_match('{{PLZ\\|(D|A|CH)-([0-9]{4,5})}}', $wikitext, $regs) && ($regs[1] == 'D' && strlen($regs[2]) == 5 || $regs[1] != 'D' && strlen($regs[2]) == 4)) {
            $country = $regs[1];
            $myplz = $regs[2];
            $imgurl = '/plzmap/' . strtolower($country[0]) . $myplz[0] . '/' . strtolower($country[0]) . $myplz . '.png';
            $imgfile = $wgUploadDirectory . $imgurl;
            if (file_exists($imgfile)) {
                $result .= <<<EOI
\t<tr><td align="center" style="background:#ffffff;"><div style="position:relative; top:6px; width:250px;
\t  height:0px; text-align:center;"><strong><a href="/Kategorie:{$country}-{$myplz}" style="background-color:white;">&nbsp;{$country}-{$myplz}&nbsp;</a></strong></div>
\t<img src="{$wgUploadPath}{$imgurl}" width="250" height="200" alt="{$country}-{$myplz}">
\t<div style="position:relative; bottom:15px; left:3px; width:250px; height:0px; text-align:left;"><a href="/Landkarten_Copyright_OpenStreetMap" title="&copy; OpenStreetMap contributors">&copy; OSM</a></div>
\t </td></tr>

EOI;
            }
        }
    }
    /*
//.........这里部分代码省略.........
开发者ID:schwarer2006,项目名称:wikia,代码行数:101,代码来源:domainhook.php


注:本文中的Wikia::isValidDomain方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。