當前位置: 首頁>>代碼示例>>PHP>>正文


PHP utils::lcfirst方法代碼示例

本文整理匯總了PHP中utils::lcfirst方法的典型用法代碼示例。如果您正苦於以下問題:PHP utils::lcfirst方法的具體用法?PHP utils::lcfirst怎麽用?PHP utils::lcfirst使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在utils的用法示例。


在下文中一共展示了utils::lcfirst方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getPublishedPatchs

 /**
  * Used to get the published patches of a given server and a given pushfeed
  * (and optionnaly a page title)
  * @param <string> $server url of the server
  * @param <string> $pushName pushfeed name
  * @param <string> $title article title
  * @return <array> array of patchIDs
  */
 static function getPublishedPatchs($server, $pushName, $title = null)
 {
     //global $wgScriptExtension;
     $published = array();
     $pushName = str_replace(' ', '_', $pushName);
     $title = str_replace(' ', '_', $title);
     if (isset($title)) {
         $patchXML = utils::file_get_contents_curl(utils::lcfirst($server) . "/api.php?action=query&meta=patchPushed&pppushName=" . $pushName . '&pppageName=' . $title . '&format=xml');
         /*test if it is a xml file. If not, the server is not reachable via the url
          * Then we try to reach it with the .php5 extension
          */
         if (strpos($patchXML, "<?xml version=\"1.0\"?>") === false) {
             $patchXML = utils::file_get_contents_curl(utils::lcfirst($server) . "/api.php5?action=query&meta=patchPushed&pppushName=" . $pushName . '&pppageName=' . $title . '&format=xml');
         }
         if (strpos($patchXML, "<?xml version=\"1.0\"?>") === false) {
             $patchXML = false;
         }
     } else {
         $patchXML = utils::file_get_contents_curl(utils::lcfirst($server) . "/api.php?action=query&meta=patchPushed&pppushName=" . $pushName . '&format=xml');
         /*test if it is a xml file. If not, the server is not reachable via the url
          * Then we try to reach it with the .php5 extension
          */
         if (strpos($patchXML, "<?xml version=\"1.0\"?>") === false) {
             $patchXML = utils::file_get_contents_curl(utils::lcfirst($server) . "/api.php5?action=query&meta=patchPushed&pppushName=" . $pushName . '&format=xml');
         }
         if (strpos($patchXML, "<?xml version=\"1.0\"?>") === false) {
             $patchXML = false;
         }
     }
     if ($patchXML === false) {
         return false;
     }
     $patchXML = trim($patchXML);
     $dom = new DOMDocument();
     $dom->loadXML($patchXML);
     $patchPublished = $dom->getElementsByTagName('patch');
     $published = array();
     foreach ($patchPublished as $p) {
         $published[] = $p->firstChild->nodeValue;
     }
     return $published;
 }
開發者ID:hala54,項目名稱:DSMW,代碼行數:50,代碼來源:utils.php

示例2: onUnknownAction


//.........這裏部分代碼省略.........
         }
         // $name = $name1[0];//with NS
         utils::writeAndFlush('<p><b>Start pull</b></p>');
         foreach ($name1 as $name) {
             // for each pullfeed name==> pull
             utils::writeAndFlush("<span style=\"margin-left:30px;\">begin pull: <A HREF=" . 'http://' . $wgServerName . $wgScriptPath . "/index.php?title={$name}>" . $name . "</a></span> <br/>");
             wfDebugLog('p2p', '      -> pull : ' . $name);
             // $previousCSID = getPreviousPulledCSID($name);
             // if($previousCSID==false) {
             //	$previousCSID = "none";
             // }
             $previousCSID = getHasPullHead($name);
             if ($previousCSID == false) {
                 $previousCSID = "none";
             }
             wfDebugLog('p2p', '      -> pullHead : ' . $previousCSID);
             $relatedPushServer = getPushURL($name);
             if (is_null($relatedPushServer)) {
                 throw new MWException(__METHOD__ . ': no relatedPushServer url');
             }
             $namePush = getPushName($name);
             $namePush = str_replace(' ', '_', $namePush);
             wfDebugLog('p2p', '      -> pushServer : ' . $relatedPushServer);
             wfDebugLog('p2p', '      -> pushName : ' . $namePush);
             if (is_null($namePush)) {
                 throw new MWException(__METHOD__ . ': no PushName');
             }
             // split NS and name
             preg_match("/^(.+?)_*:_*(.*)\$/S", $namePush, $m);
             $nameWithoutNS = $m[2];
             // $url = $relatedPushServer.'/api.php?action=query&meta=changeSet&cspushName='.$nameWithoutNS.'&cschangeSet='.$previousCSID.'&format=xml';
             // $url = $relatedPushServer."/api{$wgScriptExtension}?action=query&meta=changeSet&cspushName=".$nameWithoutNS.'&cschangeSet='.$previousCSID.'&format=xml';
             wfDebugLog('testlog', '      -> request ChangeSet : ' . $relatedPushServer . '/api.php?action=query&meta=changeSet&cspushName=' . $nameWithoutNS . '&cschangeSet=' . $previousCSID . '&format=xml');
             $cs = utils::file_get_contents_curl(utils::lcfirst($relatedPushServer) . "/api.php?action=query&meta=changeSet&cspushName=" . $nameWithoutNS . '&cschangeSet=' . $previousCSID . '&format=xml');
             /* test if it is a xml file. If not, the server is not reachable via the url
              * Then we try to reach it with the .php5 extension
              */
             if (strpos($cs, "<?xml version=\"1.0\"?>") === false) {
                 $cs = utils::file_get_contents_curl(utils::lcfirst($relatedPushServer) . "/api.php5?action=query&meta=changeSet&cspushName=" . $nameWithoutNS . '&cschangeSet=' . $previousCSID . '&format=xml');
             }
             if (strpos($cs, "<?xml version=\"1.0\"?>") === false) {
                 $cs = false;
             }
             if ($cs === false) {
                 throw new MWException(__METHOD__ . ': Cannot connect to Push Server (ChangeSet API)');
             }
             $cs = trim($cs);
             $dom = new DOMDocument();
             $dom->loadXML($cs);
             $changeSet = $dom->getElementsByTagName('changeSet');
             $CSID = null;
             foreach ($changeSet as $cs) {
                 if ($cs->hasAttribute("id")) {
                     $CSID = $cs->getAttribute('id');
                     $csName = $CSID;
                 }
             }
             wfDebugLog('p2p', '     -> changeSet found ' . $CSID);
             while ($CSID != null) {
                 // if(!utils::pageExist($CSID)) {
                 $listPatch = null;
                 $patchs = $dom->getElementsByTagName('patch');
                 foreach ($patchs as $p) {
                     wfDebugLog('p2p', '          -> patch ' . $p->firstChild->nodeValue);
                     $listPatch[] = $p->firstChild->nodeValue;
                 }
開發者ID:realsoc,項目名稱:mediawiki-extensions,代碼行數:67,代碼來源:DSMW.hooks.php

示例3: integrate

/**
 * A ChangeSet has patches which has operations
 * this function is used to integrate these operations
 * It's a local changeSet (downloaded from a remote site)
 * @param <String> $changeSetId with NS
 */
function integrate($changeSetId, $patchIdList, $relatedPushServer, $csName)
{
    //global $wgScriptExtension;
    // $patchIdList = getPatchIdList($changeSetId);
    //  $lastPatch = utils::getLastPatchId($pageName);
    global $wgServerName, $wgScriptPath, $wgScriptExtension, $wgOut;
    $urlServer = 'http://' . $wgServerName . $wgScriptPath . "/index.php/{$csName}";
    wfDebugLog('p2p', '@@@@@@@@@@@@@@@@@@@ - function integrate : ' . $changeSetId);
    $i = 1;
    $j = count($patchIdList);
    $pages = array();
    foreach ($patchIdList as $patchId) {
        $name = 'patch';
        $sub = substr($patchId, 6, 3);
        wfDebugLog('p2p', '  -> patchId : ' . $patchId);
        if (!utils::pageExist($patchId)) {
            //if this patch exists already, don't apply it
            wfDebugLog('p2p', '      -> patch unexist');
            $url = utils::lcfirst($relatedPushServer) . "/api.php?action=query&meta=patch&papatchId=" . $patchId . '&format=xml';
            wfDebugLog('p2p', '      -> getPatch request url ' . $url);
            $patch = utils::file_get_contents_curl($url);
            /*test if it is a xml file. If not, the server is not reachable via the url
             * Then we try to reach it with the .php5 extension
             */
            if (strpos($patch, "<?xml version=\"1.0\"?>") === false) {
                $url = utils::lcfirst($relatedPushServer) . "/api.php5?action=query&meta=patch&papatchId=" . $patchId . '&format=xml';
                wfDebugLog('p2p', '      -> getPatch request url ' . $url);
                $patch = utils::file_get_contents_curl($url);
            }
            if (strpos($patch, "<?xml version=\"1.0\"?>") === false) {
                $patch = false;
            }
            //echo $patch;
            if ($patch === false) {
                throw new MWException(__METHOD__ . ': Cannot connect to Push Server (Patch API)');
            }
            $patch = trim($patch);
            wfDebugLog('p2p', '      -> patch content :' . $patch);
            $dom = new DOMDocument();
            $dom->loadXML($patch);
            $patchs = $dom->getElementsByTagName($name);
            //when the patch is not found, mostly when the id passed
            //through the url is wrong
            if (empty($patchs) || is_null($patchs)) {
                throw new MWException(__METHOD__ . ': Error: Patch not found!');
            }
            //        $patchID = null;
            foreach ($patchs as $p) {
                if ($p->hasAttribute("onPage")) {
                    $onPage = $p->getAttribute('onPage');
                }
                if ($p->hasAttribute("previous")) {
                    $previousPatch = $p->getAttribute('previous');
                }
                if ($p->hasAttribute("siteID")) {
                    $siteID = $p->getAttribute('siteID');
                }
                if ($p->hasAttribute("mime")) {
                    $Mime = $p->getAttribute('mime');
                }
                if ($p->hasAttribute("size")) {
                    $Size = $p->getAttribute('size');
                }
                if ($p->hasAttribute("url")) {
                    $Url = $p->getAttribute('url');
                }
                if ($p->hasAttribute("DateAtt")) {
                    $Date = $p->getAttribute('DateAtt');
                }
                if ($p->hasAttribute("siteUrl")) {
                    $SiteUrl = $p->getAttribute('siteUrl');
                }
                if ($p->hasAttribute("causal")) {
                    $causal = $p->getAttribute('causal');
                }
            }
            $operations = null;
            $op = $dom->getElementsByTagName('operation');
            foreach ($op as $o) {
                $operations[] = $o->firstChild->nodeValue;
            }
            $lastPatch = utils::getLastPatchId($onPage);
            if ($lastPatch == false) {
                $lastPatch = 'none';
            }
            //            foreach ($operations as $operation) {
            //                $operation = operationToLogootOp($operation);
            //                if ($operation!=false && is_object($operation)) {
            //                    logootIntegrate($operation, $onPage);
            //                }
            //            }
            if (!in_array($onPage, $pages)) {
                $onPage1 = str_replace(array(' '), array('_'), $onPage);
                utils::writeAndFlush("<span style=\"margin-left:60px;\">Page: <A HREF=" . 'http://' . $wgServerName . $wgScriptPath . "/index.php/{$onPage1}>" . $onPage . "</A></span><br/>");
//.........這裏部分代碼省略.........
開發者ID:hala54,項目名稱:DSMW,代碼行數:101,代碼來源:IntegrationFunctions.php


注:本文中的utils::lcfirst方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。