X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FLicenses.php;h=a2cbcc92214ca9bc5d30b04f6b81bafef4449525;hb=fcd1cdeb930e1779af77b3747b7c60338d4e81d7;hp=2f0b1ae14c58bb47e10424c29d2911db0368f953;hpb=75cb2b36b342a92fb0180c95c0d39f9e7630bd29;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Licenses.php b/includes/Licenses.php index 2f0b1ae14c..a2cbcc9221 100644 --- a/includes/Licenses.php +++ b/includes/Licenses.php @@ -6,6 +6,7 @@ * @subpackage SpecialPage * * @author Ævar Arnfjörð Bjarmason + * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later */ @@ -17,7 +18,7 @@ class Licenses { * @var string */ var $msg; - + /** * @var array */ @@ -28,7 +29,7 @@ class Licenses { */ var $html; /**#@-*/ - + /** * Constrictor * @@ -44,20 +45,20 @@ class Licenses { $tmp = $this->getLicenses(); $this->makeHtml( $tmp ); } - + /**#@+ * @access private */ function makeLicenses() { $levels = array(); $lines = explode( "\n", $this->msg ); - + foreach ( $lines as $line ) { if ( strpos( $line, '*' ) !== 0 ) continue; else { list( $level, $line ) = $this->trimStars( $line ); - + if ( strpos( $line, '|' ) !== false ) { $obj = new License( $line ); $this->stackItem( $this->licenses, $levels, $obj ); @@ -72,25 +73,23 @@ class Licenses { } } } - + function trimStars( $str ) { $i = $count = 0; - + wfSuppressWarnings(); while ($str[$i++] == '*') ++$count; wfRestoreWarnings(); - + return array( $count, ltrim( $str, '* ' ) ); } - + function stackItem( &$list, $path, $item ) { $position =& $list; - if( $path ) { - foreach( $path as $key ) { + if ( $path ) + foreach( $path as $key ) $position =& $position[$key]; - } - } $position[] = $item; } @@ -102,6 +101,7 @@ class Licenses { array( 'value' => '', 'disabled' => 'disabled', + 'style' => 'color: GrayText', // for MSIE ), $depth ); @@ -111,7 +111,7 @@ class Licenses { $this->msg( $val->text ), array( 'value' => $val->template, - 'title' => $val->template + 'title' => '{{' . $val->template . '}}' ), $depth ); @@ -122,14 +122,14 @@ class Licenses { $val = str_repeat( /*   */ "\xc2\xa0", $depth * 2 ) . $val; return str_repeat( "\t", $depth ) . wfElement( 'option', $attribs, $val ) . "\n"; } - + function msg( $str ) { $out = wfMsg( $str ); - return wfNoMsg( $str, $out ) ? $str : $out; + return wfEmptyMsg( $str, $out ) ? $str : $out; } - + /**#@-*/ - + /** * Accessor for $this->licenses * @@ -150,7 +150,7 @@ class License { * @var string */ var $template; - + /** * @var string */ @@ -163,7 +163,7 @@ class License { */ function License( $str ) { list( $text, $template ) = explode( '|', strrev( $str ), 2 ); - + $this->template = strrev( $template ); $this->text = strrev( $text ); }