Ver Mensaje Individual
  #3 (permalink)  
Antiguo 25/05/2009, 14:27
jovanale
 
Fecha de Ingreso: marzo-2009
Mensajes: 96
Antigüedad: 15 años, 1 mes
Puntos: 0
Pues mira en el archivo y la lìnea que me marca el error esta este còdigo:

Código php:
Ver original
  1. <?php
  2. class Container {
  3.  
  4.     var $rtf;
  5.        
  6.     var $elements = array();  
  7.    
  8.     var $pard = '\pard ';
  9.    
  10.     var $emptyPar = false;
  11.    
  12.        
  13.     function Container(&$rtf) {    
  14.         $this->rtf = &$rtf;
  15.     }
  16.    
  17.         function writeRtfCode($text) {     
  18.         $this->elements[] = $text;
  19.     }
  20.    
  21.         function emptyParagraph(&$font, &$parFormat) {
  22.         if (is_a($parFormat, 'ParFormat') && is_a($font, 'Font')) {        
  23.             $content = (count($this->elements) != 0 && empty($this->emptyPar)) ? '\par ' : ''; 
  24.             $content .= $this->pard.$parFormat->getContent($this->rtf);            
  25.             $content .= '{'.$font->getContent($this->rtf).' \par}'."\r\n";  
  26.             $this->elements[] = $content;                  
  27.             $this->emptyPar = true;
  28.         }      
  29.     }
  30.    
  31.         function writeText($text, &$font, &$parFormat, $replaceTags = true) {              
  32.         $text = str_replace('\\', '\\\\', $text);
  33.         $text = str_replace("\r\n", "\r\n".'\par ', $text);
  34.        
  35.         if (!empty($replaceTags)) {
  36.             //bold     
  37.             $text = preg_replace("/<STRONG[ ]*>(.*?)<\/STRONG[ ]*>/mi", "\\b \\1\\b0 ", $text);
  38.             $text = preg_replace("/<B[ ]*>(.*?)<\/B[ ]*>/mi", "\\b \\1\\b0 ", $text);      
  39.             //italic
  40.             $text = preg_replace("/<EM[ ]*>(.*?)<\/EM[ ]*>/mi", "\\i \\1\\i0 ", $text);
  41.             $text = preg_replace("/<I[ ]*>(.*?)<\/I[ ]*>/mi", "\\i \\1\\i0 ", $text);      
  42.             //underline
  43.             $text = preg_replace("/<U[ ]*>(.*?)<\/U[ ]*>/mi", "\\ul \\1\\ul0 ", $text);    
  44.             //break
  45.             $text = preg_replace("/<BR[ ]*(\/)?[ ]*>/mi", "\\line ", $text);
  46.             $text = preg_replace("/<CHDATE[ ]*(\/)?[ ]*>/mi", "\\chdate ", $text);
  47.             $text = preg_replace("/<CHDPL[ ]*(\/)?[ ]*>/mi", "\\\chdpl ", $text);
  48.             $text = preg_replace("/<CHDPA[ ]*(\/)?[ ]*>/mi", "\\chdpa ", $text);
  49.             $text = preg_replace("/<CHTIME[ ]*(\/)?[ ]*>/mi", "\\chtime ", $text);
  50.             $text = preg_replace("/<CHPGN[ ]*(\/)?[ ]*>/mi", "\\chpgn ", $text);
  51.            
  52.             $text = preg_replace("/<TAB[ ]*(\/)?[ ]*>/mi", "\\tab ", $text);
  53.             $text = preg_replace("/<BULLET[ ]*(\/)?[ ]*>/mi", "\\bullet ", $text);
  54.            
  55.             $text = preg_replace("/<PAGENUM[ ]*(\/)?[ ]*>/mi", "\\chpgn ", $text);
  56.             $text = preg_replace("/<SECTNUM[ ]*(\/)?[ ]*>/mi", "\\sectnum ", $text);
  57.            
  58.             $text = preg_replace("/<LINE[ ]*(\/)?[ ]*>/mi", "\\line ", $text);
  59.             //$text = preg_replace("/<PAGE[ ]*(\/)?[ ]*>/mi", "\\page ", $text);
  60.             //$text = preg_replace("/<SECT[ ]*(\/)?[ ]*>/mi", "\\sect", $text);
  61.         }  
  62.                    
  63.         $text = Util::utf8Unicode($text);      
  64.         //content formating
  65.     $content = (is_a($parFormat, 'ParFormat') && count($this->elements) != 0 && empty($this->emptyPar)) ? '\par ' : '';
  66.                                 $this->emptyPar = false;   
  67.         $content .= is_a($parFormat, 'ParFormat') ? $this->pard.$parFormat->getContent($this->rtf) : '';                       
  68.         $content .= '{';
  69.         if (is_a($font, 'Font')) {
  70.             $content .= $font->getContent($this->rtf);         
  71.         }              
  72.         $content .= $text.'}'."\r\n";
  73.                
  74.         $this->elements[] = $content;      
  75.     }
  76.    
  77.     function writeHyperLink($hyperlink, $text, &$font, &$parFormat) {    
  78.         $content = (is_a($parFormat, 'ParFormat') && count($this->elements) != 0) && empty($this->emptyPar) ? '\par ' : '';    
  79.         $this->emptyPar = false;  
  80.         $content .= is_a($parFormat, 'ParFormat') ? $this->pard.$parFormat->getContent($this->rtf) : '';
  81.        
  82.         $this->elements[] = $content.'{\field {\*\fldinst {HYPERLINK "'.$hyperlink.'"}}{\\fldrslt {';
  83.         $null = null;
  84.         $this->writeText($text, $font, $null);
  85.         $this->elements[] .= '}}}'."\r\n"; 
  86.        
  87.     }
  88.         function &addTable($alignment = 'left') {      
  89.         $this->emptyPar = false;  
  90.         $table = new Table($this, $alignment);
  91.         $this->elements[] = &$table;               
  92.         return $table;
  93.     }
  94.    
  95.     function &addImage($fileName, &$parFormat, $width = 0, $height = 0) {  
  96.         $this->emptyPar = false;   
  97.         $image = new Image($this->rtf, $fileName, $parFormat, $width, $height);    
  98.         $this->elements[] = &$image;       
  99.         return $image;
  100.     }
  101.         function getContent() {  
  102.         $content = '';
  103.      
  104.         foreach($this->elements as $key => $value) {           
  105.             if (is_string($value)) {   
  106.                 $content .= $value;            
  107.             } else {                                           
  108.                 if ($key != 0
  109.                     && is_a($value, 'Table')
  110.                     && !is_a($this->elements[$key - 1], 'Table'))
  111.                 {                  
  112.                     $content .= '\par';
  113.                 } else if (is_a($value, 'Image')) {
  114.                     if (is_a($value->parFormat, 'ParFormat')) {
  115.                         $content .= $key != 0 ? '\par' : '';
  116.                         $content .= $this->pard.$value->parFormat->getContent($this->rtf);
  117.                     }
  118.                 }              
  119.                                
  120.                 $content .= $value->getContent();          
  121.             }          
  122.         }    
  123.        
  124.         return $content;
  125.     }    
  126. }
  127. ?>

La lìnea en la que me marca el error es:

$content = (is_a($parFormat, 'ParFormat') && count($this->elements) != 0 && empty($this->emptyPar)) ? '\par ' : '';

Última edición por jam1138; 27/05/2009 a las 10:24