Commit 5df042eb authored by Alexia's avatar Alexia

Merge into compat.

parents c562f81d 6d0cc5ae
......@@ -34,7 +34,7 @@ class PDFEmbed {
* @param object PPFrame object.
* @return string HTML
*/
static public function generateTag($file, $args = array(), Parser $parser, PPFrame $frame) {
static public function generateTag($file, $args = [], Parser $parser, PPFrame $frame) {
global $pdfEmbed, $wgRequest, $wgUser;
$parser->disableCache();
......@@ -62,8 +62,8 @@ class PDFEmbed {
$file = wfFindFile(Title::newFromText($file));
$width = ($args['width'] > 0 ? intval($args['width']) : intval($pdfEmbed['width']));
$height = ($args['height'] > 0 ? intval($args['height']) : intval($pdfEmbed['height']));
$width = (array_key_exists('width', $args) ? intval($args['width']) : intval($pdfEmbed['width']));
$height = (array_key_exists('height', $args) ? intval($args['height']) : intval($pdfEmbed['height']));
if ($file !== false) {
return self::embed($file, $width, $height);
......@@ -73,9 +73,9 @@ class PDFEmbed {
}
/**
* Returns a standard error message.
* Returns a HTML object as string.
*
* @access public
* @access private
* @param object File object.
* @param integer Width of the object.
* @param integer Height of the object.
......@@ -88,7 +88,7 @@ class PDFEmbed {
/**
* Returns a standard error message.
*
* @access public
* @access private
* @param string Error message key to display.
* @return string HTML error message.
*/
......
<?php
/**
* PDFEmbed
* PDFEmbed Language Strings
* This is a backwards-compatibility shim, generated by:
* https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php
*
* @author Alexia E. Smith
* @license LGPLv3 http://opensource.org/licenses/lgpl-3.0.html
* @package PDFEmbed
* @link http://www.mediawiki.org/wiki/Extension:PDFEmbed
* Beginning with MediaWiki 1.23, translation strings are stored in json files,
* and the EXTENSION.i18n.php file only exists to provide compatibility with
* older releases of MediaWiki. For more information about this migration, see:
* https://www.mediawiki.org/wiki/Requests_for_comment/Localisation_format
*
**/
* This shim maintains compatibility back to MediaWiki 1.17.
*/
$messages = array();
if ( !function_exists( 'wfJsonI18nShim3c31c114726db32d' ) ) {
function wfJsonI18nShim3c31c114726db32d( $cache, $code, &$cachedData ) {
$codeSequence = array_merge( array( $code ), $cachedData['fallbackSequence'] );
foreach ( $codeSequence as $csCode ) {
$fileName = dirname( __FILE__ ) . "/i18n/$csCode.json";
if ( is_readable( $fileName ) ) {
$data = FormatJson::decode( file_get_contents( $fileName ), true );
foreach ( array_keys( $data ) as $key ) {
if ( $key === '' || $key[0] === '@' ) {
unset( $data[$key] );
}
}
$cachedData['messages'] = array_merge( $data, $cachedData['messages'] );
}
$messages['en'] = array(
'pdfembed' => 'PDF Embed',
'pdfembed_description' => 'Media handler extension for PDF files.',
'embed_pdf_no_permission' => 'You do not have permission to embed PDF files.',
'embed_pdf_blank_file' => 'The URL or file path given to embed a PDF is blank.',
'embed_pdf_invalid_user' => 'An invalid user was specified to permission testing to embed this PDF.',
'pdf_not_supported' => 'The PDF file did not load properly or your web browser does not support viewing PDF files. Download <a href="$1">$2</a> directly to your device.'
);
$magicWords = array();
$magicWords['en'] = array();
$cachedData['deps'][] = new FileDependency( $fileName );
}
return true;
}
?>
\ No newline at end of file
$GLOBALS['wgHooks']['LocalisationCacheRecache'][] = 'wfJsonI18nShim3c31c114726db32d';
}
......@@ -13,25 +13,26 @@
/******************************************/
/* Credits */
/******************************************/
$credits = array(
$credits = [
'path' => __FILE__,
'name' => 'PDFEmbed',
'author' => 'Alexia E. Smith',
'url' => 'http://www.mediawiki.org/wiki/Extension:PDFEmbed',
'descriptionmsg' => 'pdfembed_description',
'version' => '1.0'
);
'version' => '1.1.1'
];
$wgExtensionCredits['parserhook'][] = $credits;
/******************************************/
/* Language Strings, Page Aliases, Hooks */
/******************************************/
$extDir = dirname(__FILE__);
$extDir = __DIR__;
$wgAvailableRights[] = 'embed_pdf';
$wgExtensionMessagesFiles['PDFEmbed'] = "{$extDir}/PDFEmbed.i18n.php";
$wgMessagesDirs['PDFEmbed'] = "{$extDir}/i18n";
$wgAutoloadClasses['PDFEmbed'] = "{$extDir}/PDFEmbed.hooks.php";
$wgAutoloadClasses['PDFHandler'] = "{$extDir}/classes/PDFHandler.class.php";
......
......@@ -34,7 +34,7 @@ class PDFHandler {
* @param object PPFrame object.
* @return string HTML
*/
static public function generateTag($file, $args = array(), Parser $parser, PPFrame $frame) {
static public function generateTag($file, $args = [], Parser $parser, PPFrame $frame) {
global $pdfEmbed, $wgUser;
$parser->disableCache();
......
{
"@metadata": {
"authors": [
"Kghbln"
]
},
"embed_pdf_no_permission": "Sie sind nicht berechtigt PDF-Dateien einzubetten."
}
{
"@metadata": {
"authors": [
"Messerjokke79",
"Kghbln"
]
},
"pdfembed": "PDF Embed",
"pdfembed_description": "Ermöglicht das Einbetten von PDF-Dateien",
"embed_pdf_no_permission": "Du bist nicht berechtigt PDF-Dateien einzubetten.",
"embed_pdf_blank_file": "Die URL bzw. der Dateipfad zum Einbetten der PDF-Datei ist leer.",
"embed_pdf_invalid_file": "Die URL bzw. der Dateipfad existieren nicht.",
"embed_pdf_invalid_user": "Ein ungültiger Benutzer wurde angegeben.",
"pdf_not_supported": "Die PDF-Datei wurde entweder nicht richtig geladen oder der verwendete Browser kann keine PDF-Dateien anzeigen. Die PDF-Datei <a href=\"$1\">$2</a> herunterladen."
}
{
"@metadata": {
"authors": []
},
"pdfembed": "PDF Embed",
"pdfembed_description": "Media handler extension for PDF files.",
"embed_pdf_no_permission": "You do not have permission to embed PDF files.",
"embed_pdf_blank_file": "The URL or file path given to embed a PDF is blank.",
"embed_pdf_invalid_file": "The URL or file path given does not exist.",
"embed_pdf_invalid_user": "An invalid user was specified to permission testing to embed this PDF.",
"pdf_not_supported": "The PDF file did not load properly or your web browser does not support viewing PDF files. Download <a href=\"$1\">$2</a> directly to your device."
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment