[MediaWiki-commits] [Gerrit] cherry-pick from master - change (mediawiki...BlueSpiceExtensions)

2015-09-10 Thread Tweichart (Code Review)
Tweichart has uploaded a new change for review.

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

Change subject: cherry-pick from master
..

cherry-pick from master

Change-Id: Ie64f2abb98d8d58d022d5226d2ddbd9c45d7262c
---
M UniversalExport/includes/UniversalExportHelper.class.php
1 file changed, 25 insertions(+), 26 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions 
refs/changes/79/237379/1

diff --git a/UniversalExport/includes/UniversalExportHelper.class.php 
b/UniversalExport/includes/UniversalExportHelper.class.php
index c569902..598858f 100644
--- a/UniversalExport/includes/UniversalExportHelper.class.php
+++ b/UniversalExport/includes/UniversalExportHelper.class.php
@@ -103,33 +103,33 @@
 
//HINT: http://calibre-ebook.com/user_manual/xpath.html
$oBodyContentXPath = new DOMXPath( $oPageDOM );
-   $oHeadingElements  = $oBodyContentXPath->query(
+   $oHeadingElements = $oBodyContentXPath->query(
"//*[contains(@class, 'firstHeading') "
-   ."or contains(@class, 'mw-headline') "
-   ."and not(contains(@class, 'mw-headline-'))]"
+   . "or contains(@class, 'mw-headline') "
+   . "and not(contains(@class, 'mw-headline-'))]"
);
 
//By convention the first  in the PageDOM is the title of 
the page
-   $oPageTitleBookmarkElement= $oBookmarksDOM->createElement( 
'bookmark' );
-   $oPageTitleHeadingElement = $oHeadingElements->item( 0 );
+   $oPageTitleBookmarkElement = $oBookmarksDOM->createElement( 
'bookmark' );
+   $oPageTitleHeadingElement = $oHeadingElements->item( 0 );
$sPageTitleHeadingTextContent = trim( 
$oPageTitleHeadingElement->textContent );
 
//By convention previousSibling is an Anchor-Tag (see 
BsPageContentProvider)
//TODO: check for null
$sPageTitleHeadingJumpmark = 
self::findPreviousDOMElementSibling( $oPageTitleHeadingElement, 'a' 
)->getAttribute( 'name' );
$oPageTitleBookmarkElement->setAttribute( 'name', 
$sPageTitleHeadingTextContent );
-   $oPageTitleBookmarkElement->setAttribute( 'href', 
'#'.$sPageTitleHeadingJumpmark );
+   $oPageTitleBookmarkElement->setAttribute( 'href', '#' . 
$sPageTitleHeadingJumpmark );
 
//Adapt MediaWiki TOC #1
$oTocTableElement = $oBodyContentXPath->query( "//*[@id='toc']" 
);
-   $oTableOfContentsAnchors = array();
+   $oTableOfContentsAnchors = array ();
if ( $oTocTableElement->length > 0 ) { //Is a TOC available?
// HINT: 
http://de.selfhtml.org/xml/darstellung/xpathsyntax.htm#position_bedingungen
// - recursive descent operator = getElementsByTag
$oTableOfContentsAnchors = $oBodyContentXPath->query( 
"//*[@id='toc']//a" );
-   $oTocTableElement->item( 0 )->setAttribute( 'id', 
'toc-'.$sPageTitleHeadingJumpmark ); //make id unique
-   $oTocTitleElement = $oBodyContentXPath->query( 
"//*[@id='toctitle']" )->item(0);
-   $oTocTitleElement->setAttribute( 'id', 
'toctitle-'.$sPageTitleHeadingJumpmark ); //make id unique;
+   $oTocTableElement->item( 0 )->setAttribute( 'id', 
'toc-' . $sPageTitleHeadingJumpmark ); //make id unique
+   $oTocTitleElement = $oBodyContentXPath->query( 
"//*[@id='toctitle']" )->item( 0 );
+   $oTocTitleElement->setAttribute( 'id', 'toctitle-' . 
$sPageTitleHeadingJumpmark ); //make id unique;
$oTocTitleElement->setAttribute( 'class', 'toctitle' );
}
 
