/**
     * @brief 에디터 컴포넌트가 별도의 고유 코드를 이용한다면 그 코드를 html로 변경하여 주는 method
     *
     * 이미지나 멀티미디어, 설문등 고유 코드가 필요한 에디터 컴포넌트는 고유코드를 내용에 추가하고 나서
     * DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경
     **/
    function transHTML($xml_obj)
    {
        $code_type = $xml_obj->attrs->code_type;
        $option_file_path = $xml_obj->attrs->file_path;
        $option_description = $xml_obj->attrs->description;
        $option_first_line = $xml_obj->attrs->first_line;
        $option_collapse = $xml_obj->attrs->collapse;
        $option_nogutter = $xml_obj->attrs->nogutter;
        $option_nocontrols = $xml_obj->attrs->nocontrols;
        if ($option_collapse == 'true') {
            $option = $option . 'collapse: true;';
        }
        if ($option_nogutter == 'true') {
            $option = $option . 'gutter: false;';
        }
        if ($option_nocontrols == 'true' && $option_collapse != 'true') {
            $option = $option . 'toolbar: false;';
        }
        if ($option_first_line > 1) {
            $option = $option . "first-line: " . $option_first_line . ";";
        }
        $body = $xml_obj->body;
        $body = preg_replace('@(<br\\s?/?>)(\\n)?@i', "\n", $body);
        $body = strip_tags($body);
        if (!$GLOBALS['_called_editor_component_code_highlighter_']) {
            $GLOBALS['_called_editor_component_code_highlighter_'] = true;
            $js_code = <<<dpScript
<script type="text/javascript">
SyntaxHighlighter.config.clipboardSwf = '{$this->component_path}script/clipboard.swf';
SyntaxHighlighter.all();
</script>
dpScript;
            Context::addHtmlFooter($js_code);
            Context::addCSSFile($this->component_path . 'style/shCore.css');
            Context::addCSSFile($this->component_path . 'style/shThemeDefault.css');
            Context::addJsFile($this->component_path . 'script/shCore.js');
        }
        Context::addJsFile($this->component_path . 'script/shBrush' . $code_type . '.js');
        $output = null;
        if ($option_file_path != null || $option_description != null) {
            $output .= '<div class="ch_infobox">';
            if ($option_file_path != null) {
                $output .= '<span class="file_path">' . $option_file_path . '</span>';
            }
            if ($option_description != null) {
                $output .= '<span class="description">' . $option_description . '</span>';
            }
            $output .= '</div>';
        }
        $output .= sprintf('<pre class="brush: %s;%s">%s</pre>', strtolower($code_type), $option, $body);
        return $output;
    }
 function init()
 {
     parent::init();
     $oTextyleModel =& getModel('textyle');
     if (preg_match("/TextyleTool/", $this->act) || $oTextyleModel->isAttachedMenu($this->act)) {
         Context::addJsFile("./common/js/jquery.js", true, '', -100000);
         Context::addJsFile("./common/js/x.js", true, '', -100000);
         Context::addJsFile("./common/js/common.js", true, '', -100000);
         Context::addJsFile("./common/js/js_app.js", true, '', -100000);
         Context::addJsFile("./common/js/xml_handler.js", true, '', -100000);
         Context::addJsFile("./common/js/xml_js_filter.js", true, '', -100000);
         Context::addCSSFile("./common/css/default.css", true, 'all', '', -100000);
         Context::addCSSFile("./common/css/button.css", true, 'all', '', -100000);
     } else {
         $template_path = sprintf("%sm.skins/%s/", $this->module_path, $this->module_info->mskin);
         if (!is_dir($template_path) || !$this->module_info->mskin) {
             $this->module_info->mskin = 'default';
             $template_path = sprintf("%sm.skins/%s/", $this->module_path, $this->module_info->mskin);
         }
         $this->setTemplatePath($template_path);
     }
 }
<?php

