includes/template.php
changeset 689 13f8383a7538
parent 685 17ebe24cdf85
child 692 78473351a6c9
equal deleted inserted replaced
688:f2a824ce5f18 689:13f8383a7538
  1051     }
  1051     }
  1052     
  1052     
  1053     $this->sidebar_extra = $this->sidebar_extra . $this->sidebar_widgets;
  1053     $this->sidebar_extra = $this->sidebar_extra . $this->sidebar_widgets;
  1054     
  1054     
  1055     $this->tpl_bool['fixed_menus'] = false;
  1055     $this->tpl_bool['fixed_menus'] = false;
       
  1056     $this->tpl_bool['export'] = false;
  1056     $this->tpl_bool['right_sidebar'] = true;
  1057     $this->tpl_bool['right_sidebar'] = true;
  1057     $this->tpl_bool['auth_rename'] = ( $local_page_exists && $session->check_acl_scope('rename', $local_namespace) && ( $perms->get_permissions('rename') && ( $paths->page_protected && $perms->get_permissions('even_when_protected') || !$paths->page_protected ) ));
  1058     $this->tpl_bool['auth_rename'] = ( $local_page_exists && $session->check_acl_scope('rename', $local_namespace) && ( $perms->get_permissions('rename') && ( $paths->page_protected && $perms->get_permissions('even_when_protected') || !$paths->page_protected ) ));
  1058     $this->tpl_bool['enable_uploads'] = ( getConfig('enable_uploads') == '1' && $session->get_permissions('upload_files') ) ? true : false;
  1059     $this->tpl_bool['enable_uploads'] = ( getConfig('enable_uploads') == '1' && $session->get_permissions('upload_files') ) ? true : false;
  1059     $this->tpl_bool['stupid_mode'] = false;
  1060     $this->tpl_bool['stupid_mode'] = false;
  1060     $this->tpl_bool['in_admin'] = ( ( $local_page_id == 'Administration' && $local_namespace == 'Special' ) || $local_namespace == 'Admin' );
  1061     $this->tpl_bool['in_admin'] = ( ( $local_page_id == 'Administration' && $local_namespace == 'Special' ) || $local_namespace == 'Admin' );
  1648       $text = str_replace_once($matches[0][$i], $string, $text);
  1649       $text = str_replace_once($matches[0][$i], $string, $text);
  1649     }
  1650     }
  1650     return $text;
  1651     return $text;
  1651   }
  1652   }
  1652   
  1653   
  1653   // Steps to turn this:
  1654   // n00bish comments removed from here. 2008-03-13 @ 12:02AM when I had nothing else to do.
  1654   //   [[Project:Community Portal]]
       
  1655   // into this:
       
  1656   //   <a href="/Project:Community_Portal">Community Portal</a>
       
  1657   // Must be done WITHOUT creating eval'ed code!!!
       
  1658   
       
  1659   // 1. preg_replace \[\[([a-zA-Z0-9 -_:]*?)\]\] with <a href="'.contentPath.'\\1">\\1</a>
       
  1660   // 2. preg_match_all <a href="'.preg_quote(contentPath).'([a-zA-Z0-9 -_:]*?)">
       
  1661   // 3. For each match, replace matches with identifiers
       
  1662   // 4. For each match, str_replace ' ' with '_'
       
  1663   // 5. For each match, str_replace match_id:random_val with $matches[$match_id]
       
  1664   
       
  1665   // The template language is really a miniature programming language; with variables, conditionals, everything!
       
  1666   // So you can implement custom logic into your sidebar if you wish.
       
  1667   // "Real" PHP support coming soon :-D
       
  1668   
  1655   
  1669   /**
  1656   /**
  1670    * Takes a blob of HTML with the specially formatted template-oriented wikitext and formats it. Does not use eval().
  1657    * Takes a blob of HTML with the specially formatted template-oriented wikitext and formats it. Does not use eval().
  1671    * This function butchers every coding standard in Enano and should eventually be rewritten. The fact is that the
  1658    * This function butchers every coding standard in Enano and should eventually be rewritten. The fact is that the
  1672    * code _works_ and does a good job of checking for errors and cleanly complaining about them.
  1659    * code _works_ and does a good job of checking for errors and cleanly complaining about them.