本文整理汇总了PHP中BitmapHandler::canRotate方法的典型用法代码示例。如果您正苦于以下问题:PHP BitmapHandler::canRotate方法的具体用法?PHP BitmapHandler::canRotate怎么用?PHP BitmapHandler::canRotate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitmapHandler
的用法示例。
在下文中一共展示了BitmapHandler::canRotate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getConfig
/**
* @param $context ResourceLoaderContext
* @return array
*/
protected function getConfig($context)
{
global $wgLoadScript, $wgScript, $wgStylePath, $wgScriptExtension, $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgVariantArticlePath, $wgActionPaths, $wgUseAjax, $wgVersion, $wgEnableAPI, $wgEnableWriteAPI, $wgDBname, $wgEnableMWSuggest, $wgSitename, $wgFileExtensions, $wgExtensionAssetsPath, $wgCookiePrefix, $wgResourceLoaderMaxQueryLength;
$mainPage = Title::newMainPage();
/**
* Namespace related preparation
* - wgNamespaceIds: Key-value pairs of all localized, canonical and aliases for namespaces.
* - wgCaseSensitiveNamespaces: Array of namespaces that are case-sensitive.
*/
$namespaceIds = $wgContLang->getNamespaceIds();
$caseSensitiveNamespaces = array();
foreach (MWNamespace::getCanonicalNamespaces() as $index => $name) {
$namespaceIds[$wgContLang->lc($name)] = $index;
if (!MWNamespace::isCapitalized($index)) {
$caseSensitiveNamespaces[] = $index;
}
}
// Build list of variables
$vars = array('wgLoadScript' => $wgLoadScript, 'debug' => $context->getDebug(), 'skin' => $context->getSkin(), 'stylepath' => $wgStylePath, 'wgUrlProtocols' => wfUrlProtocols(), 'wgArticlePath' => $wgArticlePath, 'wgScriptPath' => $wgScriptPath, 'wgScriptExtension' => $wgScriptExtension, 'wgScript' => $wgScript, 'wgVariantArticlePath' => $wgVariantArticlePath, 'wgActionPaths' => (object) $wgActionPaths, 'wgServer' => $wgServer, 'wgUserLanguage' => $context->getLanguage(), 'wgContentLanguage' => $wgContLang->getCode(), 'wgVersion' => $wgVersion, 'wgEnableAPI' => $wgEnableAPI, 'wgEnableWriteAPI' => $wgEnableWriteAPI, 'wgDefaultDateFormat' => $wgContLang->getDefaultDateFormat(), 'wgMonthNames' => $wgContLang->getMonthNamesArray(), 'wgMonthNamesShort' => $wgContLang->getMonthAbbreviationsArray(), 'wgMainPageTitle' => $mainPage ? $mainPage->getPrefixedText() : null, 'wgFormattedNamespaces' => $wgContLang->getFormattedNamespaces(), 'wgNamespaceIds' => $namespaceIds, 'wgSiteName' => $wgSitename, 'wgFileExtensions' => array_values($wgFileExtensions), 'wgDBname' => $wgDBname, 'wgFileCanRotate' => BitmapHandler::canRotate(), 'wgAvailableSkins' => Skin::getSkinNames(), 'wgExtensionAssetsPath' => $wgExtensionAssetsPath, 'wgCookiePrefix' => $wgCookiePrefix, 'wgResourceLoaderMaxQueryLength' => $wgResourceLoaderMaxQueryLength, 'wgCaseSensitiveNamespaces' => $caseSensitiveNamespaces, 'wgSassParams' => SassUtil::getSassSettings());
if ($wgUseAjax && $wgEnableMWSuggest) {
$vars['wgMWSuggestTemplate'] = SearchEngine::getMWSuggestTemplate();
}
wfRunHooks('ResourceLoaderGetConfigVars', array(&$vars));
return $vars;
}
示例2: testRotationRendering
/**
*
* @dataProvider providerFiles
*/
function testRotationRendering($name, $type, $info, $thumbs)
{
if (!BitmapHandler::canRotate()) {
$this->markTestSkipped("This test needs a rasterizer that can auto-rotate.");
}
foreach ($thumbs as $size => $out) {
if (preg_match('/^(\\d+)px$/', $size, $matches)) {
$params = array('width' => $matches[1]);
} elseif (preg_match('/^(\\d+)x(\\d+)px$/', $size, $matches)) {
$params = array('width' => $matches[1], 'height' => $matches[2]);
} else {
throw new MWException('bogus test data format ' . $size);
}
$file = $this->localFile($name, $type);
$thumb = $file->transform($params, File::RENDER_NOW);
$this->assertEquals($out[0], $thumb->getWidth(), "{$name}: thumb reported width check for {$size}");
$this->assertEquals($out[1], $thumb->getHeight(), "{$name}: thumb reported height check for {$size}");
$gis = getimagesize($thumb->getPath());
if ($out[0] > $info['width']) {
// Physical image won't be scaled bigger than the original.
$this->assertEquals($info['width'], $gis[0], "{$name}: thumb actual width check for {$size}");
$this->assertEquals($info['height'], $gis[1], "{$name}: thumb actual height check for {$size}");
} else {
$this->assertEquals($out[0], $gis[0], "{$name}: thumb actual width check for {$size}");
$this->assertEquals($out[1], $gis[1], "{$name}: thumb actual height check for {$size}");
}
}
}
示例3: getConfig
/**
* @param ResourceLoaderContext $context
* @return array
*/
protected function getConfig($context)
{
$hash = $context->getHash();
if (isset($this->configVars[$hash])) {
return $this->configVars[$hash];
}
global $wgLoadScript, $wgScript, $wgStylePath, $wgScriptExtension, $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgVariantArticlePath, $wgActionPaths, $wgVersion, $wgEnableAPI, $wgEnableWriteAPI, $wgDBname, $wgSitename, $wgFileExtensions, $wgExtensionAssetsPath, $wgCookiePrefix, $wgResourceLoaderMaxQueryLength, $wgResourceLoaderStorageEnabled, $wgResourceLoaderStorageVersion, $wgSearchType;
$mainPage = Title::newMainPage();
/**
* Namespace related preparation
* - wgNamespaceIds: Key-value pairs of all localized, canonical and aliases for namespaces.
* - wgCaseSensitiveNamespaces: Array of namespaces that are case-sensitive.
*/
$namespaceIds = $wgContLang->getNamespaceIds();
$caseSensitiveNamespaces = array();
foreach (MWNamespace::getCanonicalNamespaces() as $index => $name) {
$namespaceIds[$wgContLang->lc($name)] = $index;
if (!MWNamespace::isCapitalized($index)) {
$caseSensitiveNamespaces[] = $index;
}
}
// Build list of variables
$vars = array('wgLoadScript' => $wgLoadScript, 'debug' => $context->getDebug(), 'skin' => $context->getSkin(), 'stylepath' => $wgStylePath, 'wgUrlProtocols' => wfUrlProtocols(), 'wgArticlePath' => $wgArticlePath, 'wgScriptPath' => $wgScriptPath, 'wgScriptExtension' => $wgScriptExtension, 'wgScript' => $wgScript, 'wgSearchType' => $wgSearchType, 'wgVariantArticlePath' => $wgVariantArticlePath, 'wgActionPaths' => (object) $wgActionPaths, 'wgServer' => $wgServer, 'wgUserLanguage' => $context->getLanguage(), 'wgContentLanguage' => $wgContLang->getCode(), 'wgVersion' => $wgVersion, 'wgEnableAPI' => $wgEnableAPI, 'wgEnableWriteAPI' => $wgEnableWriteAPI, 'wgMainPageTitle' => $mainPage->getPrefixedText(), 'wgFormattedNamespaces' => $wgContLang->getFormattedNamespaces(), 'wgNamespaceIds' => $namespaceIds, 'wgContentNamespaces' => MWNamespace::getContentNamespaces(), 'wgSiteName' => $wgSitename, 'wgFileExtensions' => array_values(array_unique($wgFileExtensions)), 'wgDBname' => $wgDBname, 'wgFileCanRotate' => BitmapHandler::canRotate(), 'wgAvailableSkins' => Skin::getSkinNames(), 'wgExtensionAssetsPath' => $wgExtensionAssetsPath, 'wgCookiePrefix' => $wgCookiePrefix, 'wgResourceLoaderMaxQueryLength' => $wgResourceLoaderMaxQueryLength, 'wgCaseSensitiveNamespaces' => $caseSensitiveNamespaces, 'wgLegalTitleChars' => Title::convertByteClassToUnicodeClass(Title::legalChars()), 'wgResourceLoaderStorageVersion' => $wgResourceLoaderStorageVersion, 'wgResourceLoaderStorageEnabled' => $wgResourceLoaderStorageEnabled);
wfRunHooks('ResourceLoaderGetConfigVars', array(&$vars));
$this->configVars[$hash] = $vars;
return $this->configVars[$hash];
}
示例4: foreach
if ( !isset( $wgLocalFileRepo['backend'] ) ) {
$wgLocalFileRepo['backend'] = $wgLocalFileRepo['name'] . '-backend';
}
foreach ( $wgForeignFileRepos as &$repo ) {
if ( !isset( $repo['directory'] ) && $repo['class'] === 'ForeignAPIRepo' ) {
$repo['directory'] = $wgUploadDirectory; // b/c
}
if ( !isset( $repo['backend'] ) ) {
$repo['backend'] = $repo['name'] . '-backend';
}
}
unset( $repo ); // no global pollution; destroy reference
if ( is_null( $wgEnableAutoRotation ) ) {
// Only enable auto-rotation when the bitmap handler can rotate
$wgEnableAutoRotation = BitmapHandler::canRotate();
}
if ( $wgRCFilterByAge ) {
# # Trim down $wgRCLinkDays so that it only lists links which are valid
# # as determined by $wgRCMaxAge.
# # Note that we allow 1 link higher than the max for things like 56 days but a 60 day link.
sort( $wgRCLinkDays );
for ( $i = 0; $i < count( $wgRCLinkDays ); $i++ ) {
if ( $wgRCLinkDays[$i] >= $wgRCMaxAge / ( 3600 * 24 ) ) {
$wgRCLinkDays = array_slice( $wgRCLinkDays, 0, $i + 1, false );
break;
}
}
}
示例5: autoRotateEnabled
/**
* @see $wgEnableAutoRotation
* @return bool Whether auto rotation is enabled
*/
public static function autoRotateEnabled()
{
global $wgEnableAutoRotation;
if ($wgEnableAutoRotation === null) {
// Only enable auto-rotation when the bitmap handler can rotate
$wgEnableAutoRotation = BitmapHandler::canRotate();
}
return $wgEnableAutoRotation;
}
示例6: getConfig
/**
* @param $context ResourceLoaderContext
* @return array
*/
protected function getConfig( $context ) {
global $wgLoadScript, $wgScript, $wgStylePath, $wgScriptExtension,
$wgArticlePath, $wgScriptPath, $wgServer, $wgContLang,
$wgVariantArticlePath, $wgActionPaths, $wgVersion,
$wgEnableAPI, $wgEnableWriteAPI, $wgDBname,
$wgSitename, $wgFileExtensions, $wgExtensionAssetsPath,
$wgCookiePrefix, $wgResourceLoaderMaxQueryLength;
$mainPage = Title::newMainPage();
/**
* Namespace related preparation
* - wgNamespaceIds: Key-value pairs of all localized, canonical and aliases for namespaces.
* - wgCaseSensitiveNamespaces: Array of namespaces that are case-sensitive.
*/
$namespaceIds = $wgContLang->getNamespaceIds();
$caseSensitiveNamespaces = array();
foreach ( MWNamespace::getCanonicalNamespaces() as $index => $name ) {
$namespaceIds[$wgContLang->lc( $name )] = $index;
if ( !MWNamespace::isCapitalized( $index ) ) {
$caseSensitiveNamespaces[] = $index;
}
}
// Build list of variables
$vars = array(
'wgLoadScript' => $wgLoadScript,
'debug' => $context->getDebug(),
'skin' => $context->getSkin(),
'stylepath' => $wgStylePath,
'wgUrlProtocols' => wfUrlProtocols(),
'wgArticlePath' => $wgArticlePath,
'wgScriptPath' => $wgScriptPath,
'wgScriptExtension' => $wgScriptExtension,
'wgScript' => $wgScript,
'wgVariantArticlePath' => $wgVariantArticlePath,
// Force object to avoid "empty" associative array from
// becoming [] instead of {} in JS (bug 34604)
'wgActionPaths' => (object)$wgActionPaths,
'wgServer' => $wgServer,
'wgUserLanguage' => $context->getLanguage(),
'wgContentLanguage' => $wgContLang->getCode(),
'wgVersion' => $wgVersion,
'wgEnableAPI' => $wgEnableAPI,
'wgEnableWriteAPI' => $wgEnableWriteAPI,
'wgMainPageTitle' => $mainPage->getPrefixedText(),
'wgFormattedNamespaces' => $wgContLang->getFormattedNamespaces(),
'wgNamespaceIds' => $namespaceIds,
'wgSiteName' => $wgSitename,
'wgFileExtensions' => array_values( array_unique( $wgFileExtensions ) ),
'wgDBname' => $wgDBname,
// This sucks, it is only needed on Special:Upload, but I could
// not find a way to add vars only for a certain module
'wgFileCanRotate' => BitmapHandler::canRotate(),
'wgAvailableSkins' => Skin::getSkinNames(),
'wgExtensionAssetsPath' => $wgExtensionAssetsPath,
// MediaWiki sets cookies to have this prefix by default
'wgCookiePrefix' => $wgCookiePrefix,
'wgResourceLoaderMaxQueryLength' => $wgResourceLoaderMaxQueryLength,
'wgCaseSensitiveNamespaces' => $caseSensitiveNamespaces,
'wgLegalTitleChars' => Title::convertByteClassToUnicodeClass( Title::legalChars() ),
);
wfRunHooks( 'ResourceLoaderGetConfigVars', array( &$vars ) );
return $vars;
}