Context::addHtmlfooter('<script>
;(function($){
$.ajaxSetup({
global: false
});
})(jQuery);
</script>');
Context::addCSSFile("./addons/kasutera_notify/css/notify.css", false);
/*
kasutera_notify.php
새글이 등록되어있을 경우를 체크 후 알림
*/
if ($called_position == 'before_module_proc') {
    $is_document_new = false;
    if (!$addon_info->settime) {
        $time_interval = 60;
        //글 체크 주기 초단위
        $settimeout = 60000;
    } else {
        $time_interval = $addon_info->settime;
        $settimeout = $time_interval * 1000;
    }
    if (!$addon_info->hidetime) {
        $hide_time = 3000;
    } else {
        $hide_time = $addon_info->hidetime * 1000;
    }
    if (!$addon_info->ajaxtarget) {
        $ajax_target = '';
Example #4
0
 /**
  * faceOff related services for the operation run out
  * @deprecated
  * @param object $layout_info
  * @return void
  */
 function doActivateFaceOff(&$layout_info)
 {
     $layout_info->faceoff_ini_config = $this->getUserLayoutIniConfig($layout_info->layout_srl, $layout_info->layout);
     // faceoff layout CSS
     Context::addCSSFile($this->getDefaultLayoutCss($layout_info->layout));
     // CSS generated in the layout manager
     $faceoff_layout_css = $this->getUserLayoutFaceOffCss($layout_info->layout_srl);
     if ($faceoff_layout_css) {
         Context::addCSSFile($faceoff_layout_css);
     }
     // CSS output for the widget
     Context::loadFile($this->module_path . '/tpl/css/widget.css', true);
     if ($layout_info->extra_var->colorset->value == 'black') {
         Context::loadFile($this->module_path . '/tpl/css/widget@black.css', true);
     } else {
         Context::loadFile($this->module_path . '/tpl/css/widget@white.css', true);
     }
     // Different page displayed upon user's permission
     $logged_info = Context::get('logged_info');
     // Display edit button for faceoff layout
     if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) {
         Context::addHtmlFooter('<div class="faceOffManager" style="height: 23px; position: fixed; right: 3px; top: 3px;"><a href="' . getUrl('', 'mid', Context::get('mid'), 'act', 'dispLayoutAdminLayoutModify', 'delete_tmp', 'Y') . '">' . lang('cmd_layout_edit') . '</a></div>');
     }
     // Display menu when editing the faceOff page
     if (Context::get('act') == 'dispLayoutAdminLayoutModify' && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) {
         $oTemplate =& TemplateHandler::getInstance();
         Context::addBodyHeader($oTemplate->compile($this->module_path . '/tpl', 'faceoff_layout_menu'));
     }
 }
Example #5
0
 /**
  * Preview a layout with module.
  * 
  * @return Object
  */
 public function dispLayoutPreviewWithModule()
 {
     $content = '';
     $layoutSrl = Context::get('layout_srl');
     $module = Context::get('module_name');
     $mid = Context::get('target_mid');
     $skin = Context::get('skin');
     $skinType = Context::get('skin_type');
     try {
         // admin check
         // this act is admin view but in normal view because do not load admin css/js files
         $logged_info = Context::get('logged_info');
         if ($logged_info->is_admin != 'Y') {
             throw new Exception(Context::getLang('msg_invalid_request'));
         }
         // if module is 'ARTiCLE' and from site design setting, make content directly
         if ($module == 'ARTICLE' && !$mid) {
             $oDocumentModel = getModel('document');
             $oDocument = $oDocumentModel->getDocument(0, true);
             $t = Context::getLang('article_preview_title');
             $c = '';
             for ($i = 0; $i < 4; $i++) {
                 $c .= '<p>';
                 for ($j = 0; $j < 20; $j++) {
                     $c .= Context::getLang('article_preview_content') . ' ';
                 }
                 $c .= '</p>';
             }
             $attr = new stdClass();
             $attr->title = $t;
             $attr->content = $c;
             $attr->document_srl = -1;
             $oDocument->setAttribute($attr, FALSE);
             Context::set('oDocument', $oDocument);
             if ($skinType == 'M') {
                 $templatePath = _XE_PATH_ . 'modules/page/m.skins/' . $skin;
                 $templateFile = 'mobile';
             } else {
                 $templatePath = _XE_PATH_ . 'modules/page/skins/' . $skin;
                 $templateFile = 'content';
             }
             $oTemplate = TemplateHandler::getInstance();
             $content = $oTemplate->compile($templatePath, $templateFile);
         } else {
             $content = $this->procRealModule($module, $mid, $skin, $skinType);
         }
         Context::set('content', $content);
         // find layout
         if ($layoutSrl) {
             if ($layoutSrl == -1) {
                 $site_srl = $oModule ? $oModule->module_info->site_srl : 0;
                 $designInfoFile = sprintf(_XE_PATH_ . 'files/site_design/design_%s.php', $site_srl);
                 include $designInfoFile;
                 if ($skinType == 'M') {
                     $layoutSrl = $designInfo->mlayout_srl;
                 } else {
                     $layoutSrl = $designInfo->layout_srl;
                 }
             }
             $oLayoutModel = getModel('layout');
             $layoutInfo = $oLayoutModel->getLayout($layoutSrl);
             // If there is no layout, pass it.
             if ($layoutInfo) {
                 // Adhoc...
                 // Input extra_vars into $layout_info
                 if ($layoutInfo->extra_var_count) {
                     foreach ($layoutInfo->extra_var as $var_id => $val) {
                         if ($val->type == 'image') {
                             if (strncmp('./files/attach/images/', $val->value, 22) === 0) {
                                 $val->value = Context::getRequestUri() . substr($val->value, 2);
                             }
                         }
                         $layoutInfo->{$var_id} = $val->value;
                     }
                 }
                 // Set menus into context
                 if ($layoutInfo->menu_count) {
                     foreach ($layoutInfo->menu as $menu_id => $menu) {
                         // set default menu set(included home menu)
                         if (!$menu->menu_srl || $menu->menu_srl == -1) {
                             $oMenuAdminController = getAdminController('menu');
                             $homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
                             if (file_exists($homeMenuCacheFile)) {
                                 include $homeMenuCacheFile;
                             }
                             if (!$menu->menu_srl) {
                                 $menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
                                 $menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
                                 $layoutInfo->menu->{$menu_id}->menu_srl = $homeMenuSrl;
                             } else {
                                 $menu->xml_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->xml_file);
                                 $menu->php_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->php_file);
                             }
                         }
                         $menu->php_file = FileHandler::getRealPath($menu->php_file);
                         if (FileHandler::exists($menu->php_file)) {
                             include $menu->php_file;
                         }
                         Context::set($menu_id, $menu);
                     }
                 }
                 Context::set('layout_info', $layoutInfo);
             }
         }
     } catch (Exception $e) {
         $content = '<div class="message error"><p id="preview_error">' . $e->getMessage() . '</p></div>';
         Context::set('content', $content);
         $layoutSrl = 0;
     }
     // Compile
     $oTemplate = TemplateHandler::getInstance();
     Context::clearHtmlHeader();
     if ($layoutInfo) {
         $layout_path = $layoutInfo->path;
         $editLayoutTPL = $this->getRealLayoutFile($layoutSrl);
         $editLayoutCSS = $this->getRealLayoutCSS($layoutSrl);
         if ($editLayoutCSS != '') {
             Context::addCSSFile($editLayoutCSS);
         }
         $layout_file = 'layout';
         $oModuleModel = getModel('module');
         $part_config = $oModuleModel->getModulePartConfig('layout', $layoutSrl);
         Context::addHtmlHeader($part_config->header_script);
     } else {
         $layout_path = './common/tpl';
         $layout_file = 'default_layout';
     }
     $layout_tpl = $oTemplate->compile($layout_path, $layout_file, $editLayoutTPL);
     Context::set('layout', 'none');
     // Convert widgets and others
     $oContext = Context::getInstance();
     Context::set('layout_tpl', $layout_tpl);
     $this->setTemplatePath($this->module_path . 'tpl');
     $this->setTemplateFile('layout_preview');
 }
 /**
  * @brief <!--Meta:파일이름.(css|js)-->를 변경
  **/
 function transMeta($matches)
 {
     if (substr($matches[1], '-4') == '.css') {
         Context::addCSSFile($matches[1]);
     } elseif (substr($matches[1], '-3') == '.js') {
         Context::addJSFile($matches[1]);
     }
 }
