Changeset 8722
- Timestamp:
- Jan 22, 2009, 8:59:03 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/inc/classes/BxDolMenu.php ¶
r8512 r8722 23 23 require_once(BX_DIRECTORY_PATH_INC . 'profiles.inc.php'); 24 24 25 class BxDolMenu { 26 27 28 29 30 31 32 33 34 var $sSelfFile; 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 25 class BxDolMenu { 26 var $aTopMenu; 27 var $sCacheFile; 28 var $sCacheFilePermalinks; 29 var $aMenuInfo = array(); 30 var $oTemplConfig; 31 var $sCode = ''; 32 var $iDivide; //divider or top items 33 var $sRequestUriFile; 34 var $sSelfFile; 35 var $aNotShowSubsFor = array( ); 36 var $oPermalinks; 37 38 function BxDolMenu() { 39 global $oTemplConfig; 40 41 $this->oPermalinks = new BxDolPermalinks(); 42 43 $this->sCacheFile = BX_DIRECTORY_PATH_DBCACHE . 'MenuContent.inc'; 44 $this->sCacheFilePermalinks = BX_DIRECTORY_PATH_DBCACHE . 'Permalinks.inc'; 45 $this->oTemplConfig = &$oTemplConfig; 46 47 $this->iDivide = (int)getParam( 'topmenu_items_perline' ); 48 49 if( !$this->load() ) 50 $this->aTopMenu = array(); 51 52 $this->getMenuInfo(); 53 } 54 55 function load() { 56 if( !file_exists( $this->sCacheFile ) && !$this->compile() ) { 57 echo '<b>Warning!</b> Cannot find Menu Cache file (' . $this->sCacheFile . ').'; 58 return false; 59 } 60 61 $sCache = @file_get_contents( $this->sCacheFile ); 62 if( !$sCache ) { 63 63 if (!$this->compile() || !$sCache = @file_get_contents( $this->sCacheFile )) { // compile and try again 64 65 64 echo '<b>Warning!</b> Cannot read Menu Cache file (' . $this->sCacheFile . ').'; 65 return false; 66 66 } 67 } 68 69 $this->aTopMenu = @eval( $sCache ); 70 if( !$this->aTopMenu or !is_array( $this->aTopMenu ) ) { 71 echo '<b>Warning!</b> Cannot evaluate Menu Cache file (' . $this->sCacheFile . ').'; 72 return false; 73 } 74 75 return true; 76 } 77 78 function getMenuInfo() { 79 global $logged; 80 global $p_arr; 81 82 $aSiteUrl = parse_url( $this->oTemplConfig->aSite['url'] ); 83 $this->sRequestUriFile = htmlspecialchars_adv( substr( $_SERVER['REQUEST_URI'], strlen( $aSiteUrl['path'] ) ) ); 84 $this->sSelfFile = htmlspecialchars_adv( substr( $_SERVER['PHP_SELF'], strlen( $aSiteUrl['path'] ) ) ); 85 86 if( $logged['member'] ) { 87 $this->aMenuInfo['memberID'] = (int)$_COOKIE['memberID']; 88 $this->aMenuInfo['memberNick'] = getNickName( $this->aMenuInfo['memberID'] ); 89 $this->aMenuInfo['memberLink'] = getProfileLink( $this->aMenuInfo['memberID'] ); 90 $this->aMenuInfo['visible'] = 'memb'; 91 } else { 92 $this->aMenuInfo['memberID'] = 0; 93 $this->aMenuInfo['memberNick'] = ''; 94 $this->aMenuInfo['memberLink'] = ''; 95 $this->aMenuInfo['visible'] = 'non'; 96 } 97 98 $selfFile = basename( $_SERVER['PHP_SELF'] ); 99 100 //get viewed profile ID 101 if( $p_arr and $p_arr['ID'] ) { 102 $this->aMenuInfo['profileID'] = (int)$p_arr['ID']; 103 $this->aMenuInfo['profileNick'] = $p_arr['NickName']; 104 $this->aMenuInfo['profileLink'] = getProfileLink( $this->aMenuInfo['profileID'] ); 105 } elseif( $selfFile == 'browseMedia.php') { 106 $this->aMenuInfo['profileID'] = (int)$_GET['userID']; 107 $this->aMenuInfo['profileNick'] = getNickName( $this->aMenuInfo['profileID'] ); 108 $this->aMenuInfo['profileLink'] = getProfileLink( $this->aMenuInfo['profileID'] ); 109 } elseif( $selfFile == 'blogs.php' ) { 110 $this->aMenuInfo['profileID'] = $_REQUEST['ownerID'] ? (int)$_REQUEST['ownerID'] : $this->aMenuInfo['profileID']; 111 $this->aMenuInfo['profileNick'] = getNickName( $this->aMenuInfo['profileID'] ); 112 $this->aMenuInfo['profileLink'] = getProfileLink( $this->aMenuInfo['profileID'] ); 113 } elseif( $selfFile == 'viewFriends.php' ) { 114 $this->aMenuInfo['profileID'] = (int)$_GET['iUser']; 115 $this->aMenuInfo['profileNick'] = getNickName( $this->aMenuInfo['profileID'] ); 116 $this->aMenuInfo['profileLink'] = getProfileLink( $this->aMenuInfo['profileID'] ); 117 } else { 118 $this->aMenuInfo['profileID'] = 0; 119 $this->aMenuInfo['profileNick'] = ''; 120 $this->aMenuInfo['profileLink'] = ''; 121 } 122 123 // detect current menu 124 $this->aMenuInfo['currentCustom'] = 0; 125 $this->aMenuInfo['currentTop'] = 0; 126 127 foreach( $this->aTopMenu as $iItemID => $aItem ) { 128 if( $aItem['Type'] == 'top' and $this->aMenuInfo['currentTop'] and $this->aMenuInfo['currentTop'] != $iItemID ) 129 break; 130 131 $aItemUris = explode( '|', $aItem['Link'] ); 132 foreach( $aItemUris as $sItemUri ) { 133 if( $this->aMenuInfo['memberID'] ) { 134 $sItemUri = str_replace( "{memberID}", $this->aMenuInfo['memberID'], $sItemUri ); 135 $sItemUri = str_replace( "{memberNick}", $this->aMenuInfo['memberNick'], $sItemUri ); 136 $sItemUri = str_replace( "{memberLink}", $this->aMenuInfo['memberLink'], $sItemUri ); 137 } 138 139 if( $this->aMenuInfo['profileID'] ) { 140 $sItemUri = str_replace( "{profileID}", $this->aMenuInfo['profileID'], $sItemUri ); 141 $sItemUri = str_replace( "{profileNick}", $this->aMenuInfo['profileNick'], $sItemUri ); 142 $sItemUri = str_replace( "{profileLink}", $this->aMenuInfo['profileLink'], $sItemUri ); 143 } 144 145 if( $sItemUri == $this->sRequestUriFile or 146 ( !(int)$aItem['Strict'] and substr( $this->sRequestUriFile, 0, strlen( $sItemUri ) ) == $sItemUri ) ) { 147 if( $aItem['Type'] == 'custom' ) { 148 $this->aMenuInfo['currentCustom'] = $iItemID; 149 $this->aMenuInfo['currentTop'] = (int)$aItem['Parent']; 150 break; 151 } else { //top or system 152 if( $this->aMenuInfo['currentTop'] and $this->aMenuInfo['currentTop'] != $iItemID ) 153 break; 154 else 155 $this->aMenuInfo['currentTop'] = $iItemID; 156 } 157 } 158 } 159 if( $this->aMenuInfo['currentCustom'] ) 160 break; 161 } 162 } 163 164 // check if to show current sub menu 165 function checkShowCurSub() { 166 foreach( $this->aNotShowSubsFor as $sExcep ) 167 if( $this->sSelfFile == $sExcep ) 168 return false; 169 return true; 170 } 171 172 function checkToShow( $aItem ) { 173 if( !$this->checkVisible( $aItem['Visible'] ) ) 174 return false; 175 176 if( !$this->checkCond( $aItem['Check'] ) ) 177 return false; 178 179 return true; 180 } 181 182 function checkVisible( $sVisible ) { 183 return ( strpos( $sVisible, $this->aMenuInfo['visible'] ) !== false ); 184 } 185 186 function checkCond( $sCheck ) { 187 if( !$sCheck ) 188 return true; 189 190 $sCheck = str_replace( '\$', '$', $sCheck ); 191 $fFunc = create_function('', $sCheck ); 192 193 return $fFunc(); 194 } 195 196 function genSubItems( $iTItemID = 0 ) { 197 if( !$iTItemID ) 198 $iTItemID = $this->aMenuInfo['currentTop']; 199 200 foreach( $this->aTopMenu as $iItemID => $aItem ) { 201 if( $aItem['Type'] != 'custom' ) 202 continue; 203 204 if( $aItem['Parent'] != $iTItemID ) 205 continue; 206 207 if( !$this->checkToShow( $aItem ) ) 208 continue; 209 210 //generate 211 list( $aItem['Link'] ) = explode( '|', $aItem['Link'] ); 212 213 $aItem['Link'] = $this->replaceMetas( $aItem['Link'] ); 214 $aItem['Onclick'] = $this->replaceMetas( $aItem['Onclick'] ); 215 216 $bActive = ( $iItemID == $this->aMenuInfo['currentCustom'] ); 217 218 $this->genSubItem( _t( $aItem['Caption'] ), $aItem['Link'], $aItem['Target'], $aItem['Onclick'], $bActive ); 219 } 220 } 221 222 function replaceMetas( $sLink ) { 223 $sLink = str_replace( '{memberID}', $this->aMenuInfo['memberID'], $sLink ); 224 $sLink = str_replace( '{memberNick}', $this->aMenuInfo['memberNick'], $sLink ); 225 $sLink = str_replace( '{memberLink}', $this->aMenuInfo['memberLink'], $sLink ); 226 $sLink = str_replace( '{memberPass}', getPassword( $this->aMenuInfo['memberID'] ), $sLink ); 227 228 $sLink = str_replace( '{profileID}', $this->aMenuInfo['profileID'], $sLink ); 229 $sLink = str_replace( '{profileNick}', $this->aMenuInfo['profileNick'], $sLink ); 230 $sLink = str_replace( '{profileLink}', $this->aMenuInfo['profileLink'], $sLink ); 231 232 return $sLink; 233 } 234 235 function compile() { 236 $fMenu = @fopen( $this->sCacheFile , 'w' ); 237 if( !$fMenu ) 238 return false; 239 240 fwrite( $fMenu, "return array(\n" ); 241 $aFields = array( 'Type','Caption','Link','Visible','Target','Onclick','Check','Strict','Parent','Picture','BQuickLink', 'Statistics' ); 242 243 $sQuery = " 244 SELECT 245 `ID`, 246 `" . implode('`, 247 `', $aFields ) . "` 248 FROM `TopMenu` 249 WHERE 250 `Active` = 1 AND 251 ( `Type` = 'system' OR `Type` = 'top' ) 252 ORDER BY `Type`,`Order` 253 "; 254 255 $rMenu = db_res( $sQuery ); 256 while( $aMenuItem = mysql_fetch_assoc( $rMenu ) ) { 257 fwrite( $fMenu, " " . str_pad( $aMenuItem['ID'], 2 ) . " => array(\n" ); 258 259 foreach( $aFields as $sKey => $sField ) { 260 $sCont = $aMenuItem[$sField]; 261 262 if( $sField == 'Link' ) 263 $sCont = $this->getCurrLink($sCont); 264 265 $sCont = str_replace( '\\', '\\\\', $sCont ); 266 $sCont = str_replace( '"', '\\"', $sCont ); 267 $sCont = str_replace( '$', '\\$', $sCont ); 268 269 $sCont = str_replace( "\n", '', $sCont ); 270 $sCont = str_replace( "\r", '', $sCont ); 271 $sCont = str_replace( "\t", '', $sCont ); 272 273 fwrite( $fMenu, " " . str_pad( "'$sField'", 11 ) . " => \"$sCont\",\n" ); 274 } 275 276 fwrite( $fMenu, " ),\n" ); 277 278 // write it's children 279 $sQuery = " 280 SELECT 281 `ID`, 282 `" . implode('`, 283 `', $aFields ) . "` 284 FROM `TopMenu` 285 WHERE 286 `Active` = 1 AND 287 `Type` = 'custom' AND 288 `Parent` = {$aMenuItem['ID']} 289 ORDER BY `Order` 290 "; 291 292 $rCMenu = db_res( $sQuery ); 293 while( $aMenuItem = mysql_fetch_assoc( $rCMenu ) ) { 294 fwrite( $fMenu, " " . str_pad( $aMenuItem['ID'], 2 ) . " => array(\n" ); 295 296 foreach( $aFields as $sKey => $sField ) { 297 $sCont = $aMenuItem[$sField]; 298 299 if( $sField == 'Link' ) 300 $sCont = $this->getCurrLink($sCont); 301 302 $sCont = str_replace( '\\', '\\\\', $sCont ); 303 $sCont = str_replace( '"', '\\"', $sCont ); 304 $sCont = str_replace( '$', '\\$', $sCont ); 305 306 $sCont = str_replace( "\n", '', $sCont ); 307 $sCont = str_replace( "\r", '', $sCont ); 308 $sCont = str_replace( "\t", '', $sCont ); 309 310 fwrite( $fMenu, " " . str_pad( "'$sField'", 11 ) . " => \"$sCont\",\n" ); 311 } 312 313 fwrite( $fMenu, " ),\n" ); 314 } 315 } 316 317 fwrite( $fMenu, ");\n" ); 318 319 fclose( $fMenu ); 320 return true; 321 } 322 323 /** 324 * Returns link in accordance with permalink settings 325 */ 326 function getCurrLink($sCont) { 327 $aCurrLink = explode('|', $sCont); 328 $aCurrLink[0] = $this->oPermalinks->permalink($aCurrLink[0]); 67 } 68 69 $this->aTopMenu = @eval( $sCache ); 70 if( !$this->aTopMenu or !is_array( $this->aTopMenu ) ) { 71 echo '<b>Warning!</b> Cannot evaluate Menu Cache file (' . $this->sCacheFile . ').'; 72 return false; 73 } 74 75 return true; 76 } 77 78 function getMenuInfo() { 79 global $logged; 80 global $p_arr; 81 82 $aSiteUrl = parse_url( $this->oTemplConfig->aSite['url'] ); 83 $this->sRequestUriFile = htmlspecialchars_adv( substr( $_SERVER['REQUEST_URI'], strlen( $aSiteUrl['path'] ) ) ); 84 $this->sSelfFile = htmlspecialchars_adv( substr( $_SERVER['PHP_SELF'], strlen( $aSiteUrl['path'] ) ) ); 85 86 if( $logged['member'] ) { 87 $this->aMenuInfo['memberID'] = (int)$_COOKIE['memberID']; 88 $this->aMenuInfo['memberNick'] = getNickName( $this->aMenuInfo['memberID'] ); 89 $this->aMenuInfo['memberLink'] = getProfileLink( $this->aMenuInfo['memberID'] ); 90 $this->aMenuInfo['visible'] = 'memb'; 91 } else { 92 $this->aMenuInfo['memberID'] = 0; 93 $this->aMenuInfo['memberNick'] = ''; 94 $this->aMenuInfo['memberLink'] = ''; 95 $this->aMenuInfo['visible'] = 'non'; 96 } 97 98 $selfFile = basename( $_SERVER['PHP_SELF'] ); 99 100 //get viewed profile ID (cherez jopu) 101 if (isset($p_arr) and isset($p_arr['ID'])) 102 $iProfileID = (int)$p_arr['ID']; 103 104 // known modules 105 elseif ($selfFile == 'browseMedia.php') 106 $iProfileID = (int)$_GET['userID']; 107 elseif ($selfFile == 'blogs.php') 108 $iProfileID = (int)$_REQUEST['ownerID']; 109 elseif ($selfFile == 'viewFriends.php') 110 $iProfileID = (int)$_GET['iUser']; 111 112 // unknown modules. f*ck me! %-[ 113 elseif (isset($_REQUEST['iUser'])) 114 $iProfileID = (int)$_REQUEST['iUser']; 115 elseif (isset($_REQUEST['userID'])) 116 $iProfileID = (int)$_REQUEST['userID']; 117 elseif (isset($_REQUEST['profileID'])) 118 $iProfileID = (int)$_REQUEST['profileID']; 119 elseif (isset($_REQUEST['ownerID'])) 120 $iProfileID = (int)$_REQUEST['ownerID']; 121 // Have more variants? Please add them. Do not hesitate. It is ugly anyway. ;) 122 123 // not found 124 else 125 $iProfileID = 0; 126 127 if ($iProfileID > 0) { 128 $this->aMenuInfo['profileID'] = $iProfileID; 129 $this->aMenuInfo['profileNick'] = getNickName($iProfileID); 130 $this->aMenuInfo['profileLink'] = getProfileLink($iProfileID); 131 } else { 132 $this->aMenuInfo['profileID'] = 0; 133 $this->aMenuInfo['profileNick'] = ''; 134 $this->aMenuInfo['profileLink'] = ''; 135 } 136 137 138 // detect current menu 139 $this->aMenuInfo['currentCustom'] = 0; 140 $this->aMenuInfo['currentTop'] = 0; 141 142 foreach( $this->aTopMenu as $iItemID => $aItem ) { 143 if( $aItem['Type'] == 'top' and $this->aMenuInfo['currentTop'] and $this->aMenuInfo['currentTop'] != $iItemID ) 144 break; 145 146 $aItemUris = explode( '|', $aItem['Link'] ); 147 foreach( $aItemUris as $sItemUri ) { 148 if( $this->aMenuInfo['memberID'] ) { 149 $sItemUri = str_replace( "{memberID}", $this->aMenuInfo['memberID'], $sItemUri ); 150 $sItemUri = str_replace( "{memberNick}", $this->aMenuInfo['memberNick'], $sItemUri ); 151 $sItemUri = str_replace( "{memberLink}", $this->aMenuInfo['memberLink'], $sItemUri ); 152 } 153 154 if( $this->aMenuInfo['profileID'] ) { 155 $sItemUri = str_replace( "{profileID}", $this->aMenuInfo['profileID'], $sItemUri ); 156 $sItemUri = str_replace( "{profileNick}", $this->aMenuInfo['profileNick'], $sItemUri ); 157 $sItemUri = str_replace( "{profileLink}", $this->aMenuInfo['profileLink'], $sItemUri ); 158 } 159 160 if( $sItemUri == $this->sRequestUriFile or 161 ( !(int)$aItem['Strict'] and substr( $this->sRequestUriFile, 0, strlen( $sItemUri ) ) == $sItemUri ) ) { 162 if( $aItem['Type'] == 'custom' ) { 163 $this->aMenuInfo['currentCustom'] = $iItemID; 164 $this->aMenuInfo['currentTop'] = (int)$aItem['Parent']; 165 break; 166 } else { //top or system 167 if( $this->aMenuInfo['currentTop'] and $this->aMenuInfo['currentTop'] != $iItemID ) 168 break; 169 else 170 $this->aMenuInfo['currentTop'] = $iItemID; 171 } 172 } 173 } 174 if( $this->aMenuInfo['currentCustom'] ) 175 break; 176 } 177 } 178 179 // check if to show current sub menu 180 function checkShowCurSub() { 181 foreach( $this->aNotShowSubsFor as $sExcep ) 182 if( $this->sSelfFile == $sExcep ) 183 return false; 184 return true; 185 } 186 187 function checkToShow( $aItem ) { 188 if( !$this->checkVisible( $aItem['Visible'] ) ) 189 return false; 190 191 if( !$this->checkCond( $aItem['Check'] ) ) 192 return false; 193 194 return true; 195 } 196 197 function checkVisible( $sVisible ) { 198 return ( strpos( $sVisible, $this->aMenuInfo['visible'] ) !== false ); 199 } 200 201 function checkCond( $sCheck ) { 202 if( !$sCheck ) 203 return true; 204 205 $sCheck = str_replace( '\$', '$', $sCheck ); 206 $fFunc = create_function('', $sCheck ); 207 208 return $fFunc(); 209 } 210 211 function genSubItems( $iTItemID = 0 ) { 212 if( !$iTItemID ) 213 $iTItemID = $this->aMenuInfo['currentTop']; 214 215 foreach( $this->aTopMenu as $iItemID => $aItem ) { 216 if( $aItem['Type'] != 'custom' ) 217 continue; 218 219 if( $aItem['Parent'] != $iTItemID ) 220 continue; 221 222 if( !$this->checkToShow( $aItem ) ) 223 continue; 224 225 //generate 226 list( $aItem['Link'] ) = explode( '|', $aItem['Link'] ); 227 228 $aItem['Link'] = $this->replaceMetas( $aItem['Link'] ); 229 $aItem['Onclick'] = $this->replaceMetas( $aItem['Onclick'] ); 230 231 $bActive = ( $iItemID == $this->aMenuInfo['currentCustom'] ); 232 233 $this->genSubItem( _t( $aItem['Caption'] ), $aItem['Link'], $aItem['Target'], $aItem['Onclick'], $bActive ); 234 } 235 } 236 237 function replaceMetas( $sLink ) { 238 $sLink = str_replace( '{memberID}', $this->aMenuInfo['memberID'], $sLink ); 239 $sLink = str_replace( '{memberNick}', $this->aMenuInfo['memberNick'], $sLink ); 240 $sLink = str_replace( '{memberLink}', $this->aMenuInfo['memberLink'], $sLink ); 241 $sLink = str_replace( '{memberPass}', getPassword( $this->aMenuInfo['memberID'] ), $sLink ); 242 243 $sLink = str_replace( '{profileID}', $this->aMenuInfo['profileID'], $sLink ); 244 $sLink = str_replace( '{profileNick}', $this->aMenuInfo['profileNick'], $sLink ); 245 $sLink = str_replace( '{profileLink}', $this->aMenuInfo['profileLink'], $sLink ); 246 247 return $sLink; 248 } 249 250 function compile() { 251 $fMenu = @fopen( $this->sCacheFile , 'w' ); 252 if( !$fMenu ) 253 return false; 254 255 fwrite( $fMenu, "return array(\n" ); 256 $aFields = array( 'Type','Caption','Link','Visible','Target','Onclick','Check','Strict','Parent','Picture','BQuickLink', 'Statistics' ); 257 258 $sQuery = " 259 SELECT 260 `ID`, 261 `" . implode('`, 262 `', $aFields ) . "` 263 FROM `TopMenu` 264 WHERE 265 `Active` = 1 AND 266 ( `Type` = 'system' OR `Type` = 'top' ) 267 ORDER BY `Type`,`Order` 268 "; 269 270 $rMenu = db_res( $sQuery ); 271 while( $aMenuItem = mysql_fetch_assoc( $rMenu ) ) { 272 fwrite( $fMenu, " " . str_pad( $aMenuItem['ID'], 2 ) . " => array(\n" ); 273 274 foreach( $aFields as $sKey => $sField ) { 275 $sCont = $aMenuItem[$sField]; 276 277 if( $sField == 'Link' ) 278 $sCont = $this->getCurrLink($sCont); 279 280 $sCont = str_replace( '\\', '\\\\', $sCont ); 281 $sCont = str_replace( '"', '\\"', $sCont ); 282 $sCont = str_replace( '$', '\\$', $sCont ); 283 284 $sCont = str_replace( "\n", '', $sCont ); 285 $sCont = str_replace( "\r", '', $sCont ); 286 $sCont = str_replace( "\t", '', $sCont ); 287 288 fwrite( $fMenu, " " . str_pad( "'$sField'", 11 ) . " => \"$sCont\",\n" ); 289 } 290 291 fwrite( $fMenu, " ),\n" ); 292 293 // write it's children 294 $sQuery = " 295 SELECT 296 `ID`, 297 `" . implode('`, 298 `', $aFields ) . "` 299 FROM `TopMenu` 300 WHERE 301 `Active` = 1 AND 302 `Type` = 'custom' AND 303 `Parent` = {$aMenuItem['ID']} 304 ORDER BY `Order` 305 "; 306 307 $rCMenu = db_res( $sQuery ); 308 while( $aMenuItem = mysql_fetch_assoc( $rCMenu ) ) { 309 fwrite( $fMenu, " " . str_pad( $aMenuItem['ID'], 2 ) . " => array(\n" ); 310 311 foreach( $aFields as $sKey => $sField ) { 312 $sCont = $aMenuItem[$sField]; 313 314 if( $sField == 'Link' ) 315 $sCont = $this->getCurrLink($sCont); 316 317 $sCont = str_replace( '\\', '\\\\', $sCont ); 318 $sCont = str_replace( '"', '\\"', $sCont ); 319 $sCont = str_replace( '$', '\\$', $sCont ); 320 321 $sCont = str_replace( "\n", '', $sCont ); 322 $sCont = str_replace( "\r", '', $sCont ); 323 $sCont = str_replace( "\t", '', $sCont ); 324 325 fwrite( $fMenu, " " . str_pad( "'$sField'", 11 ) . " => \"$sCont\",\n" ); 326 } 327 328 fwrite( $fMenu, " ),\n" ); 329 } 330 } 331 332 fwrite( $fMenu, ");\n" ); 333 334 fclose( $fMenu ); 335 return true; 336 } 337 338 /** 339 * Returns link in accordance with permalink settings 340 */ 341 function getCurrLink($sCont) { 342 $aCurrLink = explode('|', $sCont); 343 $aCurrLink[0] = $this->oPermalinks->permalink($aCurrLink[0]); 329 344 $sCont = implode( '|', $aCurrLink ); 330 331 332 345 346 return htmlspecialchars_adv($sCont); 347 } 333 348 } 334 349 ?>
Note: See TracChangeset
for help on using the changeset viewer.