묻고답하기


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 남기남
smartset 지식인XE Ver1.1.2에서 내용읽는 화면이 깨지는 현상... [1] 2011.08.14 by ForHanbi
마지막드론 계시판 확장변수에 대하여 여쭤봅니다. [1] 2011.08.14 by 스켈링턴
햇내기 기본 URL은 어디에 저장되는지요? [1] 2011.08.14 by 휘즈
호랑 게시판 제목 글꼴을 변경하고 싶습니다. [1] 2011.08.14 by 스켈링턴
94DT 메뉴 클릭시 도메인사이트로 이동 .. 급합니다. [1] 2011.08.14 by 스켈링턴
하나정밀 게시판 자료 문의입니다. [1] 2011.08.14 by 감로수
StanHolic 이거 아시는 분 있나욤? 이전글 다음글 출력하는거 [1] 2011.08.15 by 스켈링턴
djaos 제로보드에 올린 이미지,사진 외부로 복사하면 엑박뜨게 하는방법좀 알려주세요 [1] 2011.08.15 by 하늘종
아드린느 윈도우7으로 버전업한 후부터 관리자 페이지에 들어가지질 않습니다. [1] 2011.08.15 by 하늘종
94DT 쉬운설치 에러 [1] 2011.08.15 by 하늘종
wkwkw 그룹관리 목록 [1] 2011.08.15 by 글문
김지현677 첨부파일 본문 삽입시 플레이어의 사이즈 조절  
StanHolic 이전글..다음글 출력하는거 아시는 분 있나요? [1] file 2011.08.15 by 하은이아빠
StanHolic SocialXE 서버에 API 요청이 실패했습니다. [1] 2011.08.15 by 하은이아빠
pys2011 한글도메인 첨부파일 오류 해결 방안이 없나요?  
세필렌 게시판생성관련문의 입니다. [1] 2011.08.15 by 송동우
띵똥 급해요ㅜㅜ 최신버전 업데이트 질문이요  
정은미915 위젯 사라지는 현상..(운영중인 홈페이지 도움주세요~) [2] 2011.08.15 by 송동우
smartset 홈페이지 접속하면 로그인페이지 먼저 뜨게 하기... [1] 2011.08.15 by 송동우
ohmyvkpop 꼭 좀 도와 주세요 [1] 2011.08.15 by 송동우