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


PHP WikiFactory::getDomains方法代码示例

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


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

示例1: getCityLink

 public static function getCityLink($cityId)
 {
     global $wgCityId, $wgSitename;
     $domains = WikiFactory::getDomains($cityId);
     if ($wgCityId == $cityId) {
         // Hack based on the fact we should only ask for current wiki's sitename
         $text = $wgSitename;
     } else {
         // The fallback to return anything
         $text = "[" . WikiFactory::IDtoDB($cityId) . ":{$cityId}]";
     }
     if (!empty($domains)) {
         $text = Xml::tags('a', array("href" => "http://" . $domains[0]), $text);
     }
     return $text;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:16,代码来源:RenameUserLogFormatter.class.php

示例2: execute

 /**
  * Do the actual work. All child classes will need to implement this
  */
 public function execute()
 {
     if (!isset($_ENV['SERVER_ID'])) {
         die(1);
     }
     $this->wikiId = $_ENV['SERVER_ID'];
     $this->domain = WikiFactory::getDomains($this->wikiId)[0];
     if (empty($this->domain)) {
         die;
     }
     $ids = $this->getIds();
     $this->domain = isset($this->solrDomain) ? $this->solrDomain : $this->domain;
     $batches = array_chunk($ids, self::ARRAY_SIZE);
     $b = count($batches);
     foreach ($batches as $key => $batch) {
         echo "\nPrepare data for batch: {$key} out of {$b}\n";
         $data = $this->prepareData($batch, $key + 1, $b);
         echo "\nData prepared!\n";
         $this->setInSolr($data);
         echo "Data stored!";
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:25,代码来源:ArticleQualityIndexer.php

示例3: efOutboundScreen

/**
 * This function makes all of the outbound links in the page re-written to go through Special:Outbound.
 */
function efOutboundScreen($url, $text, &$link, $attribs, $linktype)
{
    global $wgCityId, $wgUser, $wgOutboundScreenConfig, $wgTitle;
    static $whiteList;
    // skip logic when in FCK
    global $wgRTEParserEnabled;
    if (!empty($wgRTEParserEnabled)) {
        return true;
    }
    if (strpos($url, 'http://') !== 0) {
        return true;
    }
    // setup functions can call MakeExternalLink before wgTitle is set RT#144229
    if (empty($wgTitle)) {
        return true;
    }
    // if there are no other ads on this page, do not show exitstitial
    $response = F::app()->sendRequest('Ad', 'config');
    $adSlots = $response->getVal('conf');
    if (empty($adSlots) || !sizeof($adSlots)) {
        return true;
    }
    $loggedIn = $wgUser->isLoggedIn();
    if ($wgOutboundScreenConfig['anonsOnly'] == false || $wgOutboundScreenConfig['anonsOnly'] == true && !$loggedIn) {
        if (!is_array($whiteList)) {
            $whiteList = array();
            $whiteListContent = wfMsgExt('outbound-screen-whitelist', array('language' => 'en'));
            if (!empty($whiteListContent)) {
                $lines = explode("\n", $whiteListContent);
                foreach ($lines as $line) {
                    if (strpos($line, '* ') === 0) {
                        $whiteList[] = trim($line, '* ');
                    }
                }
            }
            $wikiDomains = WikiFactory::getDomains($wgCityId);
            if ($wikiDomains !== false) {
                $whiteList = array_merge($wikiDomains, $whiteList);
            }
        }
        // Devboxes run on different domains than just what is in WikiFactory.
        global $wgDevelEnvironment;
        if ($wgDevelEnvironment) {
            array_unshift($whiteList, empty($_SERVER['SERVER_NAME']) ? "" : $_SERVER['SERVER_NAME']);
        }
        $isWhitelisted = false;
        foreach ($whiteList as $whiteListedUrl) {
            $matches = null;
            preg_match('/' . $whiteListedUrl . '/i', $url, $matches);
            if (isset($matches[0])) {
                $isWhitelisted = true;
                break;
            }
        }
        if (!$isWhitelisted) {
            $link = '<a href="' . $url . '" rel="nofollow" class="external exitstitial">' . $text . '</a>';
            return false;
        }
    }
    return true;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:64,代码来源:OutboundScreen.php

示例4: axWFactoryDomainCRUD

function axWFactoryDomainCRUD($type = "add")
{
    global $wgRequest, $wgUser, $wgExternalSharedDB, $wgOut;
    $sDomain = $wgRequest->getVal("domain");
    $city_id = $wgRequest->getVal("cityid");
    if (!$wgUser->isAllowed('wikifactory')) {
        $wgOut->readOnlyPage();
        #--- later change to something reasonable
        return;
    }
    if (empty($city_id)) {
        $wgOut->readOnlyPage();
        #--- later change to something reasonable
        return;
    }
    $dbw = wfGetDB(DB_MASTER, array(), $wgExternalSharedDB);
    $aDomains = array();
    $aResponse = array();
    $sInfo = "";
    switch ($type) {
        case "add":
            if (!preg_match("/^[\\w\\.\\-]+\$/", $sDomain)) {
                /**
                 * check if domain is valid (a im sure that there is function
                 * somewhere for such purpose
                 */
                $sInfo .= "Error: Domain <em>{$sDomain}</em> is invalid (or empty) so it's not added.";
            } else {
                $added = WikiFactory::addDomain($city_id, $sDomain);
                if ($added) {
                    $sInfo .= "Success: Domain <em>{$sDomain}</em> added.";
                } else {
                    $sInfo .= "Error: Domain <em>{$sDomain}</em> is already used so it's not added.";
                }
            }
            break;
        case "change":
            $sNewDomain = $wgRequest->getVal("newdomain");
            #--- first, check if domain is not used
            $oRes = $dbw->select("city_domains", "count(*) as count", array("city_domain" => $sNewDomain), __METHOD__);
            $oRow = $dbw->fetchObject($oRes);
            $dbw->freeResult($oRes);
            if ($oRow->count > 0) {
                #--- domain is used already
                $sInfo .= "<strong>Error: Domain <em>{$sNewDomain}</em> is already used so no change was done.</strong>";
            } elseif (!preg_match("/^[\\w\\.\\-]+\$/", $sNewDomain)) {
                #--- check if domain is valid (a im sure that there is function
                #--- somewhere for such purpose
                $sInfo .= "<strong>Error: Domain <em>{$sNewDomain}</em> is invalid so no change was done..</strong>";
            } else {
                #--- reall change domain
                $dbw->update("city_domains", array("city_domain" => strtolower($sNewDomain)), array("city_id" => $city_id, "city_domain" => strtolower($sDomain)));
                $dbw->commit();
                $sInfo .= "Success: Domain <em>{$sDomain}</em> changed to <em>{$sNewDomain}</em>.";
            }
            break;
        case "remove":
            $removed = WikiFactory::removeDomain($city_id, $sDomain);
            if ($removed) {
                $sInfo .= "Success: Domain <em>{$sDomain}</em> removed.";
            } else {
                $sInfo .= "Failed: Domain <em>{$sDomain}</em> was not removed.";
            }
            break;
        case "status":
            $iNewStatus = $wgRequest->getVal("status");
            if (in_array($iNewStatus, array(0, 1, 2))) {
                #--- updatec city_list table
                $dbw->update("city_list", array("city_public" => $iNewStatus), array("city_id" => $city_id));
                $dbw->commit();
                switch ($iNewStatus) {
                    case 0:
                        $aResponse["div-body"] = "<strong>changed to disabled</strong>";
                        break;
                    case 1:
                        $aResponse["div-body"] = "<strong>changed to enabled</strong>";
                        break;
                    case 2:
                        $aResponse["div-body"] = "<strong>changed to redirected</strong>";
                        break;
                }
            } else {
                $aResponse["div-body"] = "wrong status number";
            }
            $aResponse["div-name"] = "wf-domain-span";
            break;
        case "cancel":
            $sInfo .= "<em>Action cancelled</em>";
            break;
        case "setmain":
            $setmain = WikiFactory::setmainDomain($city_id, $sDomain);
            if ($setmain) {
                $sInfo .= "Success: Domain <em>{$sDomain}</em> set as main.";
            } else {
                $sInfo .= "Failed: Domain <em>{$sDomain}</em> was not set as main.";
            }
            break;
    }
    #--- get actuall domain list
    $aDomains = WikiFactory::getDomains($city_id, true);
//.........这里部分代码省略.........
开发者ID:schwarer2006,项目名称:wikia,代码行数:101,代码来源:SpecialWikiFactory_ajax.php

示例5: formatRow

 function formatRow($result)
 {
     global $wgLang;
     $linker = $this->getSkin();
     $time = $wgLang->timeanddate(wfTimestamp(TS_MW, $result->slog_timestamp), true);
     /* switch for different type of log message */
     switch ($result->slog_type) {
         case 'block':
             $domains = WikiFactory::getDomains($result->slog_city);
             $siteurl = $result->slog_site;
             if (!empty($domains)) {
                 $siteurl = Xml::tags('a', array("href" => "http://" . $domains[0]), $siteurl);
             }
             $out = wfMsg('stafflog-blockmsg', array($time, $linker->userLink($result->slog_user, $result->slog_user_name), $linker->userLink($result->slog_userdst, $result->slog_user_namedst), $siteurl, strlen($result->slog_comment) > 0 ? $result->slog_comment : "-"));
             break;
         case 'piggyback':
             $msg = $result->slog_action == "login" ? "stafflog-piggybackloginmsg" : "stafflog-piggybacklogoutmsg";
             $out = wfMsg($msg, array($time, $linker->userLink($result->slog_user, $result->slog_user_name), $linker->userLink($result->slog_userdst, $result->slog_user_namedst)));
             break;
         case 'wikifactor':
             $out = $time . ' ' . $result->slog_comment;
             break;
         default:
             $out = "";
             wfRunHooks('StaffLog::formatRow', array($result->slog_type, $result, $time, $linker, &$out));
             break;
     }
     /*		$title = Title::makeTitle( NS_CATEGORY, $result->cat_title );
     				$titleText = $this->getSkin()->makeLinkObj( $title, htmlspecialchars( $title->getText() ) );
     				$count = wfMsgExt( 'nmembers', array( 'parsemag', 'escape' ),
     						$wgLang->formatNum( $result->cat_pages ) ); */
     //;
     return Xml::tags('li', null, $out) . "\n";
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:34,代码来源:StaffLog_body.php

示例6: getData

 private function getData()
 {
     /**
      * build query
      */
     wfProfileIn(__METHOD__);
     $offset = $this->mOffset ? array("OFFSET" => $this->mOffset) : array();
     $dbr = WikiFactory::db(DB_SLAVE);
     $sth = $dbr->select(array("city_domains"), array("distinct city_id"), array("city_domain " . $dbr->buildLike($dbr->anyString(), $this->mPart, $dbr->anyString())), __METHOD__, array("ORDER BY" => "city_id", "LIMIT" => $this->mLimit + 1) + $offset);
     $data = array();
     $counter = 0;
     while ($row = $dbr->fetchObject($sth)) {
         $obj = new stdClass();
         $obj->wiki = WikiFactory::getWikiByID($row->city_id);
         $obj->domains = WikiFactory::getDomains($row->city_id);
         if ($counter <= $this->mLimit) {
             $data[] = $obj;
         } else {
             /**
              * there's next page
              */
         }
     }
     wfProfileOut(__METHOD__);
     return $data;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:26,代码来源:SpecialWikiFactory_body.php

示例7: getExitstitialUrlsWhiteList

 private static function getExitstitialUrlsWhiteList()
 {
     global $wgDevelEnvironment, $wgCityId;
     static $whiteList = null;
     if (is_array($whiteList)) {
         return $whiteList;
     }
     $whiteList = [];
     $whiteListContent = wfMsgExt('outbound-screen-whitelist', array('language' => 'en'));
     if (!empty($whiteListContent)) {
         $lines = explode("\n", $whiteListContent);
         foreach ($lines as $line) {
             if (strpos($line, '* ') === 0) {
                 $whiteList[] = trim($line, '* ');
             }
         }
     }
     $wikiDomains = WikiFactory::getDomains($wgCityId);
     if ($wikiDomains !== false) {
         $whiteList = array_merge($wikiDomains, $whiteList);
     }
     // Devboxes run on different domains than just what is in WikiFactory.
     if ($wgDevelEnvironment && !empty($_SERVER['SERVER_NAME'])) {
         array_unshift($whiteList, $_SERVER['SERVER_NAME']);
     }
     return $whiteList;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:27,代码来源:AdEngine2ExitstitialHooks.class.php

示例8: getLocalEnvURL

 /**
  * getLocalEnvURL
  *
  * return URL specific to current env
  * (production, preview, verify, devbox, sandbox)
  *
  * @access public
  * @author pbablok@wikia
  * @static
  *
  * @param string $url	general URL pointing to any server
  *
  * @return string	url pointing to local env
  */
 public static function getLocalEnvURL($url)
 {
     // first - normalize URL
     $regexp = '/^http:\\/\\/([^\\/]+)\\/(.*)$/';
     if (preg_match($regexp, $url, $groups) === 0) {
         // on fail at least return original url
         return $url;
     }
     $server = $groups[1];
     $address = $groups[2];
     $devbox = '';
     // what do we use?
     //  en.wikiname.wikia.com
     //  wikiname.wikia.com
     //  (preview/verify/sandbox).en.wikiname.wikia.com
     //  (preview/verify/sandbox).wikiname.wikia.com
     //  en.wikiname.developer.wikia-dev.com
     //  wikiname.developer.wikia-dev.com
     $servers = array('preview.', 'sandboxs1.', 'verify.');
     foreach ($servers as $serv) {
         if (strpos($server, $serv) === 0) {
             $server = substr($server, strlen($serv));
         }
     }
     $regexp = '/\\.([^\\.]+)\\.wikia-dev\\.com$/';
     if (preg_match($regexp, $server, $groups) === 1) {
         // devbox
         $devbox = $groups[1];
         $server = str_replace('.' . $devbox . '.wikia-dev.com', '', $server);
     } else {
         $server = str_replace('.wikia.com', '', $server);
     }
     /*
      * commenting out code to reduce number of changes
      * that needs to be reviewed for error related to
      * preview.video db connections
      */
     // put the address back into shape and return
     if (empty($_SERVER['SERVER_NAME'])) {
         // maintenance script
         global $wgDevelEnvironment, $wgCityId;
         $domains = WikiFactory::getDomains($wgCityId);
         $domains[] = "localhost";
         if (empty($wgDevelEnvironment)) {
             return 'http://' . $domains[0] . '/' . $address;
         } else {
             $hostname = str_replace('dev-', '', gethostname()) . '.wikia-dev.com';
             $domain = str_replace('wikia.com', $hostname, $domains[0]);
             return 'http://' . $domain . '/' . $address;
         }
     }
     $servername = $_SERVER['SERVER_NAME'];
     if (strpos($servername, 'preview.') !== false) {
         return 'http://preview. ' . $server . '.wikia.com/' . $address;
     }
     if (strpos($servername, 'verify.') !== false) {
         return 'http://verify. ' . $server . '.wikia.com/' . $address;
     }
     if (strpos($servername, 'sandboxs1.') !== false) {
         return 'http://sandbox. ' . $server . '.wikia.com/' . $address;
     }
     if (preg_match($regexp, $servername, $groups) === 1) {
         return 'http://' . $server . '.' . $groups[1] . '.wikia-dev.com/' . $address;
     }
     // by default return original address
     return $url;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:81,代码来源:WikiFactory.php

示例9: moveOldDomains

 /**
  * @access private
  */
 private function moveOldDomains($wikiaId, $newWikiaId = null, $remove = 0)
 {
     global $wgExternalArchiveDB;
     $aDomainsToMove = WikiFactory::getDomains($wikiaId);
     if (!empty($aDomainsToMove)) {
         #-- connect to dataware;
         $dbs = wfGetDB(DB_MASTER, array(), $wgExternalArchiveDB);
         if (!is_null($dbs)) {
             #-- save domains in archive DB
             $dbs->begin();
             foreach ($aDomainsToMove as $domain) {
                 $dbs->insert("city_domains", array("city_id" => $wikiaId, "city_domain" => $domain, "city_timestamp" => wfTimestampNow(), "city_new_id" => $newWikiaId), __METHOD__);
             }
             $dbs->commit();
         }
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:20,代码来源:SpecialCloseWiki_body.php


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