Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /****************************
- *TEMPLATE GENERATOR v1.0 ***
- ****************************
- *
- *(c) Almaju & Wistaro
- * 2011 - 2017
- * [ wistaro.fr / sw ]
- *
- * This class generate the html's files of the website
- *
- * Usage: doc/templateGenerator/howToUse.html
- *
- */
- class templates
- {
- function templates($adresse)
- {
- $this->source = get_file($adresse);
- }
- function variable($input, $output)
- {
- $this->source = str_replace('<*'.$input.'>', $output, $this->source);
- }
- function boucle($boucle)
- {
- $this->source = preg_replace('#\<\-'.$boucle.'\>(.+)\<\\\-'.$boucle.'\>#isU', '<-'.$boucle.'~->$1<\\-'.$boucle.'~><-'.$boucle.'>$1<\\-'.$boucle.'>', $this->source);
- }
- function variableboucle($boucle, $input, $output)
- {
- if(empty($output))$output = ' ';
- if(!$output)$output = '';
- while(preg_match('#\<\-'.$boucle.'~-\>(.+)\<\*'.$input.'\>(.+)\<\\\-'.$boucle.'~\>#isU', $this->source))
- {
- $output = str_replace('\\', '|| \ ', $output);
- $this->source = preg_replace('#\<\-'.$boucle.'~-\>(.+)\<\*'.$input.'\>(.+)\<\\\-'.$boucle.'~\>#isU', '<-'.$boucle.'~->$1<*'.$input.'>'.$output.'$2<\\-'.$boucle.'~>', $this->source);
- $this->source = str_replace('<*'.$input.'>'.$output, $output, $this->source);
- $this->source = str_replace('|| \ ', '\\', $this->source);
- }
- }
- function afficherboucle($boucle)
- {
- $this->source = str_replace('<-'.$boucle.'~->', '', $this->source);
- $this->source = str_replace('<\-'.$boucle.'~>', '', $this->source);
- }
- function videboucle($boucle)
- {
- $this->source = preg_replace('#\<\-'.$boucle.'\>(.+)\<\\\-'.$boucle.'\>#isU', '', $this->source);
- }
- function afficher()
- {
- $this->source = preg_replace('#\<\-(.+)\>(.+)\<\\\-(.+)\>#isU', '', $this->source);
- $this->source = preg_replace('#\<\*(.+)\>#isU', '', $this->source);
- echo $this->source;
- }
- function retour()
- {
- $this->source = preg_replace('#\<\-(.+)\>(.+)\<\\\-(.+)\>#isU', '', $this->source);
- $this->source = preg_replace('#\<\*(.+)\>#isU', '', $this->source);
- return $this->source;
- }
- function conditionboucle($boucle, $condition, $value)
- {
- if($value)
- $this->source = preg_replace('#\<\-'.$boucle.'~-\>(.+)\<\*\*'.$condition.'=(.+)\>(.+)\<\\\-'.$boucle.'~\>#isU', '<-'.$boucle.'~->$1$2$3<\\-'.$boucle.'~>', $this->source);
- }
- function afficherlight()
- {
- $this->source = preg_replace('#\<\-(.+)\>(.+)\<\\\-(.+)\>#isU', '', $this->source);
- $this->source = preg_replace('#\<\*(.+)\>#isU', '', $this->source);
- }
- function Xcode_template()
- {
- Xcode_light($this->source);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement