Advertisement
jargon

Roe Web Builder - Dysfunctional Text Swapping

Oct 19th, 2021
1,222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | None | 0 0
  1. function load_swaps()
  2. {
  3.     $nen = nen_ini();
  4.    
  5.     $alt = array();
  6.    
  7.     $dat = file_get_contents( $nen[ 'root' ]. 'swaps.dat' );
  8.    
  9.     $swaps = explode( '\r\n', $dat );
  10.    
  11.     $index = 0;
  12.    
  13.     while( $index < count( $swaps ) )
  14.     {
  15.         $e = explode( ':', $swaps[ $index ] );
  16.         if( count( $e ) > 0 )
  17.         {
  18.             $e = $swaps[ 0 ];
  19.             $r = substr( $swaps[ $index ], 0, strlen( $e ) );
  20.    
  21.             $alt[ $e ] = $r;
  22.         }
  23.         $index++;
  24.     }
  25.    
  26.     return $alt;
  27. }
  28.  
  29. function perform_swaps( $pagedata = '' )
  30. {
  31.     $alt = load_swaps();
  32.     foreach( $alt as $key => $value )
  33.     {
  34.         echo $key;
  35.         $pagedata = str_replace( '{{'. $key. '}}', $value, $pagedata );
  36.     }
  37.     return $pagedata;
  38. }
  39.  
  40. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement