MarkAHershberger has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/62449


Change subject: * Bump version * Clean up code * Standardize on “googlePlusOne” 
— more verbose but clearer than “google1” * Use tags instead of numbers for 
styles — matches the G+ site better * Allow substitution of plusone.js * Add 
review and ignore files
......................................................................

* Bump version
* Clean up code
* Standardize on “googlePlusOne” — more verbose but clearer than “google1”
* Use tags instead of numbers for styles — matches the G+ site better
* Allow substitution of plusone.js
* Add review and ignore files

Change-Id: I4347be117032c18a5558dd89c4981ae9a4e4f182
---
A .gitignore
A .gitreview
A GooglePlusOne.php
3 files changed, 81 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GooglePlusOne 
refs/changes/49/62449/1

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..54e43cb
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+*~
+.#*
+\#*#
diff --git a/.gitreview b/.gitreview
new file mode 100644
index 0000000..028923f
--- /dev/null
+++ b/.gitreview
@@ -0,0 +1,6 @@
+[gerrit]
+host=gerrit.wikimedia.org
+port=29418
+project=mediawiki/extensions/GooglePlusOne.git
+defaultbranch=master
+defaultrebase=0
diff --git a/GooglePlusOne.php b/GooglePlusOne.php
new file mode 100644
index 0000000..1915b37
--- /dev/null
+++ b/GooglePlusOne.php
@@ -0,0 +1,72 @@
+ <?php
+/**
+ * Google +1 extension
+ * Allows to insert the +1 button from Google
+ * Installation Instructions: http://www.mediawiki.org/wiki/Extension:Google_+1
+ *
+ * @file
+ * @package MediaWiki
+ * @subpackage Extensions
+ * @author José Miguel López Salvador
+ * @author Mark A. Hershberger
+ * @copyright © 2011 José Miguel López Salvador
+ * @licence GNU General Public Licence 3.0 or later
+ */
+
+$wgExtensionCredits['parserhook'][] = array(
+      'name' => 'Google +1',
+      'version' => '1.1',
+      'author' => 'José Miguel López Salvador, [http://hexmode.com Mark A. 
Hershberger]',
+      'url' => 'http://www.mediawiki.org/wiki/Extension:Google_+1',
+      'description' => 'Allows to insert the +1 button from Google'
+);
+
+$wgExtensionFunctions[] = "googlePlusOneExtension";
+
+
+if( !isset( $googlePlusOneJS ) ) {
+       $googlePlusOneJS = "https://apis.google.com/js/plusone.js";;
+}
+
+if( !isset( $googlePlusOneSiteUrl ) ) {
+       $googlePlusOneSiteUrl = $wgServer . $wgScriptPath;
+}
+
+function googlePlusOneExtension() {
+   global $wgParser;
+
+   $wgParser->setHook( "googlePlusOne", "renderGooglePlusOne" );
+   $wgParser->setHook( "google1", "renderGooglePlusOne" ); /* back compat for 
what may be in the wiki already */
+
+}
+
+function renderGooglePlusOne( $input, $argv ) {
+       global $wgJsMimeType, $googlePlusOneVersions, $googlePlusOneJS, 
$googlePlusOneSiteUrl;
+
+       $style = "standard";
+       if( isset( $argv['style'] ) ) {
+               $style = $argv['style'];
+       }
+
+       if( !isset( $googlePlusOneVersions ) ) {
+               $googlePlusOneVersions = array();
+
+               $i = 1;
+               foreach( array( "small", "medium", "standard", "tall" ) as 
$size ) {
+                       $googlePlusOneVersions[$size] = sprintf( '<script 
type="%s" src="%s"></script><g:plusone size="%s"></g:plusone>',
+                               $wgJsMimeType, $googlePlusOneJS, $size );
+                       $googlePlusOneVersions[$i++] = 
$googlePlusOneVersions[$size]; /* back-compat */
+               }
+
+               foreach( array( "small", "medium", "standard", "tall" ) as 
$size ) {
+                       $googlePlusOneVersions["$size-home"] = sprintf( 
'<script type="%s" src="%s"></script><g:plusone href="%s" '.
+                               'size="%s"></g:plusone>', $wgJsMimeType, 
$googlePlusOneJS, $googlePlusOneSiteUrl, $size );
+                       $googlePlusOneVersions[$i++] = 
$googlePlusOneVersions["$size-home"]; /* back-compat */
+               }
+       }
+
+       if( !isset( $googlePlusOneVersions[$style] ) ) {
+               $style = "standard";
+       }
+       return $googlePlusOneVersions[$style];
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/62449
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4347be117032c18a5558dd89c4981ae9a4e4f182
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GooglePlusOne
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger <mhershber...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to