Merge "Allow lines empty but for tabs and comments to be ignored."
[lhc/web/wiklou.git] / includes / specials / SpecialPagesWithProp.php
index 51dd99f..199c5cd 100644 (file)
@@ -23,7 +23,6 @@
  * @author Brad Jorsch
  */
 
-
 /**
  * Special:PagesWithProp to search the page_props table
  * @ingroup SpecialPage
@@ -55,6 +54,7 @@ class SpecialPagesWithProp extends QueryPage {
                        __METHOD__,
                        array( 'DISTINCT', 'ORDER BY' => 'pp_propname' )
                );
+               $propnames = array();
                foreach ( $res as $row ) {
                        $propnames[$row->pp_propname] = $row->pp_propname;
                }
@@ -128,11 +128,24 @@ class SpecialPagesWithProp extends QueryPage {
                $title = Title::newFromRow( $result );
                $ret = Linker::link( $title, null, array(), array(), array( 'known' ) );
                if ( $result->pp_value !== '' ) {
-                       $value = $this->msg( 'parentheses' )
-                               ->rawParams( Html::element( 'span', array( 'class' => 'prop-value' ), $result->pp_value ) )
-                               ->escaped();
-                       $ret .= " $value";
+                       // Do not show very long or binary values on the special page
+                       $valueLength = strlen( $result->pp_value );
+                       $isBinary = strpos( $result->pp_value, "\0" ) !== false;
+                       $isTooLong = $valueLength > 1024;
+
+                       if ( $isBinary || $isTooLong ) {
+                               $message = $this
+                                       ->msg( $isBinary ? 'pageswithprop-prophidden-binary' : 'pageswithprop-prophidden-long' )
+                                       ->numParams( round( $valueLength / 1024, 2 ) );
+
+                               $propValue = Html::element( 'span', array( 'class' => 'prop-value-hidden' ), $message->text() );
+                       } else {
+                               $propValue = Html::element( 'span', array( 'class' => 'prop-value' ), $result->pp_value );
+                       }
+
+                       $ret .= $this->msg( 'colon-separator' )->escaped() . $propValue;
                }
+
                return $ret;
        }