HomeTutorialKontaktDominiks Blog
HomeSourceLinksSitemap

Source

Hier wird der Quellcode eines PHP-Scripts dieser Website angezeigt.

./cls/tutorial.cls:

<?

class tutorial {

  public 
$t;
  public 
$i;
  private 
$kapitel = array();
  public 
$lastpage;

  function 
__construct() {

    
$this->= &$_GET['t'];
    
$this->= &$_GET['i'];

    
$GLOBALS['_ORDNUNG'] = array(array('PHP-Tutorial.at','./'), array('Tutorial','tutorial.php'));

    if(isset(
$this->t))
      
$GLOBALS['_ORDNUNG'][] = array($this->t,'tutorial.php?t='.urlencode($t));

    if(isset(
$this->i))
      
$GLOBALS['_ORDNUNG'][] = array($this->i.'. Kapitel','');


  }



  function 
print_tutorials() {
    
$file = array();
    
$d = @opendir('./php/');

    while(
$content = @readdir($d))
      if(
is_dir('./php/'.$content) && $content != '..' && $content != '.')
        
$tuts[] = $content;

    
natsort($tuts);

    echo 
'<ul style="line-height:150%">';
    foreach(
$tuts as $tut)
      echo 
'<li><a href="'.getenv('SCRIPT_NAME').'?t='.urlencode($tut).'">'.$tut.'</a></li>';

    echo 
'</ul>';
  }

  function 
load_kapitel() {
    
$i = &$this->i;
    
$d = @opendir('php/'.$this->t);

    while(
$content = @readdir($d)) {
      if(
substr($content,0,1) > $this->lastpage)
        
$this->lastpage substr($content,0,1);
      if(
is_file('php/'.$this->t.'/'.$content) && substr($content,0,strlen($i)) == $i
        
$this->kapitel[] = $content;
    }

    
sort($this->kapitel);

  }

  function 
print_kapitel() {
    echo 
'<ul>';
    foreach(
$this->kapitel as $content) {
      
$seite substr($content,0,1);
      
$anchor str_replace('%''_'urlencode(urlencode('a'.$content)));
      
$content str_replace('[fz]''?'$content);
      echo 
'<li><a href="tutorial.php?t='.$this->t.'&i='.$seite.(eregi('[1-9]\.[1-9]',$content)?'#'.urlencode($anchor):'').'">'.$content.'</a></li>';
    }
  echo 
'</ul><br>';
  }

  function 
print_text() {
    foreach(
$this->kapitel as $content) {
      
$anchor str_replace('%''_'urlencode(urlencode('a'.$content)));
      
$datei fopen('php/'.$this->t.'/'.$content,'r');
      
$text fread($datei,filesize('php/'.$this->t.'/'.$content));
      
fclose($datei);
      echo 
'<h2><a name="'.$anchor.'" style="text-decoration:none">'.Str_replace('[fz]''?'$content).'</a></h2>'.$this->code($text).'<br><br><br>';
    }
  }

  function 
print_links() {
    echo ((
$this->!= 1) ? '<a href="tutorial.php?t='.$this->t.'&i='.($this->1).'"><img style="vertical-align:middle" src="img/tutorial/rtl.gif"></a> <a href="tutorial.php?t='.$this->t.'&i='.($this->1).'">zurück</a> | ' '').'<a href="tutorial.php?t='.$this->t.'">Inhaltsverzeichnis</a>'.(($this->!= $this->lastpage) ? ' | <a href="'.getenv('SCRIPT_NAME').'?t='.$this->t.'&i='.($this->1).'">weiter</a> <a href="tutorial.php?t='.$this->t.'&i='.($this->1).'"><img style="vertical-align:middle" src="img/tutorial/ltr.gif"></a>' '');
  }

  function 
code($text) {
    global 
$c;
    
$start strpos($text,'<code>');
    
$ende strpos($text,'</code>');
    if(!empty(
$start) && !empty($ende)) {
      
$vorcode substr($text0$start);
      
$code substr($text$start+6$ende-$start-6);
      
$nachcode substr($text$ende+7);
      return 
nl2br($vorcode).'<div style="background:#'.((++$c != 0) ? 'e5e5e5' 'efefef').'">'.highlight_string($code,1).'<br></div>'.$this->code($nachcode);
    } else
      return 
nl2br($text);
  }

}


?>

Zurück zur Dateiübersicht
Show Source