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


PHP Wikia::fixDomainName方法代码示例

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


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

示例1: enqueue

 /**
  * Enqueue a task to rebuild the special pages localization cache
  *
  * @param string $wikiaDomain The domain name of the wikia in need of a cache rebuild
  * @return string Generated task ID for the rebuild task
  * @throws \InvalidArgumentException
  */
 public function enqueue($wikiaDomain)
 {
     $wikiaDomain = \Wikia::fixDomainName($wikiaDomain);
     $wikiId = \WikiFactory::DomainToID($wikiaDomain);
     if (!$wikiId) {
         // TODO localize?
         throw new \InvalidArgumentException("No wikia exists for domain {$wikiaDomain}");
     }
     $localizationTask = new UpdateSpecialPagesTask();
     $localizationTask->wikiId($wikiId);
     $localizationTask->call('rebuildLocalizationCache');
     return $localizationTask->queue();
 }
开发者ID:yusufchang,项目名称:app,代码行数:20,代码来源:UpdateSpecialPagesTask.class.php

示例2: getDomainsLikeOrExact

 /**
  * getDomainsLikeOrExact
  *
  * check if name is similar or the same, using sql like queries
  *
  * @access public
  * @author Krzysztof Krzyżaniak <eloy@wikia-inc.com>
  *
  * @param string $name: name to check
  * @param string $language default null - choosen language
  * @param mixed  $type type of domain, default false = wikia.com
  *
  * @return array with matches
  */
 public static function getDomainsLikeOrExact($name, $language = null, $type = false)
 {
     global $wgExternalSharedDB;
     $dbr = wfGetDB(DB_SLAVE, array(), $wgExternalSharedDB);
     $domains = array();
     $unique = array();
     $name = self::deleteCommonPostfix($name);
     $condition = $conditionSimilar = "";
     /**
      * don't check short names
      */
     if (strlen($name) > 3) {
         $names = explode(" ", $name);
         $skip = false;
         $tmp_array = array();
         if (is_array($names)) {
             foreach ($names as $n) {
                 if (!preg_match("/^[\\w\\.]+\$/", $n)) {
                     continue;
                 }
                 $sDomain = Wikia::fixDomainName($n, $language, $type);
                 $tmp_array['exact'][] = "city_domain = '{$sDomain}'";
                 $n = strtr($n, '0123456789-', '%%%%%%%%%%%%');
                 if (empty($type)) {
                     $tmp_array['similar'][] = "city_domain like '%{$n}%'";
                 } else {
                     switch ($type) {
                         case "answers":
                             $__domains = Wikia::getAnswersDomains();
                             if ($__domains && $language && isset($__domains[$language])) {
                                 $likeName = $__domains[$language];
                             } elseif ($__domains && isset($__domains["default"])) {
                                 $likeName = $__domains["default"];
                             }
                             if ($likeName) {
                                 $tmp_array['similar'][] = "city_domain like '%{$n}.{$likeName}%'";
                             }
                             $tmp_array['similar'][] = "city_domain like '%{$n}.{$type}%'";
                             break;
                         default:
                             $tmp_array['similar'][] = "city_domain like '%{$n}.{$type}%'";
                     }
                 }
             }
             if (sizeof($tmp_array)) {
                 $condition = implode(" or ", $tmp_array['exact']);
                 $conditionSimilar = implode(" or ", $tmp_array['similar']);
             } else {
                 $skip = true;
             }
         } else {
             $sDomain = Wikia::fixDomainName($name, $language, $type);
             $condition = "city_domain = '{$sDomain}'";
             $conditionSimilar = empty($type) ? "city_domain like '%{$name}%'" : "city_domain like '%{$name}.{$type}%'";
         }
         $conditionLanguage = "";
         if ($skip === false) {
             #--- exact (but with language prefixes)
             list($city_domains, $city_list) = array("city_domains", "city_list");
             $oRes = $dbr->select(array($city_domains, $city_list), array("*"), array($condition, "{$city_domains}.city_id = {$city_list}.city_id"), __METHOD__, array("LIMIT" => 20));
             while ($oRow = $dbr->fetchObject($oRes)) {
                 if (preg_match("/^www\\./", strtolower($oRow->city_domain))) {
                     continue;
                 }
                 if ($oRow->city_public == 1) {
                     $unique[strtolower($oRow->city_domain)] = 1;
                     $domains["exact"][] = $oRow;
                 } else {
                     $domains["closed"][] = $oRow;
                 }
             }
             $dbr->freeResult($oRes);
             if (!is_null($language)) {
                 $conditionLanguage = "city_lang = '{$language}'";
             }
             #--
             # Similar domains
             $oRes = $dbr->select(array($city_domains, $city_list), array("*"), array($conditionSimilar, "{$city_domains}.city_id = {$city_list}.city_id", $conditionLanguage), __METHOD__, array("LIMIT" => 20));
             while ($oRow = $dbr->fetchObject($oRes)) {
                 if (preg_match("/^www\\./", strtolower($oRow->city_domain))) {
                     continue;
                 }
                 if ($oRow->city_public == 1) {
                     if (array_key_exists(strtolower($oRow->city_domain), $unique) && $unique[strtolower($oRow->city_domain)] == 1) {
                         continue;
                     }
//.........这里部分代码省略.........
开发者ID:schwarer2006,项目名称:wikia,代码行数:101,代码来源:AutoCreateWiki_helper.php

示例3: normalizeName

 static function normalizeName($name)
 {
     return Wikia::fixDomainName($name);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:4,代码来源:CloseWikiTask.php

示例4: submitForm

 /**
  * submitForm
  * 
  * Creates the corresponding entry in the TaskManager queue.
  * 
  * @return boolean true
  * @access public
  */
 function submitForm()
 {
     global $wgOut, $wgUser, $wgRequest;
     $wikiDomain = Wikia::fixDomainName($wgRequest->getText('task-usp-wiki'));
     // check if the wiki exists
     $dbr = WikiFactory::db(DB_MASTER);
     $oRow = $dbr->selectRow(array('city_list', 'city_domains'), array('city_public', 'city_list.city_id'), array('city_list.city_id = city_domains.city_id', 'city_domain' => $wikiDomain), __METHOD__);
     if (empty($oRow->city_id) || 1 != $oRow->city_public) {
         return false;
     }
     $wikiId = $oRow->city_id;
     if (!empty($wikiId)) {
         $this->mTaskID = $this->createTask(array('wikiId' => $wikiId));
     }
     $wgOut->addHTML(Wikia::successbox('Task added'));
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:25,代码来源:UpdateSpecialPagesTask.php


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