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


PHP SpecialVersion::getSvnInfo方法代码示例

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


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

示例1: formatCredits

 function formatCredits($extension)
 {
     $out = '';
     $name = isset($extension['name']) ? $extension['name'] : '[no name]';
     if (isset($extension['path'])) {
         $svnInfo = SpecialVersion::getSvnInfo(dirname($extension['path']));
         $directoryRev = isset($svnInfo['directory-rev']) ? $svnInfo['directory-rev'] : null;
         $checkoutRev = isset($svnInfo['checkout-rev']) ? $svnInfo['checkout-rev'] : null;
         $viewvcUrl = isset($svnInfo['viewvc-url']) ? $svnInfo['viewvc-url'] : null;
     } else {
         $directoryRev = null;
         $checkoutRev = null;
         $viewvcUrl = null;
     }
     # Make main link (or just the name if there is no URL)
     if (isset($extension['url'])) {
         $mainLink = "[{$extension['url']} {$name}]";
     } else {
         $mainLink = $name;
     }
     # Version
     if (isset($extension['version'])) {
         $versionText = '<span class="mw-version-ext-version"><em>' . wfMsg('version-version', $extension['version']) . '</em></span> | ';
     } else {
         $versionText = '';
     }
     /*
     		if ( $checkoutRev ) {
     			$svnText = wfMsg( 'version-svn-revision', $directoryRev, $checkoutRev );
     			$svnText = isset( $viewvcUrl ) ? "[$viewvcUrl $svnText]" : $svnText;
     		} else {
     			$svnText = false;
     		}*/
     # Make description text
     $description = isset($extension['description']) ? $extension['description'] : '';
     if (isset($extension['descriptionmsg'])) {
         # Look for a localized description
         $descriptionMsg = $extension['descriptionmsg'];
         if (is_array($descriptionMsg)) {
             $descriptionMsgKey = $descriptionMsg[0];
             // Get the message key
             array_shift($descriptionMsg);
             // Shift out the message key to get the parameters only
             array_map("htmlspecialchars", $descriptionMsg);
             // For sanity
             $msg = wfMsg($descriptionMsgKey, $descriptionMsg);
         } else {
             $msg = wfMsg($descriptionMsg);
         }
         if (!wfEmptyMsg($descriptionMsg, $msg) && $msg != '') {
             $description = $msg;
         }
     }
     $author = isset($extension['author']) ? $extension['author'] : array();
     $extDescAuthor = "<td>{$description} <br />" . $versionText . $this->listToText((array) $author, false) . "</td>\n\t\t\t</tr>\n";
     $extNameVer = "<tr>\n\t\t\t\t<td><em>{$mainLink}</em></td>";
     return $extNameVer . $extDescAuthor;
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:58,代码来源:SpecialExtensionManagement.php

示例2: appendExtensions

 protected function appendExtensions($property)
 {
     global $wgExtensionCredits;
     $data = array();
     foreach ($wgExtensionCredits as $type => $extensions) {
         foreach ($extensions as $ext) {
             $ret = array();
             $ret['type'] = $type;
             if (isset($ext['name'])) {
                 $ret['name'] = $ext['name'];
             }
             if (isset($ext['description'])) {
                 $ret['description'] = $ext['description'];
             }
             if (isset($ext['descriptionmsg'])) {
                 // Can be a string or array( key, param1, param2, ... )
                 if (is_array($ext['descriptionmsg'])) {
                     $ret['descriptionmsg'] = $ext['descriptionmsg'][0];
                     $ret['descriptionmsgparams'] = array_slice($ext['descriptionmsg'], 1);
                     $this->getResult()->setIndexedTagName($ret['descriptionmsgparams'], 'param');
                 } else {
                     $ret['descriptionmsg'] = $ext['descriptionmsg'];
                 }
             }
             if (isset($ext['author'])) {
                 $ret['author'] = is_array($ext['author']) ? implode(', ', $ext['author']) : $ext['author'];
             }
             if (isset($ext['url'])) {
                 $ret['url'] = $ext['url'];
             }
             if (isset($ext['version'])) {
                 $ret['version'] = $ext['version'];
             } elseif (isset($ext['svn-revision']) && preg_match('/\\$(?:Rev|LastChangedRevision|Revision): *(\\d+)/', $ext['svn-revision'], $m)) {
                 $ret['version'] = 'r' . $m[1];
             }
             if (isset($ext['path'])) {
                 $extensionPath = dirname($ext['path']);
                 $gitInfo = new GitInfo($extensionPath);
                 $vcsVersion = $gitInfo->getHeadSHA1();
                 if ($vcsVersion !== false) {
                     $ret['vcs-system'] = 'git';
                     $ret['vcs-version'] = $vcsVersion;
                     $ret['vcs-url'] = $gitInfo->getHeadViewUrl();
                     $vcsDate = $gitInfo->getHeadCommitDate();
                     if ($vcsDate !== false) {
                         $ret['vcs-date'] = wfTimestamp(TS_ISO_8601, $vcsDate);
                     }
                 } else {
                     $svnInfo = SpecialVersion::getSvnInfo($extensionPath);
                     if ($svnInfo !== false) {
                         $ret['vcs-system'] = 'svn';
                         $ret['vcs-version'] = $svnInfo['checkout-rev'];
                         $ret['vcs-url'] = isset($svnInfo['viewvc-url']) ? $svnInfo['viewvc-url'] : '';
                     }
                 }
                 if (SpecialVersion::getExtLicenseFileName($extensionPath)) {
                     $ret['license-name'] = isset($ext['license-name']) ? $ext['license-name'] : '';
                     $ret['license'] = SpecialPage::getTitleFor('Version', "License/{$ext['name']}")->getLinkURL();
                 }
                 if (SpecialVersion::getExtAuthorsFileName($extensionPath)) {
                     $ret['credits'] = SpecialPage::getTitleFor('Version', "Credits/{$ext['name']}")->getLinkURL();
                 }
             }
             $data[] = $ret;
         }
     }
     $this->getResult()->setIndexedTagName($data, 'ext');
     return $this->getResult()->addValue('query', $property, $data);
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:69,代码来源:ApiQuerySiteinfo.php


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