Index: trunk/extensions/Categorize/Categorize.php |
— | — | @@ -6,10 +6,10 @@ |
7 | 7 | * @licence GNU General Public Licence 3.0 |
8 | 8 | * @description Adds input box to edit and upload page which allows users to assign categories to the article. When a user starts typing the name of a category, the extension queries the database to find categories that match the user input. Furthermore, a best categories labels cloud is displayed. |
9 | 9 | * |
10 | | -*/ |
| 10 | + */ |
11 | 11 | |
12 | 12 | ## Abort if not used within Mediawiki |
13 | | -if( !defined( 'MEDIAWIKI' ) ) { |
| 13 | +if ( !defined( 'MEDIAWIKI' ) ) { |
14 | 14 | echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); |
15 | 15 | die(); |
16 | 16 | } |
Index: trunk/extensions/Categorize/Categorize.css |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | } |
33 | 33 | span.xcategorize3 { |
34 | 34 | background-color:#FBB6CA; |
35 | | - |
| 35 | + |
36 | 36 | } |
37 | 37 | span.xcategorize4 { |
38 | 38 | background-color:#FBDEB6; |
— | — | @@ -73,7 +73,7 @@ |
74 | 74 | |
75 | 75 | /*Suggest search results DIV*/ |
76 | 76 | #searchResults { |
77 | | - line-height: 1.6; |
| 77 | + line-height: 1.6; |
78 | 78 | overflow: auto; |
79 | 79 | max-height: 170px; |
80 | 80 | height: expression( |
— | — | @@ -116,7 +116,7 @@ |
117 | 117 | color: #2d5381; |
118 | 118 | } |
119 | 119 | |
120 | | - |
| 120 | + |
121 | 121 | /*Highlighted category in search results list*/ |
122 | 122 | span.highlight { |
123 | 123 | /*background-color: rgb(231,71,71);*/ |
— | — | @@ -129,13 +129,13 @@ |
130 | 130 | margin: 0px; |
131 | 131 | } |
132 | 132 | |
133 | | - |
| 133 | + |
134 | 134 | span.cs { |
135 | 135 | /*color: rgb(231,71,71);*/ |
136 | 136 | color: #1C537A; |
137 | 137 | background-color: white; |
138 | 138 | cursor: pointer; |
139 | | - line-Height: 1.6; |
| 139 | + line-Height: 1.6; |
140 | 140 | padding: 3px 4px; |
141 | 141 | /* width: 278px; */ |
142 | 142 | margin: 0px; |
— | — | @@ -146,7 +146,7 @@ |
147 | 147 | text-decoration: underline; |
148 | 148 | font-weight: bold; |
149 | 149 | } |
150 | | - |
| 150 | + |
151 | 151 | /*Highlighted category in search results list*/ |
152 | 152 | p.highlight { |
153 | 153 | /*background-color: rgb(231,71,71);*/ |
— | — | @@ -159,7 +159,7 @@ |
160 | 160 | margin: 0px; |
161 | 161 | } |
162 | 162 | |
163 | | - |
| 163 | + |
164 | 164 | p.cs { |
165 | 165 | /*color: rgb(231,71,71);*/ |
166 | 166 | color: #1C537A; |
Index: trunk/extensions/Categorize/Categorize.hooks.php |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | if ( !defined( 'MEDIAWIKI' ) ) |
4 | 4 | die(); |
5 | | - |
| 5 | + |
6 | 6 | class CategorizeHooks { |
7 | 7 | /*************************************************************************************/ |
8 | 8 | ## Entry point for the hook and main worker function for editing the page: |
— | — | @@ -13,82 +13,82 @@ |
14 | 14 | # Get ALL categories from wiki: |
15 | 15 | // $m_allCats = fnAjaxSuggestGetAllCategories(); |
16 | 16 | # Get the right member variables, depending on if we're on an upload form or not: |
17 | | - if( !$m_isUpload ) { |
| 17 | + if ( !$m_isUpload ) { |
18 | 18 | # Check if page is subpage once to save method calls later: |
19 | 19 | $m_isSubpage = $wgTitle->isSubpage(); |
20 | 20 | |
21 | 21 | # Check if page has been submitted already to Preview or Show Changes |
22 | | - $strCatsFromPreview = trim($wgRequest->getVal('txtSelectedCategories2')); |
23 | | - if(strlen($strCatsFromPreview)==0){ |
| 22 | + $strCatsFromPreview = trim( $wgRequest->getVal( 'txtSelectedCategories2' ) ); |
| 23 | + if ( strlen( $strCatsFromPreview ) == 0 ) { |
24 | 24 | # Extract all categorylinks from PAGE: |
25 | 25 | $m_pageCats = CategorizeBody::fnCategorizeGetPageCategories( $m_pageObj ); |
26 | 26 | } else { |
27 | 27 | # Get cats from preview |
28 | | - $m_pageCats = explode(";",$strCatsFromPreview); |
| 28 | + $m_pageCats = explode( ";", $strCatsFromPreview ); |
29 | 29 | } |
30 | 30 | # Never ever use editFormTextTop here as it resides outside the <form> so we will never get contents |
31 | 31 | $m_place = 'editFormTextAfterWarn'; |
32 | 32 | # Print the localised title for the select box: |
33 | | - $m_textBefore = '<b>'. wfMsg( 'categorize-title' ) . '</b>:'; |
| 33 | + $m_textBefore = '<b>' . wfMsg( 'categorize-title' ) . '</b>:'; |
34 | 34 | } else { |
35 | 35 | # No need to get categories: |
36 | 36 | $m_pageCats = array(); |
37 | | - |
| 37 | + |
38 | 38 | # Place output at the right place: |
39 | 39 | $m_place = 'uploadFormTextAfterSummary'; |
40 | 40 | } |
41 | | - |
42 | | - #ADD EXISTING CATEGORIES TO INPUT BOX |
| 41 | + |
| 42 | + # ADD EXISTING CATEGORIES TO INPUT BOX |
43 | 43 | $arrExistingCats = array(); |
44 | | - $arrExistingCats = array_unique($m_pageCats); |
45 | | - #ADD JAVASCRIPT - use document.write so it is not presented if javascript is disabled. |
| 44 | + $arrExistingCats = array_unique( $m_pageCats ); |
| 45 | + # ADD JAVASCRIPT - use document.write so it is not presented if javascript is disabled. |
46 | 46 | $m_pageObj->$m_place .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"$wgScriptPath/extensions/Categorize/Categorize.css\" /> |
47 | 47 | \n"; # provisoire |
48 | 48 | $m_pageObj->$m_place .= "<script type=\"text/javascript\" src=\"$wgScriptPath/extensions/Categorize/jquery.js\"></script>\n"; |
49 | 49 | $m_pageObj->$m_place .= "<script type=\"text/javascript\">var xSelectedLabels = new Array();</script>\n"; |
50 | | - foreach($arrExistingCats as $arrExistingCat) |
| 50 | + foreach ( $arrExistingCats as $arrExistingCat ) |
51 | 51 | { |
52 | 52 | $m_pageObj->$m_place .= "<script type=\"text/javascript\">xSelectedLabels['$arrExistingCat']=1;</script>\n"; |
53 | 53 | } |
54 | 54 | $m_pageObj->$m_place .= "<script type=\"text/javascript\" src=\"" . $wgCategorizejs . "\"></script>\n"; |
55 | | - $m_pageObj->$m_place .= "<script type=\"text/javascript\">/*<![CDATA[*/\n"; |
56 | | - $m_pageObj->$m_place .= "document.write(\"<div id='categoryselectmaster2'><div style='border-bottom:1px solid #AAAAAA;'><b>" .wfMsg( 'categorize-title' ). "</b></div>\");\n"; |
57 | | - $m_pageObj->$m_place .= "document.write(\"<p>" . wfMsg( 'categorize-subtitle' ). "</p>\");\n"; |
| 55 | + $m_pageObj->$m_place .= "<script type=\"text/javascript\">/*<![CDATA[*/\n"; |
| 56 | + $m_pageObj->$m_place .= "document.write(\"<div id='categoryselectmaster2'><div style='border-bottom:1px solid #AAAAAA;'><b>" . wfMsg( 'categorize-title' ) . "</b></div>\");\n"; |
| 57 | + $m_pageObj->$m_place .= "document.write(\"<p>" . wfMsg( 'categorize-subtitle' ) . "</p>\");\n"; |
58 | 58 | $m_pageObj->$m_place .= "document.write(\"\");\n"; |
59 | | - $m_pageObj->$m_place .= "document.write(\"<input onkeyup='sendRequest(this,event);' autocomplete='off' type='text' name='txtSelectedCategories2' id='txtSelectedCategories2' maxlength='200' length='150' style='width:100%;' value='".str_replace("_"," ",implode(";", $arrExistingCats))."'/>\");\n"; |
| 59 | + $m_pageObj->$m_place .= "document.write(\"<input onkeyup='sendRequest(this,event);' autocomplete='off' type='text' name='txtSelectedCategories2' id='txtSelectedCategories2' maxlength='200' length='150' style='width:100%;' value='" . str_replace( "_", " ", implode( ";", $arrExistingCats ) ) . "'/>\");\n"; |
60 | 60 | $m_pageObj->$m_place .= "document.write(\"<br/><div id='searchResults'></div>\");\n"; |
61 | | - $m_pageObj->$m_place .= "document.write(\"<input type='hidden' value='" . $wgCategorySuggestCloud . "' id='txtCSDisplayType'/>\");\n"; |
62 | | - $m_pageObj->$m_place .= "document.write(\"<p>" . wfMsg( 'categorize-advice' ). "</p>\");\n"; |
| 61 | + $m_pageObj->$m_place .= "document.write(\"<input type='hidden' value='" . $wgCategorySuggestCloud . "' id='txtCSDisplayType'/>\");\n"; |
| 62 | + $m_pageObj->$m_place .= "document.write(\"<p>" . wfMsg( 'categorize-advice' ) . "</p>\");\n"; |
63 | 63 | $m_pageObj->$m_place .= "document.write(\"<p><table id='xtable'>\");\n"; |
64 | 64 | $l__categorize_index = 0; |
65 | | - foreach($wgCategorizeLabels as $l__label_key=>$l__label_array) |
| 65 | + foreach ( $wgCategorizeLabels as $l__label_key => $l__label_array ) |
66 | 66 | { |
67 | 67 | $m_pageObj->$m_place .= "document.write(\"<tr>\");\n"; |
68 | | - if (substr($l__label_key,0,9)=='separator') |
| 68 | + if ( substr( $l__label_key, 0, 9 ) == 'separator' ) |
69 | 69 | { |
70 | 70 | $m_pageObj->$m_place .= "document.write(\"<td colspan=2> <hr/>\");\n"; |
71 | 71 | } |
72 | 72 | else |
73 | 73 | { |
74 | 74 | $l__categorize_index += 1; |
75 | | - $l__key_value_to_print = utf8_encode(str_replace("_"," ",$l__label_key)); |
76 | | - $l__xselected = (in_array($l__key_value_to_print,$arrExistingCats)) ? 'xselected' : ''; |
| 75 | + $l__key_value_to_print = utf8_encode( str_replace( "_", " ", $l__label_key ) ); |
| 76 | + $l__xselected = ( in_array( $l__key_value_to_print, $arrExistingCats ) ) ? 'xselected' : ''; |
77 | 77 | $m_pageObj->$m_place .= "document.write(\"<th style='text-align:left;'><span class='xlabel xmaster xcategorize$l__categorize_index $l__xselected'>$l__key_value_to_print</span></th><td> \");\n"; |
78 | | - foreach($l__label_array as $l__label_value) |
| 78 | + foreach ( $l__label_array as $l__label_value ) |
79 | 79 | { |
80 | | - $l__label_value_to_print = utf8_encode(str_replace("_"," ",$l__label_value)); |
81 | | - $l__xselected = (in_array($l__label_value_to_print,$arrExistingCats)) ? 'xselected' : ''; |
| 80 | + $l__label_value_to_print = utf8_encode( str_replace( "_", " ", $l__label_value ) ); |
| 81 | + $l__xselected = ( in_array( $l__label_value_to_print, $arrExistingCats ) ) ? 'xselected' : ''; |
82 | 82 | $m_pageObj->$m_place .= "document.write(\"<span class='xlabel xcategorize$l__categorize_index $l__xselected'>$l__label_value_to_print</span>\");\n"; |
83 | 83 | } |
84 | 84 | $m_pageObj->$m_place .= "document.write(\"</td></tr>\");\n"; |
85 | 85 | } |
86 | 86 | } |
87 | 87 | $m_pageObj->$m_place .= "document.write(\"</table></p>\");\n"; |
88 | | - $m_pageObj->$m_place .= "document.write(\"<p>" . wfMsg( 'categorize-footer' ). "</p>\");\n"; |
| 88 | + $m_pageObj->$m_place .= "document.write(\"<p>" . wfMsg( 'categorize-footer' ) . "</p>\");\n"; |
89 | 89 | $m_pageObj->$m_place .= "document.write(\"</div>\");\n"; |
90 | 90 | $m_pageObj->$m_place .= "/*]]>*/</script>\n"; |
91 | | - |
92 | | - |
| 91 | + |
| 92 | + |
93 | 93 | return true; |
94 | 94 | } |
95 | 95 | |
— | — | @@ -97,33 +97,33 @@ |
98 | 98 | public static function fnCategorizeSaveHook( $m_isUpload, $m_pageObj ) { |
99 | 99 | global $wgContLang; |
100 | 100 | global $wgOut; |
101 | | - |
| 101 | + |
102 | 102 | # Get localised namespace string: |
103 | 103 | $m_catString = $wgContLang->getNsText( NS_CATEGORY ); |
104 | 104 | # Get some distance from the rest of the content: |
105 | 105 | $m_text = "\n"; |
106 | | - |
| 106 | + |
107 | 107 | # Assign all selected category entries: |
108 | 108 | $strSelectedCats = $_POST['txtSelectedCategories2']; |
109 | 109 | |
110 | | - #CHECK IF USER HAS SELECTED ANY CATEGORIES |
111 | | - if(strlen($strSelectedCats)>1){ |
| 110 | + # CHECK IF USER HAS SELECTED ANY CATEGORIES |
| 111 | + if ( strlen( $strSelectedCats ) > 1 ) { |
112 | 112 | $arrSelectedCats = array(); |
113 | | - $arrSelectedCats = array_unique(explode(";",$_POST['txtSelectedCategories2'])); |
114 | | - foreach( $arrSelectedCats as $m_cat ) { |
115 | | - if(strlen($m_cat)>0){ |
116 | | - $m_text .= "\n[[$m_catString:" . mysql_escape_string(trim($m_cat)) . "]]"; |
| 113 | + $arrSelectedCats = array_unique( explode( ";", $_POST['txtSelectedCategories2'] ) ); |
| 114 | + foreach ( $arrSelectedCats as $m_cat ) { |
| 115 | + if ( strlen( $m_cat ) > 0 ) { |
| 116 | + $m_text .= "\n[[$m_catString:" . mysql_escape_string( trim( $m_cat ) ) . "]]"; |
117 | 117 | } |
118 | 118 | } |
119 | 119 | # If it is an upload we have to call a different method: |
120 | 120 | if ( $m_isUpload ) { |
121 | 121 | $m_pageObj->mUploadDescription .= $m_text; |
122 | | - } else{ |
| 122 | + } else { |
123 | 123 | $m_pageObj->textbox1 .= $m_text; |
124 | | - } |
| 124 | + } |
125 | 125 | } |
126 | | - $wgOut->addHTML($m_text); |
127 | | - |
| 126 | + $wgOut->addHTML( $m_text ); |
| 127 | + |
128 | 128 | # Return to the let MediaWiki do the rest of the work: |
129 | 129 | return true; |
130 | 130 | } |
Index: trunk/extensions/Categorize/Categorize.js |
— | — | @@ -30,15 +30,15 @@ |
31 | 31 | var csQuery = ''; |
32 | 32 | addEvent(document, "mouseup",keyPressHandler); |
33 | 33 | |
34 | | -function sendRequest(q,e) { |
| 34 | +function sendRequest(q,e) { |
35 | 35 | if ([e.keyCode||e.which] == 27 ) { |
36 | 36 | var resultDiv = document.getElementById('searchResults'); |
37 | 37 | resultDiv.style.visibility = 'hidden'; |
38 | | - e.preventDefault? e.preventDefault() : e.returnValue = false; |
| 38 | + e.preventDefault? e.preventDefault() : e.returnValue = false; |
39 | 39 | } |
40 | 40 | |
41 | 41 | // remove characters that don't work in category names |
42 | | - strQuery = new String(q.value); |
| 42 | + strQuery = new String(q.value); |
43 | 43 | |
44 | 44 | //CUT OFF EXISTING, COMPLETE CATEGORIES |
45 | 45 | if(strQuery.lastIndexOf(';')!=-1){ |
— | — | @@ -51,8 +51,8 @@ |
52 | 52 | strQuery = strQueryR; |
53 | 53 | q.value = strQueryR; |
54 | 54 | } |
55 | | - |
56 | 55 | |
| 56 | + |
57 | 57 | if ( strQuery.toString() != csQuery.toString() ) { |
58 | 58 | strQuery = strQuery.replace(/ /g,"_"); |
59 | 59 | csQuery = strQuery; |
— | — | @@ -75,7 +75,7 @@ |
76 | 76 | } |
77 | 77 | result.name = item.replace(/_/g," "); |
78 | 78 | csWord = result.name; |
79 | | - |
| 79 | + |
80 | 80 | csHTML = '<span class="csSelect">' + csWord.substr(0, csQuery.length) + '</span>' + csWord.substr(csQuery.length) + " "; |
81 | 81 | result.innerHTML = csHTML; |
82 | 82 | result.onmouseover = highlight; |
— | — | @@ -84,17 +84,17 @@ |
85 | 85 | result.title = 'Click here to add category to the category list!'; |
86 | 86 | result.className="cs"; |
87 | 87 | resultDiv.style.lineHeight='1'; |
88 | | - resultDiv.appendChild(result); |
| 88 | + resultDiv.appendChild(result); |
89 | 89 | }); |
90 | 90 | } |
91 | | - |
92 | | - |
| 91 | + |
| 92 | + |
93 | 93 | }); |
94 | | - |
95 | | - |
| 94 | + |
| 95 | + |
96 | 96 | } |
97 | 97 | } |
98 | | -// WAIT FOR SERVER RESPONSE AND DISPLAY SUGGESTIONS |
| 98 | +// WAIT FOR SERVER RESPONSE AND DISPLAY SUGGESTIONS |
99 | 99 | ajaxResponse = function handleResponse(response) { |
100 | 100 | resultSet = response.responseText; |
101 | 101 | var resultDiv = document.getElementById('searchResults'); |
— | — | @@ -117,7 +117,7 @@ |
118 | 118 | } |
119 | 119 | result.name = resultSet[f].replace(/_/g," "); |
120 | 120 | csWord = result.name; |
121 | | - |
| 121 | + |
122 | 122 | csHTML = '<span class="csSelect">' + csWord.substr(0, csQuery.length) + '</span>' + csWord.substr(csQuery.length) + " "; |
123 | 123 | result.innerHTML = csHTML; |
124 | 124 | result.onmouseover = highlight; |
— | — | @@ -126,12 +126,12 @@ |
127 | 127 | result.title = 'Click here to add category to the category list!'; |
128 | 128 | result.className="cs"; |
129 | 129 | resultDiv.style.lineHeight='1'; |
130 | | - resultDiv.appendChild(result); |
| 130 | + resultDiv.appendChild(result); |
131 | 131 | } |
132 | | - } |
| 132 | + } |
133 | 133 | } |
134 | 134 | |
135 | | - |
| 135 | + |
136 | 136 | // SELECT CATEGORY FROM SUGGEST DIV AND ADD IT TO THE INPUT BOX |
137 | 137 | function selectEntry () { |
138 | 138 | var strExistingValues = document.getElementById('txtSelectedCategories2').value; |
— | — | @@ -140,7 +140,7 @@ |
141 | 141 | strExistingValues = strExistingValues.substr(0, intIndex+1); |
142 | 142 | document.getElementById('txtSelectedCategories2').value = strExistingValues + this.name; |
143 | 143 | } else { |
144 | | - document.getElementById('txtSelectedCategories2').value = this.name; |
| 144 | + document.getElementById('txtSelectedCategories2').value = this.name; |
145 | 145 | } |
146 | 146 | document.getElementById('searchResults').style.visibility='hidden'; |
147 | 147 | document.getElementById('searchResults').innerHTML=''; |
— | — | @@ -150,7 +150,7 @@ |
151 | 151 | function highlight (){ |
152 | 152 | this.className='highlight'; |
153 | 153 | } |
154 | | - |
| 154 | + |
155 | 155 | function unHighlight (){ |
156 | 156 | this.className='cs'; |
157 | 157 | } |
— | — | @@ -186,10 +186,10 @@ |
187 | 187 | function keyPressHandler(e) { |
188 | 188 | var resultDiv = document.getElementById('searchResults'); |
189 | 189 | resultDiv.style.visibility = 'hidden'; |
190 | | - e.preventDefault? e.preventDefault() : e.returnValue = false; |
| 190 | + e.preventDefault? e.preventDefault() : e.returnValue = false; |
191 | 191 | //} |
192 | 192 | } |
193 | | - |
| 193 | + |
194 | 194 | $(document).ready(function() { |
195 | 195 | $('.xlabel').click(function(){ |
196 | 196 | var xvalue = $(this).text(); |
Index: trunk/extensions/Categorize/Categorize.api.php |
— | — | @@ -35,21 +35,21 @@ |
36 | 36 | $params = $this->extractRequestParams(); |
37 | 37 | $strquery = $params['strquery']; |
38 | 38 | $result = $this->getResult(); |
39 | | - |
40 | | - if(isset($strquery) && $strquery != NULL) { |
| 39 | + |
| 40 | + if ( isset( $strquery ) && $strquery != NULL ) { |
41 | 41 | $searchString = str_replace( '%' , '\%' , $strquery ); |
42 | 42 | $searchString = str_replace( '_' , '\_' , $searchString ); |
43 | 43 | $searchString = str_replace( '|' , '%' , $searchString ); |
44 | | - $dbr = $this->getDB();; |
45 | | - |
| 44 | + $dbr = $this->getDB(); ; |
| 45 | + |
46 | 46 | $suggestStrings = array(); |
47 | | - |
| 47 | + |
48 | 48 | $this->addTables( 'categorylinks' ); |
49 | 49 | $this->addFields( 'DISTINCT cl_to' ); |
50 | | - $this->addWhere ( " UPPER(CONVERT(cl_to using latin1)) LIKE UPPER(CONVERT('$searchString%' using latin1)) "); |
| 50 | + $this->addWhere ( " UPPER(CONVERT(cl_to using latin1)) LIKE UPPER(CONVERT('$searchString%' using latin1)) " ); |
51 | 51 | $res = $this->select( __METHOD__ ); |
52 | 52 | while ( $row = $res->fetchObject() ) { |
53 | | - array_push($suggestStrings,$row->cl_to); |
| 53 | + array_push( $suggestStrings, $row->cl_to ); |
54 | 54 | $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $row->cl_to ); |
55 | 55 | if ( !$fit ) { |
56 | 56 | $this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->afl_timestamp ) ); |
— | — | @@ -78,7 +78,7 @@ |
79 | 79 | public function getDescription() { |
80 | 80 | return 'Show categories beginning by "strquery" string.'; |
81 | 81 | } |
82 | | - |
| 82 | + |
83 | 83 | public function getPossibleErrors() { |
84 | 84 | return array_merge( parent::getPossibleErrors(), array( |
85 | 85 | // to fill |
Index: trunk/extensions/Categorize/jquery.js |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | */ |
13 | 13 | (function(){ |
14 | 14 | |
15 | | -var |
| 15 | +var |
16 | 16 | // Will speed up references to window, and allows munging its name. |
17 | 17 | window = this, |
18 | 18 | // Will speed up references to undefined, and allows munging its name. |
— | — | @@ -399,13 +399,13 @@ |
400 | 400 | }, |
401 | 401 | |
402 | 402 | val: function( value ) { |
403 | | - if ( value === undefined ) { |
| 403 | + if ( value === undefined ) { |
404 | 404 | var elem = this[0]; |
405 | 405 | |
406 | 406 | if ( elem ) { |
407 | 407 | if( jQuery.nodeName( elem, 'option' ) ) |
408 | 408 | return (elem.attributes.value || {}).specified ? elem.value : elem.text; |
409 | | - |
| 409 | + |
410 | 410 | // We need to handle select boxes special |
411 | 411 | if ( jQuery.nodeName( elem, "select" ) ) { |
412 | 412 | var index = elem.selectedIndex, |
— | — | @@ -434,7 +434,7 @@ |
435 | 435 | } |
436 | 436 | } |
437 | 437 | |
438 | | - return values; |
| 438 | + return values; |
439 | 439 | } |
440 | 440 | |
441 | 441 | // Everything else, we just grab the value |
— | — | @@ -513,13 +513,13 @@ |
514 | 514 | if ( first ) |
515 | 515 | for ( var i = 0, l = this.length; i < l; i++ ) |
516 | 516 | callback.call( root(this[i], first), i > 0 ? extra.cloneNode(true) : fragment ); |
517 | | - |
| 517 | + |
518 | 518 | if ( scripts ) |
519 | 519 | jQuery.each( scripts, evalScript ); |
520 | 520 | } |
521 | 521 | |
522 | 522 | return this; |
523 | | - |
| 523 | + |
524 | 524 | function root( elem, cur ) { |
525 | 525 | return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ? |
526 | 526 | (elem.getElementsByTagName("tbody")[0] || |
— | — | @@ -586,7 +586,7 @@ |
587 | 587 | |
588 | 588 | // Recurse if we're merging object values |
589 | 589 | if ( deep && copy && typeof copy === "object" && !copy.nodeType ) |
590 | | - target[ name ] = jQuery.extend( deep, |
| 590 | + target[ name ] = jQuery.extend( deep, |
591 | 591 | // Never move original objects, clone them |
592 | 592 | src || ( copy.length != null ? [ ] : { } ) |
593 | 593 | , copy ); |
— | — | @@ -923,7 +923,7 @@ |
924 | 924 | // IE completely kills leading whitespace when innerHTML is used |
925 | 925 | if ( !jQuery.support.leadingWhitespace && /^\s/.test( elem ) ) |
926 | 926 | div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild ); |
927 | | - |
| 927 | + |
928 | 928 | elem = jQuery.makeArray( div.childNodes ); |
929 | 929 | } |
930 | 930 | |
— | — | @@ -944,7 +944,7 @@ |
945 | 945 | fragment.appendChild( ret[i] ); |
946 | 946 | } |
947 | 947 | } |
948 | | - |
| 948 | + |
949 | 949 | return scripts; |
950 | 950 | } |
951 | 951 | |
— | — | @@ -1322,16 +1322,16 @@ |
1323 | 1323 | }, |
1324 | 1324 | queue: function( elem, type, data ) { |
1325 | 1325 | if ( elem ){ |
1326 | | - |
| 1326 | + |
1327 | 1327 | type = (type || "fx") + "queue"; |
1328 | | - |
| 1328 | + |
1329 | 1329 | var q = jQuery.data( elem, type ); |
1330 | | - |
| 1330 | + |
1331 | 1331 | if ( !q || jQuery.isArray(data) ) |
1332 | 1332 | q = jQuery.data( elem, type, jQuery.makeArray(data) ); |
1333 | 1333 | else if( data ) |
1334 | 1334 | q.push( data ); |
1335 | | - |
| 1335 | + |
1336 | 1336 | } |
1337 | 1337 | return q; |
1338 | 1338 | }, |
— | — | @@ -1339,10 +1339,10 @@ |
1340 | 1340 | dequeue: function( elem, type ){ |
1341 | 1341 | var queue = jQuery.queue( elem, type ), |
1342 | 1342 | fn = queue.shift(); |
1343 | | - |
| 1343 | + |
1344 | 1344 | if( !type || type === "fx" ) |
1345 | 1345 | fn = queue[0]; |
1346 | | - |
| 1346 | + |
1347 | 1347 | if( fn !== undefined ) |
1348 | 1348 | fn.call(elem); |
1349 | 1349 | } |
— | — | @@ -1384,7 +1384,7 @@ |
1385 | 1385 | |
1386 | 1386 | return this.each(function(){ |
1387 | 1387 | var queue = jQuery.queue( this, type, data ); |
1388 | | - |
| 1388 | + |
1389 | 1389 | if( type == "fx" && queue.length == 1 ) |
1390 | 1390 | queue[0].call(this); |
1391 | 1391 | }); |
— | — | @@ -1412,19 +1412,19 @@ |
1413 | 1413 | |
1414 | 1414 | if ( context.nodeType !== 1 && context.nodeType !== 9 ) |
1415 | 1415 | return []; |
1416 | | - |
| 1416 | + |
1417 | 1417 | if ( !selector || typeof selector !== "string" ) { |
1418 | 1418 | return results; |
1419 | 1419 | } |
1420 | 1420 | |
1421 | 1421 | var parts = [], m, set, checkSet, check, mode, extra, prune = true; |
1422 | | - |
| 1422 | + |
1423 | 1423 | // Reset the position of the chunker regexp (start from head) |
1424 | 1424 | chunker.lastIndex = 0; |
1425 | | - |
| 1425 | + |
1426 | 1426 | while ( (m = chunker.exec(selector)) !== null ) { |
1427 | 1427 | parts.push( m[1] ); |
1428 | | - |
| 1428 | + |
1429 | 1429 | if ( m[2] ) { |
1430 | 1430 | extra = RegExp.rightContext; |
1431 | 1431 | break; |
— | — | @@ -1525,7 +1525,7 @@ |
1526 | 1526 | |
1527 | 1527 | for ( var i = 0, l = Expr.order.length; i < l; i++ ) { |
1528 | 1528 | var type = Expr.order[i], match; |
1529 | | - |
| 1529 | + |
1530 | 1530 | if ( (match = Expr.match[ type ].exec( expr )) ) { |
1531 | 1531 | var left = RegExp.leftContext; |
1532 | 1532 | |
— | — | @@ -1770,7 +1770,7 @@ |
1771 | 1771 | }, |
1772 | 1772 | ATTR: function(match){ |
1773 | 1773 | var name = match[1].replace(/\\/g, ""); |
1774 | | - |
| 1774 | + |
1775 | 1775 | if ( Expr.attrMap[name] ) { |
1776 | 1776 | match[1] = Expr.attrMap[name]; |
1777 | 1777 | } |
— | — | @@ -1796,7 +1796,7 @@ |
1797 | 1797 | } else if ( Expr.match.POS.test( match[0] ) ) { |
1798 | 1798 | return true; |
1799 | 1799 | } |
1800 | | - |
| 1800 | + |
1801 | 1801 | return match; |
1802 | 1802 | }, |
1803 | 1803 | POS: function(match){ |
— | — | @@ -1894,7 +1894,7 @@ |
1895 | 1895 | var type = match[1], parent = elem.parentNode; |
1896 | 1896 | |
1897 | 1897 | var doneName = match[0]; |
1898 | | - |
| 1898 | + |
1899 | 1899 | if ( parent && (!parent[ doneName ] || !elem.nodeIndex) ) { |
1900 | 1900 | var count = 1; |
1901 | 1901 | |
— | — | @@ -2004,7 +2004,7 @@ |
2005 | 2005 | results.push.apply( results, array ); |
2006 | 2006 | return results; |
2007 | 2007 | } |
2008 | | - |
| 2008 | + |
2009 | 2009 | return array; |
2010 | 2010 | }; |
2011 | 2011 | |
— | — | @@ -2115,7 +2115,7 @@ |
2116 | 2116 | if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { |
2117 | 2117 | return; |
2118 | 2118 | } |
2119 | | - |
| 2119 | + |
2120 | 2120 | Sizzle = function(query, context, extra, seed){ |
2121 | 2121 | context = context || document; |
2122 | 2122 | |
— | — | @@ -2126,7 +2126,7 @@ |
2127 | 2127 | return makeArray( context.querySelectorAll(query), extra ); |
2128 | 2128 | } catch(e){} |
2129 | 2129 | } |
2130 | | - |
| 2130 | + |
2131 | 2131 | return oldSizzle(query, context, extra, seed); |
2132 | 2132 | }; |
2133 | 2133 | |
— | — | @@ -2368,7 +2368,7 @@ |
2369 | 2369 | |
2370 | 2370 | // Get the current list of functions bound to this event |
2371 | 2371 | var handlers = events[type]; |
2372 | | - |
| 2372 | + |
2373 | 2373 | if ( jQuery.event.specialAll[type] ) |
2374 | 2374 | jQuery.event.specialAll[type].setup.call(elem, data, namespaces); |
2375 | 2375 | |
— | — | @@ -2441,7 +2441,7 @@ |
2442 | 2442 | // Handle the removal of namespaced events |
2443 | 2443 | if ( namespace.test(events[type][handle].type) ) |
2444 | 2444 | delete events[type][handle]; |
2445 | | - |
| 2445 | + |
2446 | 2446 | if ( jQuery.event.specialAll[type] ) |
2447 | 2447 | jQuery.event.specialAll[type].teardown.call(elem, namespaces); |
2448 | 2448 | |
— | — | @@ -2508,11 +2508,11 @@ |
2509 | 2509 | // don't do events on text and comment nodes |
2510 | 2510 | if ( !elem || elem.nodeType == 3 || elem.nodeType == 8 ) |
2511 | 2511 | return undefined; |
2512 | | - |
| 2512 | + |
2513 | 2513 | // Clean up in case it is reused |
2514 | 2514 | event.result = undefined; |
2515 | 2515 | event.target = elem; |
2516 | | - |
| 2516 | + |
2517 | 2517 | // Clone the incoming data, if any |
2518 | 2518 | data = jQuery.makeArray(data); |
2519 | 2519 | data.unshift( event ); |
— | — | @@ -2559,7 +2559,7 @@ |
2560 | 2560 | |
2561 | 2561 | // Cache this now, all = true means, any handler |
2562 | 2562 | all = !namespaces.length && !event.exclusive; |
2563 | | - |
| 2563 | + |
2564 | 2564 | var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)"); |
2565 | 2565 | |
2566 | 2566 | handlers = ( jQuery.data(this, "events") || {} )[event.type]; |
— | — | @@ -2657,7 +2657,7 @@ |
2658 | 2658 | teardown: function() {} |
2659 | 2659 | } |
2660 | 2660 | }, |
2661 | | - |
| 2661 | + |
2662 | 2662 | specialAll: { |
2663 | 2663 | live: { |
2664 | 2664 | setup: function( selector, namespaces ){ |
— | — | @@ -2666,12 +2666,12 @@ |
2667 | 2667 | teardown: function( namespaces ){ |
2668 | 2668 | if ( namespaces.length ) { |
2669 | 2669 | var remove = 0, name = RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)"); |
2670 | | - |
| 2670 | + |
2671 | 2671 | jQuery.each( (jQuery.data(this, "events").live || {}), function(){ |
2672 | 2672 | if ( name.test(this.type) ) |
2673 | 2673 | remove++; |
2674 | 2674 | }); |
2675 | | - |
| 2675 | + |
2676 | 2676 | if ( remove < 1 ) |
2677 | 2677 | jQuery.event.remove( this, namespaces[0], liveHandler ); |
2678 | 2678 | } |
— | — | @@ -2684,7 +2684,7 @@ |
2685 | 2685 | // Allow instantiation without the 'new' keyword |
2686 | 2686 | if( !this.preventDefault ) |
2687 | 2687 | return new jQuery.Event(src); |
2688 | | - |
| 2688 | + |
2689 | 2689 | // Event object |
2690 | 2690 | if( src && src.type ){ |
2691 | 2691 | this.originalEvent = src; |
— | — | @@ -2696,7 +2696,7 @@ |
2697 | 2697 | // timeStamp is buggy for some events on Firefox(#3843) |
2698 | 2698 | // So we won't rely on the native value |
2699 | 2699 | this.timeStamp = now(); |
2700 | | - |
| 2700 | + |
2701 | 2701 | // Mark it as fixed |
2702 | 2702 | this[expando] = true; |
2703 | 2703 | }; |
— | — | @@ -2752,7 +2752,7 @@ |
2753 | 2753 | while ( parent && parent != this ) |
2754 | 2754 | try { parent = parent.parentNode; } |
2755 | 2755 | catch(e) { parent = this; } |
2756 | | - |
| 2756 | + |
2757 | 2757 | if( parent != this ){ |
2758 | 2758 | // set the correct event type |
2759 | 2759 | event.type = event.data; |
— | — | @@ -2760,9 +2760,9 @@ |
2761 | 2761 | jQuery.event.handle.apply( this, arguments ); |
2762 | 2762 | } |
2763 | 2763 | }; |
2764 | | - |
2765 | | -jQuery.each({ |
2766 | | - mouseover: 'mouseenter', |
| 2764 | + |
| 2765 | +jQuery.each({ |
| 2766 | + mouseover: 'mouseenter', |
2767 | 2767 | mouseout: 'mouseleave' |
2768 | 2768 | }, function( orig, fix ){ |
2769 | 2769 | jQuery.event.special[ fix ] = { |
— | — | @@ -2772,7 +2772,7 @@ |
2773 | 2773 | teardown: function(){ |
2774 | 2774 | jQuery.event.remove( this, orig, withinElement ); |
2775 | 2775 | } |
2776 | | - }; |
| 2776 | + }; |
2777 | 2777 | }); |
2778 | 2778 | |
2779 | 2779 | jQuery.fn.extend({ |
— | — | @@ -2811,7 +2811,7 @@ |
2812 | 2812 | event.stopPropagation(); |
2813 | 2813 | jQuery.event.trigger( event, data, this[0] ); |
2814 | 2814 | return event.result; |
2815 | | - } |
| 2815 | + } |
2816 | 2816 | }, |
2817 | 2817 | |
2818 | 2818 | toggle: function( fn ) { |
— | — | @@ -2854,7 +2854,7 @@ |
2855 | 2855 | |
2856 | 2856 | return this; |
2857 | 2857 | }, |
2858 | | - |
| 2858 | + |
2859 | 2859 | live: function( type, fn ){ |
2860 | 2860 | var proxy = jQuery.event.proxy( fn ); |
2861 | 2861 | proxy.guid += this.selector + type; |
— | — | @@ -2863,7 +2863,7 @@ |
2864 | 2864 | |
2865 | 2865 | return this; |
2866 | 2866 | }, |
2867 | | - |
| 2867 | + |
2868 | 2868 | die: function( type, fn ){ |
2869 | 2869 | jQuery(document).unbind( liveConvert(type, this.selector), fn ? { guid: fn.guid + this.selector + type } : null ); |
2870 | 2870 | return this; |
— | — | @@ -2983,12 +2983,12 @@ |
2984 | 2984 | // Prevent memory leaks in IE |
2985 | 2985 | // And prevent errors on refresh with events like mouseover in other browsers |
2986 | 2986 | // Window isn't included so as not to unbind existing unload events |
2987 | | -jQuery( window ).bind( 'unload', function(){ |
| 2987 | +jQuery( window ).bind( 'unload', function(){ |
2988 | 2988 | for ( var id in jQuery.cache ) |
2989 | 2989 | // Skip the window |
2990 | 2990 | if ( id != 1 && jQuery.cache[ id ].handle ) |
2991 | 2991 | jQuery.event.remove( jQuery.cache[ id ].handle.elem ); |
2992 | | -}); |
| 2992 | +}); |
2993 | 2993 | (function(){ |
2994 | 2994 | |
2995 | 2995 | jQuery.support = {}; |
— | — | @@ -3012,32 +3012,32 @@ |
3013 | 3013 | jQuery.support = { |
3014 | 3014 | // IE strips leading whitespace when .innerHTML is used |
3015 | 3015 | leadingWhitespace: div.firstChild.nodeType == 3, |
3016 | | - |
| 3016 | + |
3017 | 3017 | // Make sure that tbody elements aren't automatically inserted |
3018 | 3018 | // IE will insert them into empty tables |
3019 | 3019 | tbody: !div.getElementsByTagName("tbody").length, |
3020 | | - |
| 3020 | + |
3021 | 3021 | // Make sure that you can get all elements in an <object> element |
3022 | 3022 | // IE 7 always returns no results |
3023 | 3023 | objectAll: !!div.getElementsByTagName("object")[0] |
3024 | 3024 | .getElementsByTagName("*").length, |
3025 | | - |
| 3025 | + |
3026 | 3026 | // Make sure that link elements get serialized correctly by innerHTML |
3027 | 3027 | // This requires a wrapper element in IE |
3028 | 3028 | htmlSerialize: !!div.getElementsByTagName("link").length, |
3029 | | - |
| 3029 | + |
3030 | 3030 | // Get the style information from getAttribute |
3031 | 3031 | // (IE uses .cssText insted) |
3032 | 3032 | style: /red/.test( a.getAttribute("style") ), |
3033 | | - |
| 3033 | + |
3034 | 3034 | // Make sure that URLs aren't manipulated |
3035 | 3035 | // (IE normalizes it by default) |
3036 | 3036 | hrefNormalized: a.getAttribute("href") === "/a", |
3037 | | - |
| 3037 | + |
3038 | 3038 | // Make sure that element opacity exists |
3039 | 3039 | // (IE uses filter instead) |
3040 | 3040 | opacity: a.style.opacity === "0.5", |
3041 | | - |
| 3041 | + |
3042 | 3042 | // Verify style float existence |
3043 | 3043 | // (IE uses styleFloat instead of cssFloat) |
3044 | 3044 | cssFloat: !!a.style.cssFloat, |
— | — | @@ -3047,14 +3047,14 @@ |
3048 | 3048 | noCloneEvent: true, |
3049 | 3049 | boxModel: null |
3050 | 3050 | }; |
3051 | | - |
| 3051 | + |
3052 | 3052 | script.type = "text/javascript"; |
3053 | 3053 | try { |
3054 | 3054 | script.appendChild( document.createTextNode( "window." + id + "=1;" ) ); |
3055 | 3055 | } catch(e){} |
3056 | 3056 | |
3057 | 3057 | root.insertBefore( script, root.firstChild ); |
3058 | | - |
| 3058 | + |
3059 | 3059 | // Make sure that the execution of code works by injecting a script |
3060 | 3060 | // tag with appendChild/createTextNode |
3061 | 3061 | // (IE doesn't support this, fails, and uses .text instead) |
— | — | @@ -3199,7 +3199,7 @@ |
3200 | 3200 | var jsc = now(); |
3201 | 3201 | |
3202 | 3202 | jQuery.extend({ |
3203 | | - |
| 3203 | + |
3204 | 3204 | get: function( url, data, callback, type ) { |
3205 | 3205 | // shift arguments if data argument was ommited |
3206 | 3206 | if ( jQuery.isFunction( data ) ) { |
— | — | @@ -3585,7 +3585,7 @@ |
3586 | 3586 | |
3587 | 3587 | if ( xml && data.documentElement.tagName == "parsererror" ) |
3588 | 3588 | throw "parsererror"; |
3589 | | - |
| 3589 | + |
3590 | 3590 | // Allow a pre-filtering function to sanitize the response |
3591 | 3591 | // s != null is checked to keep backwards compatibility |
3592 | 3592 | if( s && s.dataFilter ) |
— | — | @@ -3602,7 +3602,7 @@ |
3603 | 3603 | if ( type == "json" ) |
3604 | 3604 | data = window["eval"]("(" + data + ")"); |
3605 | 3605 | } |
3606 | | - |
| 3606 | + |
3607 | 3607 | return data; |
3608 | 3608 | }, |
3609 | 3609 | |
— | — | @@ -3666,30 +3666,30 @@ |
3667 | 3667 | } else { |
3668 | 3668 | for ( var i = 0, l = this.length; i < l; i++ ){ |
3669 | 3669 | var old = jQuery.data(this[i], "olddisplay"); |
3670 | | - |
| 3670 | + |
3671 | 3671 | this[i].style.display = old || ""; |
3672 | | - |
| 3672 | + |
3673 | 3673 | if ( jQuery.css(this[i], "display") === "none" ) { |
3674 | 3674 | var tagName = this[i].tagName, display; |
3675 | | - |
| 3675 | + |
3676 | 3676 | if ( elemdisplay[ tagName ] ) { |
3677 | 3677 | display = elemdisplay[ tagName ]; |
3678 | 3678 | } else { |
3679 | 3679 | var elem = jQuery("<" + tagName + " />").appendTo("body"); |
3680 | | - |
| 3680 | + |
3681 | 3681 | display = elem.css("display"); |
3682 | 3682 | if ( display === "none" ) |
3683 | 3683 | display = "block"; |
3684 | | - |
| 3684 | + |
3685 | 3685 | elem.remove(); |
3686 | | - |
| 3686 | + |
3687 | 3687 | elemdisplay[ tagName ] = display; |
3688 | 3688 | } |
3689 | | - |
| 3689 | + |
3690 | 3690 | this[i].style.display = jQuery.data(this[i], "olddisplay", display); |
3691 | 3691 | } |
3692 | 3692 | } |
3693 | | - |
| 3693 | + |
3694 | 3694 | return this; |
3695 | 3695 | } |
3696 | 3696 | }, |
— | — | @@ -3732,11 +3732,11 @@ |
3733 | 3733 | var optall = jQuery.speed(speed, easing, callback); |
3734 | 3734 | |
3735 | 3735 | return this[ optall.queue === false ? "each" : "queue" ](function(){ |
3736 | | - |
| 3736 | + |
3737 | 3737 | var opt = jQuery.extend({}, optall), p, |
3738 | 3738 | hidden = this.nodeType == 1 && jQuery(this).is(":hidden"), |
3739 | 3739 | self = this; |
3740 | | - |
| 3740 | + |
3741 | 3741 | for ( p in prop ) { |
3742 | 3742 | if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden ) |
3743 | 3743 | return opt.complete.call(this); |
— | — | @@ -3990,7 +3990,7 @@ |
3991 | 3991 | if ( this.options.hide || this.options.show ) |
3992 | 3992 | for ( var p in this.options.curAnim ) |
3993 | 3993 | jQuery.attr(this.elem.style, p, this.options.orig[p]); |
3994 | | - |
| 3994 | + |
3995 | 3995 | // Execute the complete function |
3996 | 3996 | this.options.complete.call( this.elem ); |
3997 | 3997 | } |
— | — | @@ -4044,7 +4044,7 @@ |
4045 | 4045 | left = box.left + (self.pageXOffset || jQuery.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft; |
4046 | 4046 | return { top: top, left: left }; |
4047 | 4047 | }; |
4048 | | -else |
| 4048 | +else |
4049 | 4049 | jQuery.fn.offset = function() { |
4050 | 4050 | if ( !this[0] ) return { top: 0, left: 0 }; |
4051 | 4051 | if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] ); |
— | — | @@ -4134,7 +4134,7 @@ |
4135 | 4135 | parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset(); |
4136 | 4136 | |
4137 | 4137 | // Subtract element margins |
4138 | | - // note: when an element has margin: auto the offsetLeft and marginLeft |
| 4138 | + // note: when an element has margin: auto the offsetLeft and marginLeft |
4139 | 4139 | // are the same in Safari causing offset.left to incorrectly be 0 |
4140 | 4140 | offset.top -= num( this, 'marginTop' ); |
4141 | 4141 | offset.left -= num( this, 'marginLeft' ); |
— | — | @@ -4165,7 +4165,7 @@ |
4166 | 4166 | // Create scrollLeft and scrollTop methods |
4167 | 4167 | jQuery.each( ['Left', 'Top'], function(i, name) { |
4168 | 4168 | var method = 'scroll' + name; |
4169 | | - |
| 4169 | + |
4170 | 4170 | jQuery.fn[ method ] = function(val) { |
4171 | 4171 | if (!this[0]) return null; |
4172 | 4172 | |
— | — | @@ -4210,7 +4210,7 @@ |
4211 | 4211 | (margin ? |
4212 | 4212 | num(this, "margin" + tl) + num(this, "margin" + br) : 0); |
4213 | 4213 | }; |
4214 | | - |
| 4214 | + |
4215 | 4215 | var type = name.toLowerCase(); |
4216 | 4216 | |
4217 | 4217 | jQuery.fn[ type ] = function( size ) { |
Index: trunk/extensions/Categorize/Categorize.body.php |
— | — | @@ -2,13 +2,13 @@ |
3 | 3 | /* Categorize Mediawiki Extension |
4 | 4 | * |
5 | 5 | * @author Andreas Rindler (mediawiki at jenandi dot com) for initial Extension:CategorySuggest and Thomas Fauré (faure dot thomas at gmail dot com) for Categorize improvments |
6 | | - * @credits |
| 6 | + * @credits |
7 | 7 | * @licence GNU General Public Licence 3.0 |
8 | | - * @description |
| 8 | + * @description |
9 | 9 | * |
10 | 10 | */ |
11 | 11 | |
12 | | -if( !defined( 'MEDIAWIKI' ) ) { |
| 12 | +if ( !defined( 'MEDIAWIKI' ) ) { |
13 | 13 | echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); |
14 | 14 | die(); |
15 | 15 | } |
— | — | @@ -24,9 +24,9 @@ |
25 | 25 | $m_pageText = $m_pageObj->textbox1; |
26 | 26 | |
27 | 27 | $arrAllCats = Array(); |
28 | | - $regulartext =''; |
| 28 | + $regulartext = ''; |
29 | 29 | $nowikitext = ''; |
30 | | - $cleanedtext =''; |
| 30 | + $cleanedtext = ''; |
31 | 31 | $finaltext = ''; |
32 | 32 | # Check linewise for category links: |
33 | 33 | # Get the first part of the text up until the first <nowiki> tag. |
— | — | @@ -34,31 +34,31 @@ |
35 | 35 | $regulartext = $arrBlocks1[0]; |
36 | 36 | |
37 | 37 | # Get and strip categories from the first part |
38 | | - $cleanedtext = CategorizeBody::fnCategorizeStripCats($regulartext,$arrAllCats); |
| 38 | + $cleanedtext = CategorizeBody::fnCategorizeStripCats( $regulartext, $arrAllCats ); |
39 | 39 | $finaltext .= $cleanedtext; |
40 | | - |
| 40 | + |
41 | 41 | # Go through the rest of the blocks to find more categories |
42 | | - for($i=1; $i<count($arrBlocks1); $i++){ |
| 42 | + for ( $i = 1; $i < count( $arrBlocks1 ); $i++ ) { |
43 | 43 | $arrBlocks2 = explode( "</nowiki>", $arrBlocks1[$i] ); |
44 | | - //ignore cats here because it is part of the <nowiki> block |
| 44 | + // ignore cats here because it is part of the <nowiki> block |
45 | 45 | $nowikitext = $arrBlocks2[0]; |
46 | | - //add to final text |
| 46 | + // add to final text |
47 | 47 | $finaltext .= '<nowiki>' . $nowikitext . '</nowiki> '; |
48 | | - |
49 | | - //strip cats here because it's the text after the <nowiki> block |
| 48 | + |
| 49 | + // strip cats here because it's the text after the <nowiki> block |
50 | 50 | $regulartext = $arrBlocks2[1]; |
51 | | - $cleanedtext = CategorizeBody::fnCategorizeStripCats($regulartext,$arrAllCats); |
52 | | - $finaltext .= ltrim($cleanedtext); |
| 51 | + $cleanedtext = CategorizeBody::fnCategorizeStripCats( $regulartext, $arrAllCats ); |
| 52 | + $finaltext .= ltrim( $cleanedtext ); |
53 | 53 | } |
54 | 54 | |
55 | | - //Place cleaned text back into the text box: |
| 55 | + // Place cleaned text back into the text box: |
56 | 56 | $m_pageObj->textbox1 = rtrim( $finaltext ); |
57 | | - |
| 57 | + |
58 | 58 | return $arrAllCats; |
59 | | - |
| 59 | + |
60 | 60 | } |
61 | 61 | |
62 | | - public static function fnCategorizeStripCats($texttostrip, &$catsintext){ |
| 62 | + public static function fnCategorizeStripCats( $texttostrip, &$catsintext ) { |
63 | 63 | global $wgContLang, $wgOut; |
64 | 64 | |
65 | 65 | # Get localised namespace string: |
— | — | @@ -73,27 +73,27 @@ |
74 | 74 | |
75 | 75 | |
76 | 76 | # Check linewise for category links: |
77 | | - foreach( explode( "\n", $texttostrip ) as $m_textLine ) { |
| 77 | + foreach ( explode( "\n", $texttostrip ) as $m_textLine ) { |
78 | 78 | # Filter line through pattern and store the result: |
79 | | - $m_cleanText .= rtrim( preg_replace( "/{$m_pattern}/i", "", $m_textLine ) ) . "\n"; |
| 79 | + $m_cleanText .= rtrim( preg_replace( "/{$m_pattern}/i", "", $m_textLine ) ) . "\n"; |
80 | 80 | |
81 | 81 | # Check if we have found a category, else proceed with next line: |
82 | | - if( preg_match_all( "/{$m_pattern}/i", $m_textLine,$catsintext2,PREG_SET_ORDER) ){ |
83 | | - foreach( $catsintext2 as $local_cat => $m_prefix ) { |
84 | | - //Set first letter to upper case to match MediaWiki standard |
85 | | - $strFirstLetter = substr($m_prefix[2], 0,1); |
86 | | - strtoupper($strFirstLetter); |
87 | | - $newString = strtoupper($strFirstLetter) . substr($m_prefix[2], 1); |
88 | | - array_push($catsintext,$newString); |
89 | | - |
| 82 | + if ( preg_match_all( "/{$m_pattern}/i", $m_textLine, $catsintext2, PREG_SET_ORDER ) ) { |
| 83 | + foreach ( $catsintext2 as $local_cat => $m_prefix ) { |
| 84 | + // Set first letter to upper case to match MediaWiki standard |
| 85 | + $strFirstLetter = substr( $m_prefix[2], 0, 1 ); |
| 86 | + strtoupper( $strFirstLetter ); |
| 87 | + $newString = strtoupper( $strFirstLetter ) . substr( $m_prefix[2], 1 ); |
| 88 | + array_push( $catsintext, $newString ); |
| 89 | + |
90 | 90 | } |
91 | 91 | # Get the category link from the original text and store it in our list: |
92 | | - preg_replace( "/.*{$m_pattern}/i", $m_replace, $m_textLine,-1,$intNumber ); |
| 92 | + preg_replace( "/.*{$m_pattern}/i", $m_replace, $m_textLine, -1, $intNumber ); |
93 | 93 | } |
94 | | - |
| 94 | + |
95 | 95 | } |
96 | 96 | return $m_cleanText; |
97 | | - |
| 97 | + |
98 | 98 | } |
99 | 99 | } |
100 | 100 | ?> |