@@ -137,31 +137,30 @@
$oParentBookmark = $oPageTitleBookmarkElement;
$iParentLevel = 0;
$aHeadingLevels = array_flip(
-   array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' )
+   array ( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' )
);
for ( $i = 1; $i < $oHeadingElements->length; $i++ ) {
-   $oHeadingElement = $oHeadingElements->item( $i );
+   $oHeadingElement = $oHeadingElements->item( $i );
$sHeadingTextContent = trim( 
$oHeadingElement->textContent );
//In $sPageTitleHeadingJumpmark there is the PageTitle 
AND the RevisionId incorporated
-   $sHeadingJumpmark= 'bs-ue-jumpmark-'.md5( 
$sPageTitleHeadingJumpmark.$sHeadingTextContent );
+   $sHeadingJumpmark = 'bs-ue-jumpmark-' . md5( 
$sPageTitleHeadingJumpmark . $sHeadingTextContent );
 
$oBookmarkElement = 

[MediaWiki-commits] [Gerrit] cherry-pick from master - change (mediawiki...BlueSpiceExtensions)

2015-09-10 Thread Tweichart (Code Review)
Tweichart has uploaded a new change for review.

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

Change subject: cherry-pick from master
..

cherry-pick from master

Change-Id: Ie64f2abb98d8d58d022d5226d2ddbd9c45d7262c
---
M UniversalExport/includes/UniversalExportHelper.class.php
1 file changed, 25 insertions(+), 26 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions 
refs/changes/78/237378/1

diff --git a/UniversalExport/includes/UniversalExportHelper.class.php 
b/UniversalExport/includes/UniversalExportHelper.class.php
index c569902..598858f 100644
--- a/UniversalExport/includes/UniversalExportHelper.class.php
+++ b/UniversalExport/includes/UniversalExportHelper.class.php
@@ -103,33 +103,33 @@
 
//HINT: http://calibre-ebook.com/user_manual/xpath.html
$oBodyContentXPath = new DOMXPath( $oPageDOM );
-   $oHeadingElements  = $oBodyContentXPath->query(
+   $oHeadingElements = $oBodyContentXPath->query(
"//*[contains(@class, 'firstHeading') "
-   ."or contains(@class, 'mw-headline') "
-   ."and not(contains(@class, 'mw-headline-'))]"
+   . "or contains(@class, 'mw-headline') "
+   . "and not(contains(@class, 'mw-headline-'))]"
);
 
//By convention the first  in the PageDOM is the title of 
the page
-   $oPageTitleBookmarkElement= $oBookmarksDOM->createElement( 
'bookmark' );
-   $oPageTitleHeadingElement = $oHeadingElements->item( 0 );
+   $oPageTitleBookmarkElement = $oBookmarksDOM->createElement( 
'bookmark' );
+   $oPageTitleHeadingElement = $oHeadingElements->item( 0 );
$sPageTitleHeadingTextContent = trim( 
$oPageTitleHeadingElement->textContent );
 
//By convention previousSibling is an Anchor-Tag (see 
BsPageContentProvider)
//TODO: check for null
$sPageTitleHeadingJumpmark = 
self::findPreviousDOMElementSibling( $oPageTitleHeadingElement, 'a' 
)->getAttribute( 'name' );
$oPageTitleBookmarkElement->setAttribute( 'name', 
$sPageTitleHeadingTextContent );
-   $oPageTitleBookmarkElement->setAttribute( 'href', 
'#'.$sPageTitleHeadingJumpmark );
+   $oPageTitleBookmarkElement->setAttribute( 'href', '#' . 
$sPageTitleHeadingJumpmark );
 
//Adapt MediaWiki TOC #1
$oTocTableElement = $oBodyContentXPath->query( "//*[@id='toc']" 
);
-   $oTableOfContentsAnchors = array();
+   $oTableOfContentsAnchors = array ();
if ( $oTocTableElement->length > 0 ) { //Is a TOC available?
// HINT: 
http://de.selfhtml.org/xml/darstellung/xpathsyntax.htm#position_bedingungen
// - recursive descent operator = getElementsByTag
$oTableOfContentsAnchors = $oBodyContentXPath->query( 
"//*[@id='toc']//a" );
-   $oTocTableElement->item( 0 )->setAttribute( 'id', 
'toc-'.$sPageTitleHeadingJumpmark ); //make id unique
-   $oTocTitleElement = $oBodyContentXPath->query( 
"//*[@id='toctitle']" )->item(0);
-   $oTocTitleElement->setAttribute( 'id', 
'toctitle-'.$sPageTitleHeadingJumpmark ); //make id unique;
+   $oTocTableElement->item( 0 )->setAttribute( 'id', 
'toc-' . $sPageTitleHeadingJumpmark ); //make id unique
+   $oTocTitleElement = $oBodyContentXPath->query( 
"//*[@id='toctitle']" )->item( 0 );
+   $oTocTitleElement->setAttribute( 'id', 'toctitle-' . 
$sPageTitleHeadingJumpmark ); //make id unique;
$oTocTitleElement->setAttribute( 'class', 'toctitle' );
}
 
@@ -137,31 +137,30 @@
$oParentBookmark = $oPageTitleBookmarkElement;
$iParentLevel = 0;
$aHeadingLevels = array_flip(
-   array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' )
+   array ( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' )
);
for ( $i = 1; $i < $oHeadingElements->length; $i++ ) {
-   $oHeadingElement = $oHeadingElements->item( $i );
+   $oHeadingElement = $oHeadingElements->item( $i );
$sHeadingTextContent = trim( 
$oHeadingElement->textContent );
//In $sPageTitleHeadingJumpmark there is the PageTitle 
AND the RevisionId incorporated
-   $sHeadingJumpmark= 'bs-ue-jumpmark-'.md5( 
$sPageTitleHeadingJumpmark.$sHeadingTextContent );
+   $sHeadingJumpmark = 'bs-ue-jumpmark-' . md5( 
$sPageTitleHeadingJumpmark . $sHeadingTextContent );
 
$oBookmarkElement = 

[MediaWiki-commits] [Gerrit] cherry-pick from master - change (mediawiki...BlueSpiceExtensions)

2015-09-10 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: cherry-pick from master
..


cherry-pick from master

Change-Id: Ie64f2abb98d8d58d022d5226d2ddbd9c45d7262c
---
M UniversalExport/includes/UniversalExportHelper.class.php
1 file changed, 25 insertions(+), 26 deletions(-)

Approvals:
  Tweichart: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/UniversalExport/includes/UniversalExportHelper.class.php 
b/UniversalExport/includes/UniversalExportHelper.class.php
index c569902..598858f 100644
--- a/UniversalExport/includes/UniversalExportHelper.class.php
+++ b/UniversalExport/includes/UniversalExportHelper.class.php
@@ -103,33 +103,33 @@
 
//HINT: http://calibre-ebook.com/user_manual/xpath.html
$oBodyContentXPath = new DOMXPath( $oPageDOM );
-   $oHeadingElements  = $oBodyContentXPath->query(
+   $oHeadingElements = $oBodyContentXPath->query(
"//*[contains(@class, 'firstHeading') "
-   ."or contains(@class, 'mw-headline') "
-   ."and not(contains(@class, 'mw-headline-'))]"
+   . "or contains(@class, 'mw-headline') "
+   . "and not(contains(@class, 'mw-headline-'))]"
);
 
//By convention the first  in the PageDOM is the title of 
the page
-   $oPageTitleBookmarkElement= $oBookmarksDOM->createElement( 
'bookmark' );
-   $oPageTitleHeadingElement = $oHeadingElements->item( 0 );
+   $oPageTitleBookmarkElement = $oBookmarksDOM->createElement( 
'bookmark' );
+   $oPageTitleHeadingElement = $oHeadingElements->item( 0 );
$sPageTitleHeadingTextContent = trim( 
$oPageTitleHeadingElement->textContent );
 
//By convention previousSibling is an Anchor-Tag (see 
BsPageContentProvider)
//TODO: check for null
$sPageTitleHeadingJumpmark = 
self::findPreviousDOMElementSibling( $oPageTitleHeadingElement, 'a' 
)->getAttribute( 'name' );
$oPageTitleBookmarkElement->setAttribute( 'name', 
$sPageTitleHeadingTextContent );
-   $oPageTitleBookmarkElement->setAttribute( 'href', 
'#'.$sPageTitleHeadingJumpmark );
+   $oPageTitleBookmarkElement->setAttribute( 'href', '#' . 
$sPageTitleHeadingJumpmark );
 
//Adapt MediaWiki TOC #1
$oTocTableElement = $oBodyContentXPath->query( "//*[@id='toc']" 
);
-   $oTableOfContentsAnchors = array();
+   $oTableOfContentsAnchors = array ();
if ( $oTocTableElement->length > 0 ) { //Is a TOC available?
// HINT: 
http://de.selfhtml.org/xml/darstellung/xpathsyntax.htm#position_bedingungen
// - recursive descent operator = getElementsByTag
$oTableOfContentsAnchors = $oBodyContentXPath->query( 
"//*[@id='toc']//a" );
-   $oTocTableElement->item( 0 )->setAttribute( 'id', 
'toc-'.$sPageTitleHeadingJumpmark ); //make id unique
-   $oTocTitleElement = $oBodyContentXPath->query( 
"//*[@id='toctitle']" )->item(0);
-   $oTocTitleElement->setAttribute( 'id', 
'toctitle-'.$sPageTitleHeadingJumpmark ); //make id unique;
+   $oTocTableElement->item( 0 )->setAttribute( 'id', 
'toc-' . $sPageTitleHeadingJumpmark ); //make id unique
+   $oTocTitleElement = $oBodyContentXPath->query( 
"//*[@id='toctitle']" )->item( 0 );
+   $oTocTitleElement->setAttribute( 'id', 'toctitle-' . 
$sPageTitleHeadingJumpmark ); //make id unique;
$oTocTitleElement->setAttribute( 'class', 'toctitle' );
}
 
@@ -137,31 +137,30 @@
$oParentBookmark = $oPageTitleBookmarkElement;
$iParentLevel = 0;
$aHeadingLevels = array_flip(
-   array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' )
+   array ( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' )
);
for ( $i = 1; $i < $oHeadingElements->length; $i++ ) {
-   $oHeadingElement = $oHeadingElements->item( $i );
+   $oHeadingElement = $oHeadingElements->item( $i );
$sHeadingTextContent = trim( 
$oHeadingElement->textContent );
//In $sPageTitleHeadingJumpmark there is the PageTitle 
AND the RevisionId incorporated
-   $sHeadingJumpmark= 'bs-ue-jumpmark-'.md5( 
$sPageTitleHeadingJumpmark.$sHeadingTextContent );
+   $sHeadingJumpmark = 'bs-ue-jumpmark-' . md5( 
$sPageTitleHeadingJumpmark . $sHeadingTextContent );
 
$oBookmarkElement = $oBookmarksDOM->createElement( 
'bookmark' );

[MediaWiki-commits] [Gerrit] cherry-pick from master - change (mediawiki...BlueSpiceExtensions)

2015-09-10 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: cherry-pick from master
..


cherry-pick from master

Change-Id: Ie64f2abb98d8d58d022d5226d2ddbd9c45d7262c
---
M UniversalExport/includes/UniversalExportHelper.class.php
1 file changed, 25 insertions(+), 26 deletions(-)

Approvals:
  Tweichart: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/UniversalExport/includes/UniversalExportHelper.class.php 
b/UniversalExport/includes/UniversalExportHelper.class.php
index c569902..598858f 100644
--- a/UniversalExport/includes/UniversalExportHelper.class.php
+++ b/UniversalExport/includes/UniversalExportHelper.class.php
@@ -103,33 +103,33 @@
 
//HINT: http://calibre-ebook.com/user_manual/xpath.html
$oBodyContentXPath = new DOMXPath( $oPageDOM );
-   $oHeadingElements  = $oBodyContentXPath->query(
+   $oHeadingElements = $oBodyContentXPath->query(
"//*[contains(@class, 'firstHeading') "
-   ."or contains(@class, 'mw-headline') "
-   ."and not(contains(@class, 'mw-headline-'))]"
+   . "or contains(@class, 'mw-headline') "
+   . "and not(contains(@class, 'mw-headline-'))]"
);
 
//By convention the first  in the PageDOM is the title of 
the page
-   $oPageTitleBookmarkElement= $oBookmarksDOM->createElement( 
'bookmark' );
-   $oPageTitleHeadingElement = $oHeadingElements->item( 0 );
+   $oPageTitleBookmarkElement = $oBookmarksDOM->createElement( 
'bookmark' );
+   $oPageTitleHeadingElement = $oHeadingElements->item( 0 );
$sPageTitleHeadingTextContent = trim( 
$oPageTitleHeadingElement->textContent );
 
//By convention previousSibling is an Anchor-Tag (see 
BsPageContentProvider)
//TODO: check for null
$sPageTitleHeadingJumpmark = 
self::findPreviousDOMElementSibling( $oPageTitleHeadingElement, 'a' 
)->getAttribute( 'name' );
$oPageTitleBookmarkElement->setAttribute( 'name', 
$sPageTitleHeadingTextContent );
-   $oPageTitleBookmarkElement->setAttribute( 'href', 
'#'.$sPageTitleHeadingJumpmark );
+   $oPageTitleBookmarkElement->setAttribute( 'href', '#' . 
$sPageTitleHeadingJumpmark );
 
//Adapt MediaWiki TOC #1
$oTocTableElement = $oBodyContentXPath->query( "//*[@id='toc']" 
);
-   $oTableOfContentsAnchors = array();
+   $oTableOfContentsAnchors = array ();
if ( $oTocTableElement->length > 0 ) { //Is a TOC available?
// HINT: 
http://de.selfhtml.org/xml/darstellung/xpathsyntax.htm#position_bedingungen
// - recursive descent operator = getElementsByTag
$oTableOfContentsAnchors = $oBodyContentXPath->query( 
"//*[@id='toc']//a" );
-   $oTocTableElement->item( 0 )->setAttribute( 'id', 
'toc-'.$sPageTitleHeadingJumpmark ); //make id unique
-   $oTocTitleElement = $oBodyContentXPath->query( 
"//*[@id='toctitle']" )->item(0);
-   $oTocTitleElement->setAttribute( 'id', 
'toctitle-'.$sPageTitleHeadingJumpmark ); //make id unique;
+   $oTocTableElement->item( 0 )->setAttribute( 'id', 
'toc-' . $sPageTitleHeadingJumpmark ); //make id unique
+   $oTocTitleElement = $oBodyContentXPath->query( 
"//*[@id='toctitle']" )->item( 0 );
+   $oTocTitleElement->setAttribute( 'id', 'toctitle-' . 
$sPageTitleHeadingJumpmark ); //make id unique;
$oTocTitleElement->setAttribute( 'class', 'toctitle' );
}
 
@@ -137,31 +137,30 @@
$oParentBookmark = $oPageTitleBookmarkElement;
$iParentLevel = 0;
$aHeadingLevels = array_flip(
-   array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' )
+   array ( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' )
);
for ( $i = 1; $i < $oHeadingElements->length; $i++ ) {
-   $oHeadingElement = $oHeadingElements->item( $i );
+   $oHeadingElement = $oHeadingElements->item( $i );
$sHeadingTextContent = trim( 
$oHeadingElement->textContent );
//In $sPageTitleHeadingJumpmark there is the PageTitle 
AND the RevisionId incorporated
-   $sHeadingJumpmark= 'bs-ue-jumpmark-'.md5( 
$sPageTitleHeadingJumpmark.$sHeadingTextContent );
+   $sHeadingJumpmark = 'bs-ue-jumpmark-' . md5( 
$sPageTitleHeadingJumpmark . $sHeadingTextContent );
 
$oBookmarkElement = $oBookmarksDOM->createElement( 
'bookmark' );