Example #7
0
 /**
  * @brief convert editor component codes to be returned and specify content style.
  **/
 function triggerEditorComponentCompile(&$content)
 {
     if (Context::getResponseMethod() != 'HTML') {
         return new Object();
     }
     $module_info = Context::get('module_info');
     $module_srl = $module_info->module_srl;
     if ($module_srl) {
         $oEditorModel =& getModel('editor');
         $editor_config = $oEditorModel->getEditorConfig($module_srl);
         $content_style = $editor_config->content_style;
         if ($content_style) {
             $path = _XE_PATH_ . 'modules/editor/styles/' . $content_style . '/';
             if (is_dir($path) && file_exists($path . 'style.ini')) {
                 $ini = file($path . 'style.ini');
                 for ($i = 0, $c = count($ini); $i < $c; $i++) {
                     $file = trim($ini[$i]);
                     if (!$file) {
                         continue;
                     }
                     if (preg_match('/\\.css$/i', $file)) {
                         Context::addCSSFile('./modules/editor/styles/' . $content_style . '/' . $file, false);
                     } elseif (preg_match('/\\.js/i', $file)) {
                         Context::addJsFile('./modules/editor/styles/' . $content_style . '/' . $file, false);
                     }
                 }
             }
         }
         $content_font = $editor_config->content_font;
         $content_font_size = $editor_config->content_font_size;
         if ($content_font || $content_font_size) {
             $buff = '<style type="text/css"> .xe_content { ';
             if ($content_font) {
                 $buff .= 'font-family:' . $content_font . ';';
             }
             if ($content_font_size) {
                 $buff .= 'font-size:' . $content_font_size . ';';
             }
             $buff .= ' }</style>';
             Context::addHtmlHeader($buff);
         }
     }
     $content = $this->transComponent($content);
     return new Object();
 }
