Luis Felipe Schenone has uploaded a new change for review. https://gerrit.wikimedia.org/r/89132
Change subject: Uploading updated and improved version of GoogleDocViewer ...................................................................... Uploading updated and improved version of GoogleDocViewer GoogleDocViewer is an extension whose code is only available at https://www.mediawiki.org/wiki/Extension:Googledocviewer I downloaded the code, updated and improved it, and I'm now uploading it to Gerrit. Change-Id: I63a79aea78835fae58ca041131f4fcb192eb5cae --- A GoogleDocTag.body.php A GoogleDocTag.i18n.php A GoogleDocTag.php 3 files changed, 69 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GoogleDocTag refs/changes/32/89132/1 diff --git a/GoogleDocTag.body.php b/GoogleDocTag.body.php new file mode 100755 index 0000000..01887f7 --- /dev/null +++ b/GoogleDocTag.body.php @@ -0,0 +1,23 @@ +<?php + +class GoogleDocTag { + + public static function setParserHook( Parser $parser ) { + $parser->setHook( 'doc', 'GoogleDocTag::embedDoc' ); + $parser->setHook( 'googledoc', 'GoogleDocTag::embedDoc' ); + return true; + } + + public static function embedDoc( $input, array $args, Parser $parser, PPFrame $frame ) { + + if ( ! array_key_exists( 'id', $args ) ) { + return 'The id of the Google Doc is missing'; + } + $id = $args['id']; + + $width = array_key_exists( 'width', $args ) ? $args['width'] : '100%'; + $height = array_key_exists( 'height', $args ) ? $args['height'] : '1000px'; + + return '<iframe src="https://docs.google.com/document/d/' . $id . '" width="' . $width . '" height="' . $height . '" frameBorder="0"></iframe>'; + } +} \ No newline at end of file diff --git a/GoogleDocTag.i18n.php b/GoogleDocTag.i18n.php new file mode 100755 index 0000000..eb80b77 --- /dev/null +++ b/GoogleDocTag.i18n.php @@ -0,0 +1,30 @@ +<?php +/** + * Internationalisation for GoogleDocTag extension + * + * @file + * @ingroup Extensions + */ + +$messages = array(); + +/** English + * @author Luis Felipe Schenone + */ +$messages['en'] = array( + 'googledoctag-desc' => 'Adds <code><doc></code> tags for embedding Google Docs', +); + +/** Message documentation (Message documentation) + * @author Luis Felipe Schenone + */ +$messages['qqq'] = array( + 'googledoctag-desc' => '{{desc|name=GoogleDocTag|url=https://www.mediawiki.org/wiki/Extension:GoogleDocTag}}', +); + +/** Spanish (español) + * @author Luis Felipe Schenone + */ +$messages['es'] = array( + 'googledoctag-desc' => 'Añade la etiqueta <code><doc></code> para insertar Google Docs', +); \ No newline at end of file diff --git a/GoogleDocTag.php b/GoogleDocTag.php new file mode 100755 index 0000000..1071ab1 --- /dev/null +++ b/GoogleDocTag.php @@ -0,0 +1,16 @@ +<?php + +$wgExtensionCredits['parserhook'][] = array( + 'path' => __FILE__, + 'name' => 'GoogleDocTag', + 'descriptionmsg' => 'googledoctag-desc', + 'author' => array( 'Reddo', 'Luis Felipe Schenone' ), + 'version' => 0.3, + 'url' => 'http://www.mediawiki.org/wiki/Extension:GoogleDocTag', +); + +$wgExtensionMessagesFiles['GoogleDocTag'] = __DIR__ . '/GoogleDocTag.i18n.php'; + +$wgAutoloadClasses['GoogleDocTag'] = __DIR__ . '/GoogleDocTag.body.php'; + +$wgHooks['ParserFirstCallInit'][] = 'GoogleDocTag::setParserHook'; \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/89132 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I63a79aea78835fae58ca041131f4fcb192eb5cae Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/GoogleDocTag Gerrit-Branch: master Gerrit-Owner: Luis Felipe Schenone <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
