本文整理汇总了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;
}
示例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;
}
示例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/>");
//.........这里部分代码省略.........