<?php

if (!defined("__XE__")) {
    exit;
}
if ($called_position == 'before_display_content') {
    Context::addCSSFile("./addons/font_awesome_new/css/font-awesome.min.css", false);
}
Example #9
0
 /**
  * @brief faceOff관련 서비스 출력을 위한 동작 실행
  **/
 function doActivateFaceOff(&$layout_info)
 {
     $layout_info->faceoff_ini_config = $this->getUserLayoutIniConfig($layout_info->layout_srl, $layout_info->layout);
     // 기본 faceoff layout CSS
     Context::addCSSFile($this->getDefaultLayoutCss($layout_info->layout));
     // 레이아웃 매니져에서 생성된 CSS
     $faceoff_layout_css = $this->getUserLayoutFaceOffCss($layout_info->layout_srl);
     if ($faceoff_layout_css) {
         Context::addCSSFile($faceoff_layout_css);
     }
     // 레이아웃의 위젯을 위한 css출력
     Context::addCSSFile($this->module_path . '/tpl/css/widget.css');
     if ($layout_info->extra_var->colorset->value == 'black') {
         Context::addCSSFile($this->module_path . '/tpl/css/widget@black.css');
     } else {
         Context::addCSSFile($this->module_path . '/tpl/css/widget@white.css');
     }
     // 권한에 따른 다른 내용 출력
     $logged_info = Context::get('logged_info');
     // faceOff 레이아웃 편집 버튼 노출
     if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) {
         Context::addHtmlFooter("<div class=\"faceOffManager\"><a href=\"" . getUrl('', 'mid', Context::get('mid'), 'act', 'dispLayoutAdminLayoutModify', 'delete_tmp', 'Y') . "\" class=\"buttonSet buttonLayoutEditor\"><span>" . Context::getLang('cmd_layout_edit') . "</span></a></div>");
     }
     // faceOff페이지 수정시에 메뉴 출력
     if (Context::get('act') == 'dispLayoutAdminLayoutModify' && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) {
         $oTemplate =& TemplateHandler::getInstance();
         Context::addBodyHeader($oTemplate->compile($this->module_path . '/tpl', 'faceoff_layout_menu'));
     }
 }
 /**
  * @brief 에디터 컴포넌트가 별도의 고유 코드를 이용한다면 그 코드를 html로 변경하여 주는 method
  **/
 function transHTML($xml_obj)
 {
     $script_path = getScriptPath() . 'modules/editor/components/code_highlighter/syntaxhighlighter/scripts/';
     $code_type = ucfirst($xml_obj->attrs->code_type);
     $option_title = ' title="' . $xml_obj->attrs->title . '"';
     $option_first_line = $xml_obj->attrs->first_line;
     $option_collapse = $xml_obj->attrs->collapse;
     $option_nogutter = $xml_obj->attrs->nogutter;
     $option_highlight = $xml_obj->attrs->highlight;
     $option[] = 'brush:' . strtolower($code_type);
     if (in_array($option_collapse, array('true', 'checked', 'Y'))) {
         $option[] = 'collapse:true';
     }
     if (in_array($option_nogutter, array('true', 'checked', 'Y'))) {
         $option[] = 'gutter:false';
     }
     if ($option_highlight) {
         $option[] = 'highlight:[' . $option_highlight . ']';
     }
     if ($option_first_line > 1) {
         $option[] = 'first-line:' . $option_first_line;
     }
     $body = $xml_obj->body;
     $body = strip_tags($body, '<br>');
     $body = preg_replace("/(<br\\s*\\/?>)(\n|\r)*/i", "\n", $body);
     $body = strip_tags($body);
     $body = str_replace('&nbsp;', ' ', $body);
     if (!$GLOBALS['_called_editor_component_code_highlighter_']) {
         $GLOBALS['_called_editor_component_code_highlighter_'] = true;
         foreach ($this->brushes as $item) {
             $brush[] = '"' . $item[2] . ' ' . $script_path . 'shBrush' . $item[1] . '.js"';
         }
         $sh_js_code[] = '<script type="text/javascript">';
         $sh_js_code[] = 'window.SyntaxHighlighter.autoloader(';
         $sh_js_code[] = implode(',' . PHP_EOL, $brush);
         $sh_js_code[] = ');';
         $sh_js_code[] = 'window.SyntaxHighlighter.config.bloggerMode = true;';
         $sh_js_code[] = 'window.SyntaxHighlighter.all();';
         $sh_js_code[] = '</script>';
         if (!$this->theme) {
             $this->theme = 'Default';
         }
         $theme_file = $this->component_path . 'syntaxhighlighter/styles/shCore' . $this->theme . '.css';
         if (!file_exists($theme_file)) {
             $theme_file = $this->component_path . 'syntaxhighlighter/styles/shCoreDjango.css';
         }
         Context::set('script_path', $script_path);
         Context::addHtmlFooter(implode(PHP_EOL, $sh_js_code));
         Context::addCSSFile($theme_file);
         Context::addJsFile($script_path . 'shCore.js');
         Context::addJsFile($script_path . 'shAutoloader.js');
     }
     $output = sprintf('<pre class="%s" %s>%s</pre>', implode(';', $option), $option_title, $body);
     return $output;
 }
