Luis Felipe Schenone has submitted this change and it was merged.

Change subject: Update because of an update by Yotpo
......................................................................


Update because of an update by Yotpo

Change-Id: I56c337b68929091d679947b89faafb8593d65f75
---
M YotpoReviews.body.php
M YotpoReviews.php
2 files changed, 14 insertions(+), 17 deletions(-)

Approvals:
  Luis Felipe Schenone: Verified; Looks good to me, approved



diff --git a/YotpoReviews.body.php b/YotpoReviews.body.php
index 87577f5..83fac50 100644
--- a/YotpoReviews.body.php
+++ b/YotpoReviews.body.php
@@ -9,13 +9,12 @@
 
        public static function addYotpoScript( &$data ) {
                global $wgYotpoAppKey;
-               $data .= '<script src="//www.yotpo.com/js/yQuery.js"></script>';
-               $data .= '<script>var yotpo_app_key = "' . $wgYotpoAppKey . 
'";</script>';
+               $data .= '<script type="text/javascript">(function e(){var 
e=document.createElement("script");e.type="text/javascript",e.async=true,e.src="//staticw2.yotpo.com/'
 . $wgYotpoAppKey . '/widget.js";var 
t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)})();</script>';
                return true;
        }
 
        public static function renderReviews( $input, array $args, Parser 
$parser, PPFrame $frame ) {
-               global $wgLogo, $wgServer, $wgYotpoAppKey;
+               global $wgTitle, $wgLogo, $wgServer, $wgYotpoAppKey;
 
                $width = '100%'; //Default
                if ( array_key_exists( 'width', $args ) ) {
@@ -41,18 +40,17 @@
                        $margin = '0 auto 0 auto';
                }
 
-               $title = $parser->getTitle();
+               $float = 'none'; //Default
+               if ( array_key_exists( 'float', $args ) ) {
+                       $float = $args['float'];
+               }
 
-               $data_app_key = $wgYotpoAppKey;
-               $data_domain = $wgServer;
-               $data_product_id = $title->getDBKey();
-               $data_product_models = '';
-               $data_name = $title->getText();
-               $data_url = $title->getFullURL();
+               $data_product_id = $wgTitle->getDBKey();
+               $data_name = $wgTitle->getText();
+               $data_url = $wgTitle->getFullURL();
                $data_image_url = '';
                $data_description = '';
-               $data_bread_crumbs = '';
 
-               return '<div class="yotpo reviews" style="margin:' . $margin . 
'; width:' . $width . '; height:' . $height . ';" data-appkey="' .$data_app_key 
. '" data-domain="' . $data_domain . '" data-product-id="' . $data_product_id . 
'" data-product-models="' . $data_product_models . '" data-name="' . $data_name 
. '" data-url="' . $data_url . '" data-image-url="' . $data_image_url . '" 
data-description="' . $data_description . '" data-bread-crumbs="' . 
$data_bread_crumbs . '"></div>';
+               return '<div style="float:' . $float . '; margin:' . $margin . 
'; width:' . $width . '; height:' . $height . ';" class="yotpo 
yotpo-main-widget" data-product-id="' . $data_product_id . '" data-name="' . 
$data_name . '" data-url="' . $data_url . '" data-image-url="' . 
$data_image_url . '" data-description="' . $data_description . '"></div>';
        }
 }
\ No newline at end of file
diff --git a/YotpoReviews.php b/YotpoReviews.php
index 07934e5..c5a0abe 100644
--- a/YotpoReviews.php
+++ b/YotpoReviews.php
@@ -3,15 +3,14 @@
 $wgExtensionCredits['parserhook'][] = array(
        'path'           => __FILE__,
        'name'           => 'YotpoReviews',
-       'descriptionmsg' => 'yotporeviews-desc',
-       'version'        => '0.2.0',
+       'descriptionmsg' => 'yotpo-reviews-desc',
+       'version'        => 0.2,
        'author'         => 'Luis Felipe Schenone',
-       'url'            => 
'https://www.mediawiki.org/wiki/Extension:YotpoReviews'
+       'url'            => 
'http://www.mediawiki.org/wiki/Extension:YotpoReviews'
 );
 
-$wgMessagesDirs['YotpoReviews'] = __DIR__ . '/i18n';
 $wgExtensionMessagesFiles['YotpoReviews'] = __DIR__ . '/YotpoReviews.i18n.php';
 $wgAutoloadClasses['YotpoReviews'] = __DIR__ . '/YotpoReviews.body.php';
 
 $wgHooks['ParserFirstCallInit'][] = 'YotpoReviews::setParserHook';
-$wgHooks['SkinAfterContent'][] = 'YotpoReviews::addYotpoScript';
+$wgHooks['SkinAfterContent'][] = 'YotpoReviews::addYotpoScript';
\ No newline at end of file

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I56c337b68929091d679947b89faafb8593d65f75
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/YotpoReviews
Gerrit-Branch: master
Gerrit-Owner: Luis Felipe Schenone <[email protected]>
Gerrit-Reviewer: Luis Felipe Schenone <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to