r101467 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101466‎ | r101467 | r101468 >
Date:12:45, 1 November 2011
Author:mkroetzsch
Status:ok
Tags:
Comment:
adressed fixme for r101287 (deprecated syntax $string{0} and imprecise string emptiness checks)
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_WikiPage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_WikiPage.php
@@ -96,7 +96,7 @@
9797 }
9898
9999 if ( $value != '' ) {
100 - if ( $value{0} == '#' ) {
 100+ if ( $value[0] == '#' ) {
101101 if ( is_null( $this->m_contextPage ) ) {
102102 $this->addError( wfMsgForContent( 'smw_notitle', $value ) );
103103 return;
@@ -295,7 +295,7 @@
296296 */
297297 public function getWikiValue() {
298298 return ( $this->m_fixNamespace == NS_MAIN ? $this->getPrefixedText() : $this->getText() ) .
299 - ( $this->m_fragment ? "#{$this->m_fragment}" : '' );
 299+ ( $this->m_fragment != '' ? "#{$this->m_fragment}" : '' );
300300 }
301301
302302 public function getHash() {
@@ -425,7 +425,7 @@
426426 * @return string
427427 */
428428 protected function getShortCaptionText() {
429 - if ( $this->m_fragment != '' && $this->m_fragment{0} != '_' ) {
 429+ if ( $this->m_fragment != '' && $this->m_fragment[0] != '_' ) {
430430 $fragmentText = '#' . $this->m_fragment;
431431 } else {
432432 $fragmentText = '';
@@ -444,7 +444,7 @@
445445 * @return string
446446 */
447447 protected function getLongCaptionText() {
448 - if ( $this->m_fragment && $this->m_fragment{0} != '_' ) {
 448+ if ( $this->m_fragment != '' && $this->m_fragment[0] != '_' ) {
449449 $fragmentText = '#' . $this->m_fragment;
450450 } else {
451451 $fragmentText = '';
@@ -462,7 +462,7 @@
463463 */
464464 protected function getWikiLinkTarget() {
465465 return str_replace( "'", ''', $this->getPrefixedText() ) .
466 - ( $this->m_fragment ? "#{$this->m_fragment}" : '' );
 466+ ( $this->m_fragment != '' ? "#{$this->m_fragment}" : '' );
467467 }
468468
469469 /**

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r101287fixed " "/"_" encoding in fragment extraction;...mkroetzsch21:41, 29 October 2011

Status & tagging log