묻고답하기


Parse error: syntax error, unexpected '<' in /www/lautec_co_kr/classes/xml/XmlLangParser.class.php on line 281
 

 

이런식으로 떳는데.. 소스를 어떤식으로 고쳐야하나요>??ㅠ.ㅠ

해당소스입니다.. ㅠㅠ

--------------------------------------------------------------------------------------------------------------------------------

<?php
/* Copyright (C) NAVER <http://www.navercorp.com> */

/**
 * XmlLangParser class
 * Change to lang php file from xml.
 * @author NAVER (developers@xpressengine.com)
 * @package /classes/xml
 * @version 0.1
 */
class XmlLangParser extends XmlParser
{

 /**
  * compiled language cache path
  * @var string
  */
 var $compiled_path = './files/cache/lang/'; // / directory path for compiled cache file
 /**
  * Target xml file
  * @var string
  */
 var $xml_file = NULL;

 /**
  * Target php file
  * @var string
  */
 var $php_file = NULL;

 /**
  * result source code
  * @var string
  */
 var $code;

 /**
  * language list, for example ko, en...
  * @var array
  */
 var $lang_types;

 /**
  * language type
  * @see _XE_PATH_.'/common/lang/lang.info'
  * @var string
  */
 var $lang_type;

 /**
  * constructor
  * @param string $xml_file
  * @param string $lang_type
  * @return void
  */
 function XmlLangParser($xml_file, $lang_type)
 {
  $this->lang_type = $lang_type;
  $this->xml_file = $xml_file;
  $this->php_file = $this->_getCompiledFileName($lang_type);
 }

 /**
  * compile a xml_file only when a corresponding php lang file does not exists or is outdated
  * @return string|bool Returns compiled php file.
  */
 function compile()
 {
  if(!file_exists($this->xml_file))
  {
   return FALSE;
  }
  if(!file_exists($this->php_file))
  {
   $this->_compile();
  }
  else
  {
   if(filemtime($this->xml_file) > filemtime($this->php_file))
   {
    $this->_compile();
   }
   else
   {
    return $this->php_file;
   }
  }

  return $this->_writeFile() ? $this->php_file : FALSE;
 }

 /**
  * Return compiled content
  * @return string Returns compiled lang source code
  */
 function getCompileContent()
 {
  if(!file_exists($this->xml_file))
  {
   return FALSE;
  }
  $this->_compile();

  return $this->code;
 }

 /**
  * Compile a xml_file
  * @return void
  */
 function _compile()
 {
  $lang_selected = Context::loadLangSelected();
  $this->lang_types = array_keys($lang_selected);

  // read xml file
  $buff = FileHandler::readFile($this->xml_file);
  $buff = str_replace('xml:lang', 'xml_lang', $buff);

  // xml parsing
  $xml_obj = parent::parse($buff);

  $item = $xml_obj->lang->item;
  if(!is_array($item))
  {
   $item = array($item);
  }
  foreach($item as $i)
  {
   $this->_parseItem($i, $var = '$lang->%s');
  }
 }

 /**
  * Writing cache file
  * @return void|bool
  */
 function _writeFile()
 {
  if(!$this->code)
  {
   return;
  }
  FileHandler::writeFile($this->php_file, "<?php\n" . $this->code);
  return false;
 }

 /**
  * Parsing item node, set content to '$this->code'
  * @param object $item
  * @param string $var
  * @return void
  */
 function _parseItem($item, $var)
 {
  $name = $item->attrs->name;
  $value = $item->value;
  $var = sprintf($var, $name);

  if($item->item)
  {
   $type = $item->attrs->type;
   $mode = $item->attrs->mode;

   if($type == 'array')
   {
    $this->code .= "if(!is_array({$var})){\n";
    $this->code .= " {$var} = array();\n";
    $this->code .= "}\n";
    $var .= '[\'%s\']';
   }
   else
   {
    $this->code .= "if(!is_object({$var})){\n";
    $this->code .= " {$var} = new stdClass();\n";
    $this->code .= "}\n";
    $var .= '->%s';
   }

   $items = $item->item;
   if(!is_array($items))
   {
    $items = array($items);
   }
   foreach($items as $item)
   {
    $this->_parseItem($item, $var);
   }
  }
  else
  {
   $code = $this->_parseValues($value, $var);
   $this->code .= $code;
  }
 }

