Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Wikipedia: Mediawiki-CVS

SVN: [39286] trunk/phase3/includes

 

 

Wikipedia mediawiki-cvs RSS feed   Index | Next | Previous | View Threaded


simetrical at svn

Aug 13, 2008, 7:52 AM

Post #1 of 1 (29 views)
Permalink
SVN: [39286] trunk/phase3/includes

Revision: 39286
Author: simetrical
Date: 2008-08-13 14:52:40 +0000 (Wed, 13 Aug 2008)

Log Message:
-----------
Cleanup some of my old code a bit. These should still be replaced with nicer functions altogether, though, as Brion would have it.

Modified Paths:
--------------
trunk/phase3/includes/Linker.php
trunk/phase3/includes/Xml.php

Modified: trunk/phase3/includes/Linker.php
===================================================================
--- trunk/phase3/includes/Linker.php 2008-08-13 13:12:03 UTC (rev 39285)
+++ trunk/phase3/includes/Linker.php 2008-08-13 14:52:40 UTC (rev 39286)
@@ -1647,25 +1647,28 @@
* @return string title and accesskey attributes, ready to drop in an
* element (e.g., ' title="This does something [x]" accesskey="x"').
*/
- public function tooltipAndAccesskey($name) {
- $fname="Linker::tooltipAndAccesskey";
- wfProfileIn($fname);
- $out = '';
+ public function tooltipAndAccesskey( $name ) {
+ wfProfileIn( __METHOD__ );
+ $attribs = array();

- $tooltip = wfMsg('tooltip-'.$name);
- if (!wfEmptyMsg('tooltip-'.$name, $tooltip) && $tooltip != '-') {
+ $tooltip = wfMsg( "tooltip-$name" );
+ if( !wfEmptyMsg( "tooltip-$name", $tooltip ) && $tooltip != '-' ) {
// Compatibility: formerly some tooltips had [alt-.] hardcoded
$tooltip = preg_replace( "/ ?\[alt-.\]$/", '', $tooltip );
- $out .= ' title="'.htmlspecialchars($tooltip);
+ $attribs['title'] = $tooltip;
}
- $accesskey = wfMsg('accesskey-'.$name);
- if ($accesskey && $accesskey != '-' && !wfEmptyMsg('accesskey-'.$name, $accesskey)) {
- if ($out) $out .= " [$accesskey]\" accesskey=\"$accesskey\"";
- else $out .= " title=\"[$accesskey]\" accesskey=\"$accesskey\"";
- } elseif ($out) {
- $out .= '"';
+
+ $accesskey = wfMsg( "accesskey-$name" );
+ if( $accesskey && $accesskey != '-' &&
+ !wfEmptyMsg( "accesskey-$name", $accesskey ) ) {
+ if( isset( $attribs['title'] ) ) {
+ $attribs['title'] .= " [$accesskey]";
+ }
+ $attribs['accesskey'] = $accesskey;
}
- wfProfileOut($fname);
+
+ $out = Xml::expandAttributes( $attribs );
+ wfProfileOut( __METHOD__ );
return $out;
}

@@ -1679,14 +1682,16 @@
* @return string title attribute, ready to drop in an element
* (e.g., ' title="This does something"').
*/
- public function tooltip($name) {
- $out = '';
+ public function tooltip( $name ) {
+ wfProfileIn( __METHOD__ );

- $tooltip = wfMsg('tooltip-'.$name);
- if (!wfEmptyMsg('tooltip-'.$name, $tooltip) && $tooltip != '-') {
- $out = ' title="'.htmlspecialchars($tooltip).'"';
+ $tooltip = wfMsg( "tooltip-$name" );
+ if ( !wfEmptyMsg( "tooltip-$name", $tooltip ) && $tooltip != '-' ) {
+ wfProfileOut( __METHOD__ );
+ return ' title="'.htmlspecialchars( $tooltip ).'"';
}

- return $out;
+ wfProfileOut( __METHOD__ );
+ return '';
}
}

Modified: trunk/phase3/includes/Xml.php
===================================================================
--- trunk/phase3/includes/Xml.php 2008-08-13 13:12:03 UTC (rev 39285)
+++ trunk/phase3/includes/Xml.php 2008-08-13 14:52:40 UTC (rev 39286)
@@ -41,7 +41,7 @@
* Return null if no attributes given.
* @param $attribs Array of attributes for an XML element
*/
- private static function expandAttributes( $attribs ) {
+ public static function expandAttributes( $attribs ) {
$out = '';
if( is_null( $attribs ) ) {
return null;



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Wikipedia mediawiki-cvs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.