english comments added

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0_english@8278 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
mosmartin 2011-04-06 16:48:06 +00:00
parent 693e215bc1
commit 4d272994dd
219 changed files with 6407 additions and 8705 deletions

View file

@ -2,23 +2,23 @@
/**
* @class widgetAdminView
* @author NHN (developers@xpressengine.com)
* @brief widget 모듈의 admin view class
* @brief admin view class for widget modules
**/
class widgetAdminView extends widget {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
$this->setTemplatePath($this->module_path.'tpl');
}
/**
* @brief 위젯 목록을 보여줌
* @brief Showing a list of widgets
**/
function dispWidgetAdminDownloadedList() {
// 위젯 목록을 세팅
// Set widget list
$oWidgetModel = &getModel('widget');
$widget_list = $oWidgetModel->getDownloadedWidgetList();
Context::set('widget_list', $widget_list);
@ -27,7 +27,7 @@
}
/**
* @brief 내용 직접 입력 위젯 팝업창 내용을 꾸힘
* @brief For information on direct entry widget popup kkuhim
**/
function dispWidgetAdminAddContent() {
$module_srl = Context::get('module_srl');
@ -41,8 +41,7 @@
$oModuleModel = &getModel('module');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
Context::set('module_info', $module_info);
// 에디터 모듈의 getEditor를 호출하여 세팅
// Editors settings of the module by calling getEditor
$oEditorModel = &getModel('editor');
$editor = $oEditorModel->getModuleEditor('document',$module_srl, $module_srl,'module_srl','content');
Context::set('editor', $editor);

View file

@ -2,20 +2,19 @@
/**
* @class widget
* @author NHN (developers@xpressengine.com)
* @brief widget 모듈의 high class
* @brief widget module's high class
**/
class widget extends ModuleObject {
/**
* @brief 설치시 추가 작업이 필요할시 구현
* @brief Implement if additional tasks are necessary when installing
**/
function moduleInstall() {
// widget 에서 사용할 cache디렉토리 생성
// Create cache directory used by widget
FileHandler::makeDir('./files/cache/widget');
FileHandler::makeDir('./files/cache/widget_cache');
// widget compile을 위한 display.after 트리거 추가
// Add this widget compile the trigger for the display.after
$oModuleController = &getController('module');
$oModuleController->insertTrigger('display', 'widget', 'controller', 'triggerWidgetCompile', 'before');
@ -23,25 +22,23 @@
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
* @brief a method to check if successfully installed
**/
function checkUpdate() {
$oModuleModel = &getModel('module');
// widget compile을 위한 display.after 트리거 추가 (2009. 04. 14)
// widget compile display.after trigger for further (04/14/2009)
if(!$oModuleModel->getTrigger('display', 'widget', 'controller', 'triggerWidgetCompile', 'before')) return true;
return false;
}
/**
* @brief 업데이트 실행
* @brief Execute update
**/
function moduleUpdate() {
$oModuleModel = &getModel('module');
$oModuleController = &getController('module');
// widget compile을 위한 display.after 트리거 추가 (2009. 04. 14)
// widget compile display.after trigger for further (04/14/2009)
if(!$oModuleModel->getTrigger('display', 'widget', 'controller', 'triggerWidgetCompile', 'before')) {
$oModuleController->insertTrigger('display', 'widget', 'controller', 'triggerWidgetCompile', 'before');
}
@ -50,13 +47,12 @@
}
/**
* @brief 캐시 파일 재생성
* @brief Re-generate the cache file
**/
function recompileCache() {
// widget 정보를 담은 캐시 파일 삭제
// delete the cache files containing information widget
FileHandler::removeFilesInDir("./files/cache/widget");
// widget 생성 캐시 파일 삭제
// delete the cache files created widget
FileHandler::removeFilesInDir("./files/cache/widget_cache");
}

View file

@ -2,27 +2,27 @@
/**
* @class widgetController
* @author NHN (developers@xpressengine.com)
* @brief widget 모듈의 Controller class
* @brief Controller class for widget modules
**/
class widgetController extends widget {
// 위젯을 결과물이 아닌 수정/삭제등을 하기 위한 곳에서 사용하기 위한 flag
// layout_javascript_mode 는 모든 결과물까지 포함하여 javascript mode로 변환시킴
// The results are not widget modify/delete and where to use the flag for
// layout_javascript_mode include all the results into the javascript mode Sikkim
var $javascript_mode = false;
var $layout_javascript_mode = false;
// 위젯 캐시 파일이 생성되는 곳
// Where the cache files are created widget
var $cache_path = './files/cache/widget_cache/';
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 선택된 위젯 - 스킨의 컬러셋을 return
* @brief Selected photos - the return of the skin-color three
**/
function procWidgetGetColorsetList() {
$widget = Context::get('selected_widget');
@ -42,7 +42,7 @@
}
/**
* @brief 위젯의 생성된 코드를 return
* @brief Return the generated code of the widget
**/
function procWidgetGenerateCode() {
$widget = Context::get('selected_widget');
@ -52,13 +52,12 @@
$attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars);
$widget_code = sprintf('<img class="zbxe_widget_output" widget="%s" %s />', $widget, implode(' ',$attribute));
// 코드 출력
// Code output
$this->add('widget_code', $widget_code);
}
/**
* @brief 페이지 수정시 위젯 코드의 생성 요청
* @brief Edit page request for the creation of the widget code
**/
function procWidgetGenerateCodeInPage() {
$widget = Context::get('selected_widget');
@ -67,15 +66,14 @@
if(!in_array($widget,array('widgetBox','widgetContent')) && !Context::get('skin')) return new Object(-1,Context::getLang('msg_widget_skin_is_null'));
$attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars);
// 결과물을 구함
// Wanted results
$widget_code = $this->execute($widget, $vars, true, false);
$this->add('widget_code', $widget_code);
}
/**
* @brief 위젯스타일에 이미지 업로드
* @brief Upload widget styles
**/
function procWidgetStyleExtraImageUpload(){
$attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars);
@ -87,11 +85,10 @@
}
/**
* @brief 컨텐츠 위젯 추가
* @brief Add content widget
**/
function procWidgetInsertDocument() {
// 변수 구함
// Variable Wanted
$module_srl = Context::get('module_srl');
$document_srl = Context::get('document_srl');
$content = Context::get('content');
@ -101,15 +98,13 @@
$oLayoutModel = &getModel('layout');
$layout_info = $oLayoutModel->getLayout($module_srl);
if(!$layout_info || $layout_info->type != 'faceoff') $err++;
// 대상 페이지 모듈 정보 구함
// Destination Information Wanted page module
$oModuleModel = &getModel('module');
$page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
if(!$page_info->module_srl || $page_info->module != 'page') $err++;
if($err > 1) return new Object(-1,'msg_invalid_request');
// 권한 체크
// Check permissions
$is_logged = Context::get('is_logged');
$logged_info = Context::get('logged_info');
$user_group = $logged_info->group_list;
@ -121,9 +116,7 @@
}
}
if(!$is_admin && !$is_logged && $logged_info->is_admin != 'Y' && !$oModuleModel->isSiteAdmin($logged_info) && !(is_array($page_info->admin_id) && in_array($logged_infoi->user_id, $page_info->admin_id))) return new Object(-1,'msg_not_permitted');
// 글 입력
// Enter post
$oDocumentModel = &getModel('document');
$oDocumentController = &getController('document');
@ -138,19 +131,17 @@
$output = $oDocumentController->insertDocument($obj);
$obj->document_srl = $output->get('document_srl');
}
// 오류 발생시 멈춤
// Stop when an error occurs
if(!$output->toBool()) return $output;
// 결과를 리턴
// Return results
$this->add('document_srl', $obj->document_srl);
}
/**
* @brief 컨텐츠 위젯 복사
* @brief Copy the content widget
**/
function procWidgetCopyDocument() {
// 변수 구함
// Variable Wanted
$document_srl = Context::get('document_srl');
$oDocumentModel = &getModel('document');
@ -160,13 +151,11 @@
$oDocument = $oDocumentModel->getDocument($document_srl, true);
if(!$oDocument->isExists()) return new Object(-1,'msg_invalid_request');
$module_srl = $oDocument->get('module_srl');
// 대상 페이지 모듈 정보 구함
// Destination Information Wanted page module
$oModuleModel = &getModel('module');
$page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
if(!$page_info->module_srl || $page_info->module != 'page') return new Object(-1,'msg_invalid_request');
// 권한 체크
// Check permissions
$is_logged = Context::get('is_logged');
$logged_info = Context::get('logged_info');
$user_group = $logged_info->group_list;
@ -181,17 +170,16 @@
$output = $oDocumentAdminController->copyDocumentModule(array($oDocument->get('document_srl')), $oDocument->get('module_srl'),0);
if(!$output->toBool()) return $output;
// 결과를 리턴
// Return results
$copied_srls = $output->get('copied_srls');
$this->add('document_srl', $copied_srls[$oDocument->get('document_srl')]);
}
/**
* @brief 위젯 삭제
* @brief Deleting widgets
**/
function procWidgetDeleteDocument() {
// 변수 구함
// Variable Wanted
$document_srl = Context::get('document_srl');
$oDocumentModel = &getModel('document');
@ -200,13 +188,11 @@
$oDocument = $oDocumentModel->getDocument($document_srl, true);
if(!$oDocument->isExists()) return new Object();
$module_srl = $oDocument->get('module_srl');
// 대상 페이지 모듈 정보 구함
// Destination Information Wanted page module
$oModuleModel = &getModel('module');
$page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
if(!$page_info->module_srl || $page_info->module != 'page') return new Object(-1,'msg_invalid_request');
// 권한 체크
// Check permissions
$is_logged = Context::get('is_logged');
$logged_info = Context::get('logged_info');
$user_group = $logged_info->group_list;
@ -224,15 +210,15 @@
}
/**
* @brief 위젯 코드를 Javascript로 수정/드래그등을 하기 위한 Javascript 수정 모드로 변환
* @brief Modify the code in Javascript widget/Javascript edit mode for dragging and converted to
**/
function setWidgetCodeInJavascriptMode() {
$this->layout_javascript_mode = true;
}
/**
* @brief 위젯 코드를 컴파일하여 내용을 출력하는 trigger
* display::before 에서 호출됨
* @brief Widget code compiles and prints the information to trigger
* display:: before invoked in
**/
function triggerWidgetCompile(&$content) {
if(Context::getResponseMethod()!='HTML') return new Object();
@ -241,27 +227,24 @@
}
/**
* @breif 특정 content의 위젯 태그들을 변환하여 return
* @breif By converting the specific content of the widget tag return
**/
function transWidgetCode($content, $javascript_mode = false) {
// 사용자 정의 언어 변경
// Changing user-defined language
$oModuleController = &getController('module');
$oModuleController->replaceDefinedLangCode($content);
// 편집 정보 포함 여부 체크
// Check whether to include information about editing
$this->javascript_mode = $javascript_mode;
// 박스 위젯 코드 변경
// Widget code box change
$content = preg_replace_callback('!<div([^\>]*)widget=([^\>]*?)\><div><div>((<img.*?>)*)!is', array($this,'transWidgetBox'), $content);
// 내용 위젯 코드 벼경
// Widget code information byeogyeong
$content = preg_replace_callback('!<img([^\>]*)widget=([^\>]*?)\>!is', array($this,'transWidget'), $content);
return $content;
}
/**
* @brief 위젯 코드를 실제 코드로 변경
* @brief Widget code with the actual code changes
**/
function transWidget($matches) {
$buff = trim($matches[0]);
@ -280,7 +263,7 @@
}
/**
* @brief 위젯 박스를 실제 코드로 변경
* @brief Widget box with the actual code changes
**/
function transWidgetBox($matches) {
$buff = preg_replace('/<div><div>(.*)$/i','</div>',$matches[0]);
@ -297,14 +280,13 @@
}
/**
* @brief 특정 content내의 위젯을 다시 생성
* 페이지모듈등에서 위젯 캐시파일 재생성시 사용
* @brief Re-create specific content within a widget
* Widget on the page and create cache file in the module using
**/
function recompileWidget($content) {
// 언어 종류 가져옴
// Language in bringing
$lang_list = Context::get('lang_supported');
// 위젯 캐시 sequence 를 가져옴
// Bringing widget cache sequence
preg_match_all('!<img([^\>]*)widget=([^\>]*?)\>!is', $content, $matches);
$oXmlParser = new XmlParser();
@ -316,8 +298,7 @@
$args = $xml_doc->img->attrs;
if(!$args) continue;
// 캐싱하지 않을 경우 패스
// If you are not caching path
$widget = $args->widget;
$sequence = $args->widget_sequence;
$cache = $args->widget_cache;
@ -326,8 +307,7 @@
if(count($args)) {
foreach($args as $k => $v) $args->{$k} = urldecode($v);
}
// 언어별로 위젯 캐시 파일이 있을 경우 재생성
// If the cache file for each language widget regeneration
foreach($lang_list as $lang_type => $val) {
$cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $sequence, $lang_type);
if(!file_exists($cache_file)) continue;
@ -337,18 +317,17 @@
}
/**
* @brief 위젯 캐시 처리
* @brief Widget cache handling
**/
function getCache($widget, $args, $lang_type = null, $ignore_cache = false) {
// 지정된 언어가 없으면 현재 언어 지정
// If the specified language specifies the current language
if(!$lang_type) $lang_type = Context::getLangType();
// widget, 캐시 번호와 캐시값이 설정되어 있는지 확인
// widget, the cache number and cache values are set
$widget_sequence = $args->widget_sequence;
$widget_cache = $args->widget_cache;
/**
* 캐시 번호와 캐시 값이 아예 없으면 바로 데이터를 추출해서 리턴
* Even if the cache number and value of the cache and return it to extract data
**/
if(!$ignore_cache && (!$widget_cache || !$widget_sequence)) {
$oWidget = $this->getWidgetObject($widget);
@ -357,18 +336,15 @@
}
/**
* 캐시 번호와 캐시값이 설정되어 있으면 캐시 파일을 불러오도록
* Cache number and cache values are set so that the cache file should call
**/
if(!is_dir($this->cache_path)) FileHandler::makeDir($this->cache_path);
// 캐시파일명을 구함
// Wanted cache file
$cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $widget_sequence, $lang_type);
// 캐시 파일이 존재하면 해당 파일의 유효성 검사
// If the file exists in the cache, the file validation
if(!$ignore_cache && file_exists($cache_file)) {
$filemtime = filemtime($cache_file);
// 수정 시간을 비교해서 캐싱중이어야 하거나 widget.controller.php 파일보다 나중에 만들어 졌다면 캐시값을 return
// Should be modified compared to the time of the cache or in the future if creating more than widget.controller.php file a return value of the cache
if($filemtime + $widget_cache * 60 > time() && $filemtime > filemtime(_XE_PATH_.'modules/widget/widget.controller.php')) {
$cache_body = FileHandler::readFile($cache_file);
$cache_body = preg_replace('@<\!--#Meta:@', '<!--Meta:', $cache_body);
@ -376,8 +352,7 @@
return $cache_body;
}
}
// cache 파일의 mtime 갱신하고 캐시 갱신
// cache update and cache renewal of the file mtime
touch($cache_file);
$oWidget = $this->getWidgetObject($widget);
@ -390,16 +365,15 @@
}
/**
* @brief 위젯이름과 인자를 받아서 결과를 생성하고 결과 리턴
* 태그 사용 templateHandler에서 $this->execute() 실행하는 코드로 대체하게 된다
* @brief Widget name and argument and produce a result and Return the results
* Tags used in templateHandler $this-&gt; execute() will be replaced by the code running
*
* $javascript_mode가 true일 경우 페이지 수정시 위젯 핸들링을 위한 코드까지 포함함
* $Javascript_mode is true when editing your page by the code for handling Includes photos
**/
function execute($widget, $args, $javascript_mode = false, $escaped = true) {
// 디버그를 위한 위젯 실행 시간 저장
// Save for debug run-time widget
if(__DEBUG__==3) $start = getMicroTime();
// args값에서 urldecode를 해줌
// urldecode the value of args haejum
$object_vars = get_object_vars($args);
if(count($object_vars)) {
foreach($object_vars as $key => $val) {
@ -409,13 +383,12 @@
}
/**
* 위젯이 widgetContent/ widgetBox가 아니라면 내용을 구함
* Widgets widgetContent/widgetBox Wanted If you are not content
**/
$widget_content = '';
if($widget != 'widgetContent' && $widget != 'widgetBox') {
if(!is_dir(sprintf(_XE_PATH_.'widgets/%s/',$widget))) return;
// 위젯의 내용을 담을 변수
// Hold the contents of the widget parameter
$widget_content = $this->getCache($widget, $args);
}
@ -424,13 +397,11 @@
}
/**
* 관리자가 지정한 위젯의 style을 구함
* Wanted specified by the administrator of the widget style
**/
// 가끔 잘못된 코드인 background-image:url(none)이 들어 있을 수가 있는데 이럴 경우 none에 대한 url을 요청하므로 무조건 제거함
// Sometimes the wrong code, background-image: url (none) can be heard but none in this case, the request for the url so unconditionally Removed
$style = preg_replace('/url\((.+)(\/?)none\)/is','', $args->style);
// 내부 여백을 둔 것을 구해서 style문으로 미리 변경해 놓음
// Find a style statement that based on the internal margin dropping pre-change
$widget_padding_left = $args->widget_padding_left;
$widget_padding_right = $args->widget_padding_right;
$widget_padding_top = $args->widget_padding_top;
@ -438,18 +409,17 @@
$inner_style = sprintf("padding:%dpx %dpx %dpx %dpx !important; padding:none !important;", $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left);
/**
* 위젯 출력물을 구함
* Wanted widget output
**/
$widget_content_header = '';
$widget_content_body = '';
$widget_content_footer = '';
// 일반 페이지 호출일 경우 지정된 스타일만 꾸면서 바로 return 함
// If general call is given on page styles should return immediately dreamin '
if(!$javascript_mode) {
if($args->id) $args->id = ' id="'.$args->id.'" ';
switch($widget) {
// 내용 직접 추가일 경우
// If a direct orthogonal addition information
case 'widgetContent' :
if($args->document_srl) {
$oDocumentModel = &getModel('document');
@ -458,8 +428,7 @@
} else {
$body = base64_decode($args->body);
}
// 에디터컴포넌트 변경
// Change the editor component
$oEditorController = &getController('editor');
$body = $oEditorController->transComponent($body);
@ -468,26 +437,23 @@
$widget_content_footer = '</div></div>';
break;
// 위젯 박스일 경우
// If the widget box; it could
case 'widgetBox' :
$widget_content_header = sprintf('<div %sstyle="overflow:hidden;%s;"><div style="%s"><div>', $args->id, $style, $inner_style);
$widget_content_body = $widgetbox_content;
break;
// 일반 위젯일 경우
// If the General wijetil
default :
$widget_content_header = sprintf('<div %sstyle="overflow:hidden;%s">',$args->id,$style);
$widget_content_body = sprintf('<div style="*zoom:1;%s">%s</div>', $inner_style,$widget_content);
$widget_content_footer = '</div>';
break;
}
// 페이지 수정시에 호출되었을 경우 위젯 핸들링을 위한 코드 추가
// Edit page is called when a widget if you add the code for handling
} else {
switch($widget) {
// 내용 직접 추가일 경우
// If a direct orthogonal addition information
case 'widgetContent' :
if($args->document_srl) {
$oDocumentModel = &getModel('document');
@ -496,8 +462,7 @@
} else {
$body = base64_decode($args->body);
}
// args 정리
// by args
$attribute = array();
if($args) {
foreach($args as $key => $val) {
@ -528,11 +493,9 @@
'</div>',base64_encode($body));
break;
// 위젯 박스일 경우
// If the widget box; it could
case 'widgetBox' :
// args 정리
// by args
$attribute = array();
if($args) {
foreach($args as $key => $val) {
@ -552,10 +515,9 @@
$widget_content_body = $widgetbox_content;
break;
// 일반 위젯일 경우
// If the General wijetil
default :
// args 정리
// by args
$attribute = array();
if($args) {
$allowed_key = array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget');
@ -581,37 +543,31 @@
break;
}
}
// 위젯 스타일을 컴파일 한다.
// Compile the widget style.
if($args->widgetstyle) $widget_content_body = $this->compileWidgetStyle($args->widgetstyle,$widget, $widget_content_body, $args, $javascript_mode);
$output = $widget_content_header . $widget_content_body . $widget_content_footer;
// 위젯 결과물 생성 시간을 debug 정보에 추가
// Debug widget creation time information added to the results
if(__DEBUG__==3) $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start;
// 결과 return
// Return result
return $output;
}
/**
* @brief 위젯 객체를 return
* @brief Return widget object
**/
function getWidgetObject($widget) {
if(!$GLOBALS['_xe_loaded_widgets_'][$widget]) {
// 일단 위젯의 위치를 찾음
// Finding the location of a widget
$oWidgetModel = &getModel('widget');
$path = $oWidgetModel->getWidgetPath($widget);
// 위젯 클래스 파일을 찾고 없으면 에러 출력 (html output)
// If you do not find the class file error output widget (html output)
$class_file = sprintf('%s%s.class.php', $path, $widget);
if(!file_exists($class_file)) return sprintf(Context::getLang('msg_widget_is_not_exists'), $widget);
// 위젯 클래스를 include
// Widget classes include
require_once($class_file);
// 객체 생성
// Creating Objects
$tmp_fn = create_function('', "return new {$widget}();");
$oWidget = $tmp_fn();
if(!is_object($oWidget)) return sprintf(Context::getLang('msg_widget_object_is_null'), $widget);
@ -630,8 +586,7 @@
if(!$widgetStyle) return $widget_content_body;
$oWidgetModel = &getModel('widget');
// 위젯 스타일의 extra_var를 가져와 묶는다
// Bring extra_var widget style tie
$widgetstyle_info = $oWidgetModel->getWidgetStyleInfo($widgetStyle);
if(!$widgetstyle_info) return $widget_content_body;
@ -650,8 +605,7 @@
}else{
Context::set('widget_content', $widget_content_body);
}
// 컴파일
// Compilation
$widgetstyle_path = $oWidgetModel->getWidgetStylePath($widgetStyle);
$oTemplate = &TemplateHandler::getInstance();
$tpl = $oTemplate->compile($widgetstyle_path, 'widgetstyle');
@ -660,7 +614,7 @@
}
/**
* @brief request 변수와 위젯 정보를 통해 변수 정렬
* @brief request parameters and variables sort through the information widget
**/
function arrangeWidgetVars($widget, $request_vars, &$vars) {
$oWidgetModel = &getModel('widget');
@ -686,8 +640,7 @@
$vars->{$key} = trim($request_vars->{$key});
}
}
// 위젯 스타일이 있는 경우
// If the widget style
if($request_vars->widgetstyle){
$widgetStyle_info = $oWidgetModel->getWidgetStyleInfo($request_vars->widgetstyle);
if(count($widgetStyle_info->extra_var)) {

View file

@ -3,19 +3,19 @@
* @class widgetModel
* @author NHN (developers@xpressengine.com)
* @version 0.1
* @brief widget 모듈의 Model class
* @brief Model class for widget modules
**/
class widgetModel extends widget {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 위젯의 경로를 구함
* @brief Wanted widget's path
**/
function getWidgetPath($widget_name) {
$path = sprintf('./widgets/%s/', $widget_name);
@ -26,7 +26,7 @@
/**
* @brief 위젯 스타일의 경로를 구함
* @brief Wanted widget style path
**/
function getWidgetStylePath($widgetStyle_name) {
$path = sprintf('./widgetstyles/%s/', $widgetStyle_name);
@ -36,7 +36,7 @@
}
/**
* @brief 위젯 스타일의 경로를 구함
* @brief Wanted widget style path
**/
function getWidgetStyleTpl($widgetStyle_name) {
$path = $this->getWidgetStylePath($widgetStyle_name);
@ -45,22 +45,20 @@
}
/**
* @brief 위젯의 종류와 정보를 구함
* 다운로드되어 있는 위젯의 종류 (생성과 다른 의미)
* @brief Wanted photos of the type and information
* Download a widget with type (generation and other means)
**/
function getDownloadedWidgetList() {
// 다운받은 위젯과 설치된 위젯의 목록을 구함
// 've Downloaded the widget and the widget's list of installed Wanted
$searched_list = FileHandler::readDir('./widgets');
$searched_count = count($searched_list);
if(!$searched_count) return;
sort($searched_list);
// 찾아진 위젯 목록을 loop돌면서 필요한 정보를 간추려 return
// D which pertain to the list of widgets loop spins return statement review the information you need
for($i=0;$i<$searched_count;$i++) {
// 위젯의 이름
// The name of the widget
$widget = $searched_list[$i];
// 해당 위젯의 정보를 구함
// Wanted information on the Widget
$widget_info = $this->getWidgetInfo($widget);
$list[] = $widget_info;
@ -69,22 +67,20 @@
}
/**
* @brief 위젯의 종류와 정보를 구함
* 다운로드되어 있는 위젯의 종류 (생성과 다른 의미)
* @brief Wanted photos of the type and information
* Download a widget with type (generation and other means)
**/
function getDownloadedWidgetStyleList() {
// 다운받은 위젯과 설치된 위젯의 목록을 구함
// 've Downloaded the widget and the widget's list of installed Wanted
$searched_list = FileHandler::readDir('./widgetstyles');
$searched_count = count($searched_list);
if(!$searched_count) return;
sort($searched_list);
// 찾아진 위젯 목록을 loop돌면서 필요한 정보를 간추려 return
// D which pertain to the list of widgets loop spins return statement review the information you need
for($i=0;$i<$searched_count;$i++) {
// 위젯의 이름
// The name of the widget
$widgetStyle = $searched_list[$i];
// 해당 위젯의 정보를 구함
// Wanted information on the Widget
$widgetStyle_info = $this->getWidgetStyleInfo($widgetStyle);
$list[] = $widgetStyle_info;
@ -94,19 +90,17 @@
/**
* @brief 모듈의 conf/info.xml 읽어서 정보를 구함
* 이것 역시 캐싱을 통해서 xml parsing 시간을 줄인다..
* @brief Modules conf/info.xml wanted to read the information
* It uses caching to reduce time for xml parsing ..
**/
function getWidgetInfo($widget) {
// 요청된 모듈의 경로를 구한다. 없으면 return
// Get a path of the requested module. Return if not exists.
$widget_path = $this->getWidgetPath($widget);
if(!$widget_path) return;
// 현재 선택된 모듈의 스킨의 정보 xml 파일을 읽음
// Read the xml file for module skin information
$xml_file = sprintf("%sconf/info.xml", $widget_path);
if(!file_exists($xml_file)) return;
// cache 파일을 비교하여 문제 없으면 include하고 $widget_info 변수를 return
// If the problem by comparing the cache file and include the return variable $widget_info
$cache_file = sprintf('./files/cache/widget/%s.%s.cache.php', $widget, Context::getLangType());
@ -114,8 +108,7 @@
@include($cache_file);
return $widget_info;
}
// cache 파일이 없으면 xml parsing하고 변수화 한 후에 캐시 파일에 쓰고 변수 바로 return
// If no cache file exists, parse the xml and then return the variable.
$oXmlParser = new XmlParser();
$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
$xml_obj = $tmp_xml_obj->widget;
@ -124,7 +117,7 @@
$buff = '';
if($xml_obj->version && $xml_obj->attrs->version == '0.2') {
// 위젯의 제목, 버전
// Title of the widget, version
$buff .= sprintf('$widget_info->widget = "%s";', $widget);
$buff .= sprintf('$widget_info->path = "%s";', $widget_path);
$buff .= sprintf('$widget_info->title = "%s";', $xml_obj->title->body);
@ -138,8 +131,7 @@
$buff .= sprintf('$widget_info->license_link = "%s";', $xml_obj->license->attrs->link);
$buff .= sprintf('$widget_info->widget_srl = $widget_srl;');
$buff .= sprintf('$widget_info->widget_title = $widget_title;');
// 작성자 정보
// Author information
if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
else $author_list = $xml_obj->author;
@ -183,8 +175,7 @@
}
} else {
// 위젯의 제목, 버전
// Title of the widget, version
$buff .= sprintf('$widget_info->widget = "%s";', $widget);
$buff .= sprintf('$widget_info->path = "%s";', $widget_path);
$buff .= sprintf('$widget_info->title = "%s";', $xml_obj->title->body);
@ -195,15 +186,12 @@
$buff .= sprintf('$widget_info->date = "%s";', $date);
$buff .= sprintf('$widget_info->widget_srl = $widget_srl;');
$buff .= sprintf('$widget_info->widget_title = $widget_title;');
// 작성자 정보
// Author information
$buff .= sprintf('$widget_info->author[0]->name = "%s";', $xml_obj->author->name->body);
$buff .= sprintf('$widget_info->author[0]->email_address = "%s";', $xml_obj->author->attrs->email_address);
$buff .= sprintf('$widget_info->author[0]->homepage = "%s";', $xml_obj->author->attrs->link);
}
// 추가 변수 (템플릿에서 사용할 제작자 정의 변수)
// Extra vars (user defined variables to use in a template)
$extra_var_groups = $xml_obj->extra_vars->group;
if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
@ -262,8 +250,8 @@
/**
* @brief 모듈의 conf/info.xml 읽어서 정보를 구함
* 이것 역시 캐싱을 통해서 xml parsing 시간을 줄인다..
* @brief Modules conf/info.xml wanted to read the information
* It uses caching to reduce time for xml parsing ..
**/
function getWidgetStyleInfo($widgetStyle) {
@ -271,24 +259,21 @@
if(!$widgetStyle_path) return;
$xml_file = sprintf("%sskin.xml", $widgetStyle_path);
if(!file_exists($xml_file)) return;
// cache 파일을 비교하여 문제 없으면 include하고 $widgetStyle_info 변수를 return
// If the problem by comparing the cache file and include the return variable $widgetStyle_info
$cache_file = sprintf('./files/cache/widgetstyles/%s.%s.cache.php', $widgetStyle, Context::getLangType());
if(file_exists($cache_file)&&filemtime($cache_file)>filemtime($xml_file)) {
@include($cache_file);
return $widgetStyle_info;
}
// cache 파일이 없으면 xml parsing하고 변수화 한 후에 캐시 파일에 쓰고 변수 바로 return
// If no cache file exists, parse the xml and then return the variable.
$oXmlParser = new XmlParser();
$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
$xml_obj = $tmp_xml_obj->widgetstyle;
if(!$xml_obj) return;
$buff = '';
// 위젯의 제목, 버전
// Title of the widget, version
$buff .= sprintf('$widgetStyle_info->widgetStyle = "%s";', $widgetStyle);
$buff .= sprintf('$widgetStyle_info->path = "%s";', $widgetStyle_path);
$buff .= sprintf('$widgetStyle_info->title = "%s";', $xml_obj->title->body);
@ -305,8 +290,7 @@
if(!$xml_obj->preview->body) $xml_obj->preview->body = 'preview.jpg';
$preview_file = sprintf("%s%s", $widgetStyle_path,$xml_obj->preview->body);
if(file_exists($preview_file)) $buff .= sprintf('$widgetStyle_info->preview = "%s";', $preview_file);
// 작성자 정보
// Author information
if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
else $author_list = $xml_obj->author;
@ -348,9 +332,7 @@
}
}
}
// 추가 변수 (템플릿에서 사용할 제작자 정의 변수)
// Extra vars (user defined variables to use in a template)
$extra_var_groups = $xml_obj->extra_vars->group;
if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);

View file

@ -2,64 +2,58 @@
/**
* @class widgetView
* @author NHN (developers@xpressengine.com)
* @brief widget 모듈의 View class
* @brief View class of the widget modules
**/
class widgetView extends widget {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
$this->setTemplatePath($this->module_path.'tpl');
}
/**
* @brief 위젯의 상세 정보(conf/info.xml) 팝업 출력
* @brief Details of the widget (conf/info.xml) a pop-out
**/
function dispWidgetInfo() {
// 위젯 스킨명이 있을 경우 위젯 스킨 상세 정보 함수로 출력
// If people have skin widget widget output as a function of the skin More Details
if(Context::get('skin')) return $this->dispWidgetSkinInfo();
// 선택된 위젯 정보를 구함
// Wanted widget is selected information
$oWidgetModel = &getModel('widget');
$widget_info = $oWidgetModel->getWidgetInfo(Context::get('selected_widget'));
Context::set('widget_info', $widget_info);
// 위젯을 팝업으로 지정
// Specifies the widget to pop up
$this->setLayoutFile('popup_layout');
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('widget_detail_info');
}
/**
* @brief 위젯 스킨의 상세 정보(skin.xml) 팝업 출력
* @brief Widget details of the skin (skin.xml) a pop-out
**/
function dispWidgetSkinInfo() {
$widget = Context::get('selected_widget');
$skin = Context::get('skin');
$path = sprintf('./widgets/%s/', $widget);
// 선택된 위젯 정보를 구함
// Wanted widget is selected information
$oModuleModel = &getModel('module');
$skin_info = $oModuleModel->loadSkinInfo($path, $skin);
Context::set('skin_info',$skin_info);
// 위젯을 팝업으로 지정
// Specifies the widget to pop up
$this->setLayoutFile('popup_layout');
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('skin_info');
}
/**
* @brief 위젯의 코드 생성기
* @brief Widget's code generator
**/
function dispWidgetGenerateCode() {
// 선택된 위젯 정보를 구함
// Wanted widget is selected information
$oWidgetModel = &getModel('widget');
$widget_list = $oWidgetModel->getDownloadedWidgetList();
@ -72,21 +66,17 @@
Context::set('selected_widget', $selected_widget);
$oModuleModel = &getModel('module');
// 모듈 카테고리 목록을 구함
// Get a list of module categories
$module_categories = $oModuleModel->getModuleCategories();
// mid 목록을 가져옴
// Get a mid list
$site_module_info = Context::get('site_module_info');
$args->site_srl = $site_module_info->site_srl;
$mid_list = $oModuleModel->getMidList($args);
// 그룹 목록을 가져옴
// Get a list of groups
$oMemberModel = &getModel('member');
$group_list = $oMemberModel->getGroups($site_module_info->site_srl);
Context::set('group_list', $group_list);
// module_category와 module의 조합
// module_category and module combination
if($module_categories) {
foreach($mid_list as $module_srl => $module) {
$module_categories[$module->module_category_srl]->list[$module_srl] = $module;
@ -96,32 +86,26 @@
}
Context::set('mid_list',$module_categories);
// 메뉴 목록을 구함
// Menu Get a list
$output = executeQueryArray('menu.getMenus');
Context::set('menu_list',$output->data);
// 스킨의 정보를 구함
// Wanted information on skin
$skin_list = $oModuleModel->getSkins($widget_info->path);
Context::set('skin_list', $skin_list);
// 위젯을 팝업으로 지정
// Specifies the widget to pop up
$this->setLayoutFile('popup_layout');
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('widget_generate_code');
}
/**
* @brief 페이지 관리에서 사용될 코드 생성 팝업
* @brief Managing pop-up pages used in the generated code
**/
function dispWidgetGenerateCodeInPage() {
$oWidgetModel = &getModel('widget');
$widget_list = $oWidgetModel->getDownloadedWidgetList();
Context::set('widget_list',$widget_list);
// 선택된 위젯이 없을경우 첫 위젯으로
// When there is no widget is selected in the first widget
if(!Context::get('selected_widget')) Context::set('selected_widget',$widget_list[0]->widget);
$this->dispWidgetGenerateCode();
@ -129,16 +113,14 @@
}
/**
* @brief 페이지 관리에서 사용될 위젯 스타일 코드 생성 팝업
* @brief Create widget style code page used in the pop-up management
**/
function dispWidgetStyleGenerateCodeInPage() {
// 위젯 스타일 목록
// Widget-style list
$oWidgetModel = &getModel('widget');
$widgetStyle_list = $oWidgetModel->getDownloadedWidgetStyleList();
Context::set('widgetStyle_list',$widgetStyle_list);
// 선택된 위젯 스타일 목록
// Selected list of widget styles
$widgetstyle = Context::get('widgetstyle');
$widgetstyle_info = $oWidgetModel->getWidgetStyleInfo($widgetstyle);
if($widgetstyle && $widgetstyle_info){