Example #11
0
 /**
  * @brief convert editor component codes to be returned and specify content style.
  */
 function triggerEditorComponentCompile(&$content)
 {
     if (Context::getResponseMethod() != 'HTML') {
         return new Object();
     }
     $module_info = Context::get('module_info');
     $module_srl = $module_info->module_srl;
     if ($module_srl) {
         $editor_config = getModel('editor')->getEditorConfig($module_srl);
     } else {
         $editor_config = getModel('module')->getModuleConfig('editor');
     }
     if ($editor_config) {
         $content_style = $editor_config->content_style;
         if ($content_style) {
             $path = _XE_PATH_ . 'modules/editor/styles/' . $content_style . '/';
             if (is_dir($path) && file_exists($path . 'style.ini')) {
                 $ini = file($path . 'style.ini');
                 for ($i = 0, $c = count($ini); $i < $c; $i++) {
                     $file = trim($ini[$i]);
                     if (!$file) {
                         continue;
                     }
                     if (substr_compare($file, '.css', -4) === 0) {
                         Context::addCSSFile('./modules/editor/styles/' . $content_style . '/' . $file, false);
                     } elseif (substr_compare($file, '.js', -3) === 0) {
                         Context::addJsFile('./modules/editor/styles/' . $content_style . '/' . $file, false);
                     }
                 }
             }
         }
         Context::set('default_font_config', array('default_font_family' => $editor_config->content_font ?: 'inherit', 'default_font_size' => $editor_config->content_font_size ?: '13px', 'default_line_height' => $editor_config->content_line_height ?: '160%', 'default_paragraph_spacing' => $editor_config->content_paragraph_spacing ?: '0', 'default_word_break' => $editor_config->content_word_break ?: 'normal'));
         /*
         $buff = array();
         $buff[] = '<style> .xe_content {';
         if ($content_font)
         {
         	$buff[] = "font-family: $content_font;";
         }
         if ($content_font_size)
         {
         	$buff[] = "font-size: $content_font_size;";
         }
         if ($content_line_height)
         {
         	$buff[] = "line-height: $content_line_height;";
         }
         if ($content_word_break === 'none')
         {
         	$buff[] = 'white-space: nowrap;';
         }
         else
         {
         	$buff[] = 'word-break: ' . ($content_word_break ?: 'normal') . '; word-wrap: break-word;';
         }
         $buff[] = '}';
         $buff[] = '.xe_content p { margin: 0 0 ' . ($content_paragraph_spacing ?: 0) . ' 0; }';
         $buff[] = '</style>';
         Context::addHtmlHeader(implode(' ', $buff));
         */
     } else {
         Context::set('default_font_config', array('default_font_family' => 'inherit', 'default_font_size' => '13px', 'default_line_height' => '160%', 'default_paragraph_spacing' => '0', 'default_word_break' => 'normal'));
     }
     $content = $this->transComponent($content);
     return new Object();
 }