* @param string $caller The method making this request, for profiling
* @param Profiler $profiler An instance of the profiler for profiling, or null
*/
- protected function __construct( $url, $options = array(), $caller = __METHOD__, $profiler = null ) {
+ protected function __construct(
+ $url, $options = array(), $caller = __METHOD__, $profiler = null
+ ) {
global $wgHTTPTimeout, $wgHTTPConnectTimeout;
$this->url = wfExpandUrl( $url, PROTO_HTTP );
}
/**
- * Returns an array with a 'capath' or 'cafile' key that is suitable to be merged into the 'ssl' sub-array of a
- * stream context options array. Uses the 'caInfo' option of the class if it is provided, otherwise uses the system
+ * Returns an array with a 'capath' or 'cafile' key
+ * that is suitable to be merged into the 'ssl' sub-array of
+ * a stream context options array.
+ * Uses the 'caInfo' option of the class if it is provided, otherwise uses the system
* default CA bundle if PHP supports that, or searches a few standard locations.
* @return array
* @throws DomainException
if ( $this->caInfo ) {
$certLocations = array( 'manual' => $this->caInfo );
} elseif ( version_compare( PHP_VERSION, '5.6.0', '<' ) ) {
+ // @codingStandardsIgnoreStart Generic.Files.LineLength
// Default locations, based on
// https://www.happyassassin.net/2015/01/12/a-note-about-ssltls-trusted-certificate-stores-and-platforms/
- // PHP 5.5 and older doesn't have any defaults, so we try to guess ourselves. PHP 5.6+ gets the CA location
- // from OpenSSL as long as it is not set manually, so we should leave capath/cafile empty there.
+ // PHP 5.5 and older doesn't have any defaults, so we try to guess ourselves.
+ // PHP 5.6+ gets the CA location from OpenSSL as long as it is not set manually,
+ // so we should leave capath/cafile empty there.
+ // @codingStandardsIgnoreEnd
$certLocations = array_filter( array(
getenv( 'SSL_CERT_DIR' ),
getenv( 'SSL_CERT_PATH' ),
}
/**
- * Custom error handler for dealing with fopen() errors. fopen() tends to fire multiple errors in succession, and the last one
- * is completely useless (something like "fopen: failed to open stream") so normal methods of handling errors programmatically
+ * Custom error handler for dealing with fopen() errors.
+ * fopen() tends to fire multiple errors in succession, and the last one
+ * is completely useless (something like "fopen: failed to open stream")
+ * so normal methods of handling errors programmatically
* like get_last_error() don't work.
*/
public function errorHandler( $errno, $errstr ) {
* @deprecated since 1.26 Use Language::getHumanTimestamp directly
*
* @param MWTimestamp|null $relativeTo The base timestamp to compare to (defaults to now)
- * @param User|null $user User the timestamp is being generated for (or null to use main context's user)
- * @param Language|null $lang Language to use to make the human timestamp (or null to use main context's language)
+ * @param User|null $user User the timestamp is being generated for
+ * (or null to use main context's user)
+ * @param Language|null $lang Language to use to make the human timestamp
+ * (or null to use main context's language)
* @return string Formatted timestamp
*/
- public function getHumanTimestamp( MWTimestamp $relativeTo = null, User $user = null, Language $lang = null ) {
+ public function getHumanTimestamp(
+ MWTimestamp $relativeTo = null, User $user = null, Language $lang = null
+ ) {
if ( $lang === null ) {
$lang = RequestContext::getMain()->getLanguage();
}
. "for help on installing the required components.";
$longHtml = <<<HTML
- MediaWiki now also has some external dependencies that need to be installed via
- composer or from a separate git repo. Please see
- <a href="https://www.mediawiki.org/wiki/Download_from_Git#Fetch_external_libraries">mediawiki.org</a>
- for help on installing the required components.
+ MediaWiki now also has some external dependencies that need to be installed via
+ composer or from a separate git repo. Please see
+ <a href="https://www.mediawiki.org/wiki/Download_from_Git#Fetch_external_libraries">mediawiki.org</a>
+ for help on installing the required components.
HTML;
wfGenericError( $type, $mwVersion, 'External dependencies', $shortText, $longText, $longHtml );
protected function checkContentModel() {
global $wgContentHandlerUseDB;
- $title = $this->getTitle(); // note: may return null for revisions that have not yet been inserted.
+ // Note: may return null for revisions that have not yet been inserted
+ $title = $this->getTitle();
$model = $this->getContentModel();
$format = $this->getContentFormat();
}
protected function getExamplesMessages() {
+ // @codingStandardsIgnoreStart Generic.Files.LineLength
return array(
'action=block&user=192.0.2.5&expiry=3%20days&reason=First%20strike&token=123ABC'
=> 'apihelp-block-example-ip-simple',
'action=block&user=Vandal&expiry=never&reason=Vandalism&nocreate=&autoblock=&noemail=&token=123ABC'
=> 'apihelp-block-example-user-complex',
);
+ // @codingStandardsIgnoreEnd
}
public function getHelpUrls() {
$lang = $langObj->getCode();
$customisedMessages = AllMessagesTablePager::getCustomisedStatuses(
- array_map( array( $langObj, 'ucfirst' ), $messages_target ), $lang, $lang != $wgContLang->getCode() );
+ array_map(
+ array( $langObj, 'ucfirst' ),
+ $messages_target
+ ),
+ $lang,
+ $lang != $wgContLang->getCode()
+ );
$customised = $params['customised'] === 'modified';
}
# at least one character of a host name (embeds EXT_LINK_URL_CLASS)
const EXT_LINK_ADDR = '(?:[0-9.]+|\\[(?i:[0-9a-f:.]+)\\]|[^][<>"\\x00-\\x20\\x7F\p{Zs}])';
# RegExp to make image URLs (embeds IPv6 part of EXT_LINK_ADDR)
+ // @codingStandardsIgnoreStart Generic.Files.LineLength
const EXT_IMAGE_REGEX = '/^(http:\/\/|https:\/\/)((?:\\[(?i:[0-9a-f:.]+)\\])?[^][<>"\\x00-\\x20\\x7F\p{Zs}]+)
\\/([A-Za-z0-9_.,~%\\-+&;#*?!=()@\\x80-\\xFF]+)\\.((?i)gif|png|jpg|jpeg)$/Sxu';
+ // @codingStandardsIgnoreEnd
# Regular expression for a non-newline space
const SPACE_NOT_NL = '(?:\t| |&\#0*160;|&\#[Xx]0*[Aa]0;|\p{Zs})';
}
$conn = $status->value;
+ // @codingStandardsIgnoreStart Generic.Files.LineLength
static $script =
<<<LUA
local kSlots,kSlotsNextRelease,kWakeup,kWaiting = unpack(KEYS)
end
return 1
LUA;
+ // @codingStandardsIgnoreEnd
+
try {
$conn->luaEval( $script,
array(
} elseif ( $field === 'am_title' ) {
return array( 'class' => $field );
} else {
- return array( 'lang' => wfBCP47( $this->langcode ), 'dir' => $this->lang->getDir(), 'class' => $field );
+ return array(
+ 'lang' => wfBCP47( $this->langcode ),
+ 'dir' => $this->lang->getDir(),
+ 'class' => $field
+ );
}
}
$logId = $logEntry->insert();
$logEntry->publish( $logId );
- $targetLink = Linker::link( $targetTitle, $targetTitle->getPrefixedText(), array(), array( 'redirect' => 'no' ) );
+ $targetLink = Linker::link(
+ $targetTitle,
+ $targetTitle->getPrefixedText(),
+ array(),
+ array( 'redirect' => 'no' )
+ );
$this->getOutput()->addWikiMsg( $this->msg( 'mergehistory-done' )
->rawParams( $targetLink )
# image/svg, text/xml, application/xml, and text/html, which can contain scripts
if ( $stripped == 'href' && strncasecmp( 'data:', $value, 5 ) === 0 ) {
// rfc2397 parameters. This is only slightly slower than (;[\w;]+)*.
+ // @codingStandardsIgnoreStart Generic.Files.LineLength
$parameters = '(?>;[a-zA-Z0-9\!#$&\'*+.^_`{|}~-]+=(?>[a-zA-Z0-9\!#$&\'*+.^_`{|}~-]+|"(?>[\0-\x0c\x0e-\x21\x23-\x5b\x5d-\x7f]+|\\\\[\0-\x7f])*"))*(?:;base64)?';
+ // @codingStandardsIgnoreEnd
+
if ( !preg_match( "!^data:\s*image/(gif|jpeg|jpg|png)$parameters,!i", $value ) ) {
wfDebug( __METHOD__ . ": Found href to unwhitelisted data: uri "
. "\"<$strippedElement '$attrib'='$value'...\" in uploaded file.\n" );