 /**
  * Parsing value nodes
  * @param array $nodes
  * @param string $var
  * @return array|string
  */
 function _parseValues($nodes, $var)
 {
  if(!is_array($nodes))
  {
   $nodes = array($nodes);
  }

  $value = array();
  foreach($nodes as $node)
  {
   $return = $this->_parseValue($node, $var);
   if($return && is_array($return))
   {
    $value = array_merge($value, $return);
   }
  }

  if($value[$this->lang_type])
  {
   return $value[$this->lang_type];
  }
  else if($value['en'])
  {
   return $value['en'];
  }
  else if($value['ko'])
  {
   return $value['ko'];
  }

  foreach($this->lang_types as $lang_type)
  {
   if($lang_type == 'en' || $lang_type == 'ko' || $lang_type == $this->lang_type)
   {
    continue;
   }
   if($value[$lang_type])
   {
    return $value[$lang_type];
   }
  }

  return '';
 }

 /**
  * Parsing value node
  * @param object $node
  * @param string $var
  * @return array|bool
  */
 function _parseValue($node, $var)
 {
  $lang_type = $node->attrs->xml_lang;
  $value = $node->body;
  if(!$value)
  {
   return false;
  }

  $var .= '=\'' . str_replace("'", "\'", $value) . "';\n";
  return array($lang_type => $var);
 }

 /**
  * Get cache file name
  * @param string $lang_type
  * @param string $type
  * @return string
  */
 function _getCompiledFileName($lang_type, $type = 'php')
 {
  return sprintf('%s%s.%s.php', $this->compiled_path, md5($this->xml_file), $lang_type);
 }

}
/* End of file XmlLangParser.class.php */
/* Location: ./classes/xml/XmlLangParser.class.php */

글쓴이 제목 최종 글
XE 공지 글 쓰기,삭제 운영방식 변경 공지 [16] 2019.03.05 by 남기남
김동하123 이건 어떤 문제죠? [1] 2016.06.02 by HowtoXE
gothic**** XE를 설치 하였는데 게시판에서 글보기가 안됩니다.ㅠ ㅠ [2] 2016.06.02 by gothic****
김동하123 설문조사 DB에서 수정시 이상함 [2] 2016.06.02 by 김동하123
명사위 PG사 어디 쓰고 계세요 [4] 2016.06.02 by HowtoXE
티치그래피 XE 로그인 불가능 현상 도와주세요.. [1] 2016.06.02 by HowtoXE
KSG2013 분류를 일일이 지우기 힘듭니다. [1] 2016.06.02 by HowtoXE
매실696e5 첨부파일에 파일을 올리면 100%에서 멈춥니다..도와주세요 [1] file 2016.06.02 by HowtoXE
댑펑 회원가입 이메일 특정 도메인만 허용하는 방법에 대한 질문 [1] 2016.06.02 by HowtoXE
boowoon 레이아웃 적용 오류 [1] 2016.06.02 by HowtoXE
졸라맨 로그인 세션 오랜시간 동안 유지하는 방법 아시는분... [1] 2016.06.02 by HowtoXE
김호띠 스케치북 게시판오류 [1] file 2016.06.02 by HowtoXE
화이팅 xe 설치 사용 중 추가 워드프레스 설치 여부 [2] 2016.06.01 by 화이팅
jikong 아이프레임 질문드려요.  
비내리는롱비치 사이트 백지화 [4] 2016.06.01 by 비내리는롱비치
유샤인 Err : '' template file does not exists. 오류가 뜹니다. 도와주세요 [14] file 2016.06.01 by 윤씨
옴바3d535 XE4 에서 XE 으로 이전중입니다 [2] 2016.05.31 by SimpleCode
c_hye**** 오류 문의 [1] 2016.05.31 by SimpleCode
어쿠스틱18d24 사이트 메뉴 편집중 문제 발생 질문 드려요 [2] 2016.05.31 by 해피지영
홍길동친구 사이트메뉴편집 에러관련 [1] 2016.05.31 by 해피지영
ha****921ae xe/classes/db/DB.class.php on line 633 에러 문의 file  
대구미녀 게시판 선택해서 글쓰는방법 [1] 2016.05.31 by sejin7940
d@s 사용자정의 - 숫자만 입력 받을 수 있도록... [1] file 2016.05.31 by sejin7940
춥다 그림에 따른 margin 여백 [2] file 2016.05.31 by 춥다
kjmedi626 오류가 떳는데..해결이 안됩니다.. [3] 2016.05.31 by kjmedi626
kjmedi626 asp로만든 홈페이지를 XE로... [2] 2016.05.31 by kjmedi626
kjmedi626 에러가 떳어요..ㅠㅠ어케해야하죠..  
c_hye**** 사이트 질문드립니다.  
비틀즈 주소창의 index.php?mid=sub4&act=dispMemberLoginForm 이런식으로 [1] 2016.05.31 by 비틀즈
midal2 게시판 테이블이 자꾸 밀려요... ㅠㅠ file  
박하향풍선껌 특정 게시판에서만 권한 오류가 발생합니다. [2] 2016.05.31 by 박하향풍선껌