mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 19:21:40 +09:00
issue 2662 editor
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12243 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
e101348f59
commit
3480da757a
12 changed files with 2252 additions and 2055 deletions
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
/**
|
||||
/**
|
||||
* @class emoticon
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief Emoticons image connected components
|
||||
**/
|
||||
|
||||
class emoticon extends EditorHandler {
|
||||
*/
|
||||
class emoticon extends EditorHandler
|
||||
{
|
||||
// editor_sequence from the editor must attend mandatory wearing ....
|
||||
var $editor_sequence = 0;
|
||||
var $component_path = '';
|
||||
|
|
@ -13,8 +13,9 @@
|
|||
|
||||
/**
|
||||
* @brief editor_sequence and components out of the path
|
||||
**/
|
||||
function emoticon($editor_sequence, $component_path) {
|
||||
*/
|
||||
function emoticon($editor_sequence, $component_path)
|
||||
{
|
||||
$this->editor_sequence = $editor_sequence;
|
||||
$this->component_path = $component_path;
|
||||
$this->emoticon_path = sprintf('%s%s/images',preg_replace('/^\.\//i','',$this->component_path),'tpl','images');
|
||||
|
|
@ -22,8 +23,9 @@
|
|||
|
||||
/**
|
||||
* @brief Returns a list of emoticons file
|
||||
**/
|
||||
function getEmoticonList() {
|
||||
*/
|
||||
function getEmoticonList()
|
||||
{
|
||||
$emoticon = Context::get('emoticon');
|
||||
if(!$emoticon || !preg_match("/^([a-z0-9\_]+)$/i",$emoticon)) return new Object(-1,'msg_invalid_request');
|
||||
|
||||
|
|
@ -34,13 +36,15 @@
|
|||
|
||||
/**
|
||||
* @brief Likely to be recursively emoticons will search all the files to a subdirectory. 8000 gaekkajineun ran tests whether the stack and raise beef pro-overs and Unsure. (06/09/2007, Benny)
|
||||
**/
|
||||
function getEmoticons($path) {
|
||||
*/
|
||||
function getEmoticons($path)
|
||||
{
|
||||
$emoticon_path = sprintf("%s/%s", $this->emoticon_path, $path);
|
||||
$output = array();
|
||||
|
||||
$oDir = dir($emoticon_path);
|
||||
while($file = $oDir->read()) {
|
||||
while($file = $oDir->read())
|
||||
{
|
||||
if(substr($file,0,1)=='.') continue;
|
||||
if(preg_match('/\.(jpg|jpeg|gif|png)$/i',$file)) $output[] = sprintf("%s/%s", $path, str_replace($this->emoticon_path,'',$file));
|
||||
}
|
||||
|
|
@ -51,13 +55,16 @@
|
|||
|
||||
/**
|
||||
* @brief popup window to display in popup window request is to add content
|
||||
**/
|
||||
function getPopupContent() {
|
||||
*/
|
||||
function getPopupContent()
|
||||
{
|
||||
// Bringing a list of emoticons directory
|
||||
$emoticon_dirs = FileHandler::readDir($this->emoticon_path);
|
||||
$emoticon_list = array();
|
||||
if($emoticon_dirs) {
|
||||
foreach($emoticon_dirs as $emoticon) {
|
||||
if($emoticon_dirs)
|
||||
{
|
||||
foreach($emoticon_dirs as $emoticon)
|
||||
{
|
||||
if(preg_match("/^([a-z0-9\_]+)$/i", $emoticon)) $emoticon_list[] = $emoticon;
|
||||
}
|
||||
}
|
||||
|
|
@ -75,12 +82,14 @@
|
|||
|
||||
/**
|
||||
* @brief Emoticon of the path were added to solve the problem. (06/09/2007 Benny)
|
||||
**/
|
||||
function transHTML($xml_obj) {
|
||||
*/
|
||||
function transHTML($xml_obj)
|
||||
{
|
||||
$src = $xml_obj->attrs->src;
|
||||
$alt = $xml_obj->attrs->alt;
|
||||
|
||||
if(!$alt) {
|
||||
if(!$alt)
|
||||
{
|
||||
$tmp_arr = explode('/',$src);
|
||||
$alt = array_pop($tmp_arr);
|
||||
}
|
||||
|
|
@ -91,7 +100,8 @@
|
|||
$attr_output = array();
|
||||
$attr_output = array("src=\"".$src."\"");
|
||||
|
||||
if($alt) {
|
||||
if($alt)
|
||||
{
|
||||
$attr_output[] = "alt=\"".$alt."\"";
|
||||
}
|
||||
if(preg_match("/\.png$/i",$src)) $attr_output[] = "class=\"iePngFix\"";
|
||||
|
|
@ -100,5 +110,6 @@
|
|||
|
||||
return $code;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
||||
/* End of file emoticon.class.php */
|
||||
/* Location: ./modules/editor/components/emoticon/emoticon.class.php */
|
||||
|
|
|
|||
|
|
@ -1,27 +1,29 @@
|
|||
<?php
|
||||
/**
|
||||
/**
|
||||
* @class image_gallery
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief Making images uploaded to the image gallery
|
||||
**/
|
||||
|
||||
class image_gallery extends EditorHandler {
|
||||
*/
|
||||
class image_gallery extends EditorHandler
|
||||
{
|
||||
// editor_sequence from the editor must attend mandatory wearing ....
|
||||
var $editor_sequence = 0;
|
||||
var $component_path = '';
|
||||
|
||||
/**
|
||||
* @brief editor_sequence and components out of the path
|
||||
**/
|
||||
function image_gallery($editor_sequence, $component_path) {
|
||||
*/
|
||||
function image_gallery($editor_sequence, $component_path)
|
||||
{
|
||||
$this->editor_sequence = $editor_sequence;
|
||||
$this->component_path = $component_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief popup window to display in popup window request is to add content
|
||||
**/
|
||||
function getPopupContent() {
|
||||
*/
|
||||
function getPopupContent()
|
||||
{
|
||||
// Pre-compiled source code to compile template return to
|
||||
$tpl_path = $this->component_path.'tpl';
|
||||
$tpl_file = 'popup.html';
|
||||
|
|
@ -37,8 +39,9 @@
|
|||
*
|
||||
* Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then
|
||||
* DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own
|
||||
**/
|
||||
function transHTML($xml_obj) {
|
||||
*/
|
||||
function transHTML($xml_obj)
|
||||
{
|
||||
$gallery_info->srl = rand(111111,999999);
|
||||
$gallery_info->border_thickness = $xml_obj->attrs->border_thickness;
|
||||
$gallery_info->gallery_style = $xml_obj->attrs->gallery_style;
|
||||
|
|
@ -50,9 +53,11 @@
|
|||
$images_list = preg_replace('/\.(gif|jpg|jpeg|png) /i',".\\1\n",$images_list);
|
||||
$gallery_info->images_list = explode("\n",trim($images_list));
|
||||
// If you set the output to output the XML code generated a list of the image
|
||||
if(Context::getResponseMethod() == 'XMLRPC') {
|
||||
if(Context::getResponseMethod() == 'XMLRPC')
|
||||
{
|
||||
$output = '';
|
||||
for($i=0;$i<count($gallery_info->images_list);$i++) {
|
||||
for($i=0;$i<count($gallery_info->images_list);$i++)
|
||||
{
|
||||
$output .= sprintf('<img src="%s" alt="" /><br />', $gallery_info->images_list[$i]);
|
||||
}
|
||||
return $output;
|
||||
|
|
@ -73,6 +78,6 @@
|
|||
$oTemplate = &TemplateHandler::getInstance();
|
||||
return $oTemplate->compile($tpl_path, $tpl_file);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
}
|
||||
/* End of file image_gallery.class.php */
|
||||
/* Location: ./modules/editor/components/image_gallery/image_gallery.class.php */
|
||||
|
|
|
|||
|
|
@ -1,27 +1,29 @@
|
|||
<?php
|
||||
/**
|
||||
/**
|
||||
* @class image_link
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief Add an image, or to modify the properties of components
|
||||
**/
|
||||
|
||||
class image_link extends EditorHandler {
|
||||
*/
|
||||
class image_link extends EditorHandler
|
||||
{
|
||||
// editor_sequence from the editor must attend mandatory wearing ....
|
||||
var $editor_sequence = 0;
|
||||
var $component_path = '';
|
||||
|
||||
/**
|
||||
* @brief editor_sequence and components out of the path
|
||||
**/
|
||||
function image_link($editor_sequence, $component_path) {
|
||||
*/
|
||||
function image_link($editor_sequence, $component_path)
|
||||
{
|
||||
$this->editor_sequence = $editor_sequence;
|
||||
$this->component_path = $component_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief popup window to display in popup window request is to add content
|
||||
**/
|
||||
function getPopupContent() {
|
||||
*/
|
||||
function getPopupContent()
|
||||
{
|
||||
// Pre-compiled source code to compile template return to
|
||||
$tpl_path = $this->component_path.'tpl';
|
||||
$tpl_file = 'popup.html';
|
||||
|
|
@ -37,8 +39,9 @@
|
|||
*
|
||||
* Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then
|
||||
* DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own
|
||||
**/
|
||||
function transHTML($xml_obj) {
|
||||
*/
|
||||
function transHTML($xml_obj)
|
||||
{
|
||||
$src = $xml_obj->attrs->src;
|
||||
$width = $xml_obj->attrs->width;
|
||||
$height = $xml_obj->attrs->height;
|
||||
|
|
@ -57,21 +60,24 @@
|
|||
// Image containing the address to the address conversion request uri (rss output, etc. purposes)
|
||||
$temp_src = explode('/', $src);
|
||||
if(substr($src, 0,2)=='./') $src = Context::getRequestUri().substr($src, 2);
|
||||
elseif(substr($src , 0, 1)=='/') {
|
||||
else if(substr($src , 0, 1)=='/')
|
||||
{
|
||||
if($_SERVER['HTTPS']=='on') $http_src = 'https://';
|
||||
else $http_src = 'http://';
|
||||
$src = $http_src.$_SERVER['HTTP_HOST'].$src;
|
||||
}
|
||||
elseif(!strpos($temp_src[0],':') && $src) $src = Context::getRequestUri().$src;
|
||||
else if(!strpos($temp_src[0],':') && $src) $src = Context::getRequestUri().$src;
|
||||
|
||||
$attr_output = array();
|
||||
$attr_output = array("src=\"".$src."\"");
|
||||
$attr_output[] = "alt=\"".$alt."\"";
|
||||
|
||||
if($title) {
|
||||
if($title)
|
||||
{
|
||||
$attr_output[] = "title=\"".$title."\"";
|
||||
}
|
||||
if($margin) {
|
||||
if($margin)
|
||||
{
|
||||
$style = trim(preg_replace('/margin[a-z\-]*[ ]*:[ ]*[0-9 a-z]+(;| )/i','', $style)).';';
|
||||
$style = str_replace(';;',';',$style);
|
||||
if($style == ';') $style = '';
|
||||
|
|
@ -83,7 +89,8 @@
|
|||
|
||||
if($width) $attr_output[] = 'width="'.$width.'"';
|
||||
if($height) $attr_output[] = 'height="'.$height.'"';
|
||||
if($border) {
|
||||
if($border)
|
||||
{
|
||||
$style = trim(preg_replace('/border[a-z\-]*[ ]*:[ ]*[0-9 a-z]+(;| )/i','', $style)).';';
|
||||
$style = str_replace(';;',';',$style);
|
||||
if($style == ';') $style = '';
|
||||
|
|
@ -92,12 +99,13 @@
|
|||
|
||||
$code = sprintf("<img %s style=\"%s\" />", implode(' ',$attr_output), $style);
|
||||
|
||||
if($link_url) {
|
||||
if($link_url)
|
||||
{
|
||||
if($open_window =='Y') $code = sprintf('<a href="%s" onclick="window.open(this.href);return false;">%s</a>', $link_url, $code);
|
||||
else $code = sprintf('<a href="%s" >%s</a>', $link_url, $code);
|
||||
}
|
||||
return $code;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
}
|
||||
/* End of file image_link.class.php */
|
||||
/* Location: ./modules/editor/components/image_link/image_link.class.php */
|
||||
|
|
|
|||
|
|
@ -1,27 +1,29 @@
|
|||
<?php
|
||||
/**
|
||||
/**
|
||||
* @class multimedia_link
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief The components connected to the body of multimedia data
|
||||
**/
|
||||
|
||||
class multimedia_link extends EditorHandler {
|
||||
*/
|
||||
class multimedia_link extends EditorHandler
|
||||
{
|
||||
// editor_sequence from the editor must attend mandatory wearing ....
|
||||
var $editor_sequence = 0;
|
||||
var $component_path = '';
|
||||
|
||||
/**
|
||||
* @brief editor_sequence and components out of the path
|
||||
**/
|
||||
function multimedia_link($editor_sequence, $component_path) {
|
||||
*/
|
||||
function multimedia_link($editor_sequence, $component_path)
|
||||
{
|
||||
$this->editor_sequence = $editor_sequence;
|
||||
$this->component_path = $component_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief popup window to display in popup window request is to add content
|
||||
**/
|
||||
function getPopupContent() {
|
||||
*/
|
||||
function getPopupContent()
|
||||
{
|
||||
// Pre-compiled source code to compile template return to
|
||||
$tpl_path = $this->component_path.'tpl';
|
||||
$tpl_file = 'popup.html';
|
||||
|
|
@ -37,8 +39,9 @@
|
|||
*
|
||||
* Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then
|
||||
* DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own
|
||||
**/
|
||||
function transHTML($xml_obj) {
|
||||
*/
|
||||
function transHTML($xml_obj)
|
||||
{
|
||||
$src = $xml_obj->attrs->multimedia_src;
|
||||
$style = $xml_obj->attrs->style;
|
||||
|
||||
|
|
@ -54,7 +57,7 @@
|
|||
|
||||
$wmode = $xml_obj->attrs->wmode;
|
||||
if($wmode == 'window') $wmode = 'window';
|
||||
elseif($wmode == 'opaque') $wmode = 'opaque';
|
||||
else if($wmode == 'opaque') $wmode = 'opaque';
|
||||
else $wmode = 'transparent';
|
||||
|
||||
|
||||
|
|
@ -66,5 +69,6 @@
|
|||
if(Context::getResponseMethod() != "XMLRPC") return sprintf("<script type=\"text/javascript\">displayMultimedia(\"%s\", \"%s\",\"%s\", { \"autostart\" : %s, \"wmode\" : \"%s\" });</script>", $src, $width, $height, $auto_start, $wmode);
|
||||
else return sprintf("<div style=\"width: %dpx; height: %dpx;\"><span style=\"position:relative; top:%dpx;left:%d\"><img src=\"%s\" /><br />Attached Multimedia</span></div>", $width, $height, ($height/2-16), ($width/2-31), Context::getRequestUri().'./modules/editor/components/multimedia_link/tpl/multimedia_link_component.gif');
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
||||
/* End of file multimedia_link.class.php */
|
||||
/* Location: ./modules/editor/components/multimedia_link/multimedia_link.class.php */
|
||||
|
|
|
|||
|
|
@ -1,27 +1,29 @@
|
|||
<?php
|
||||
/**
|
||||
/**
|
||||
* @class poll_maker
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief Editor provides the ability to link to the url.
|
||||
**/
|
||||
|
||||
class poll_maker extends EditorHandler {
|
||||
*/
|
||||
class poll_maker extends EditorHandler
|
||||
{
|
||||
// editor_sequence from the editor must attend mandatory wearing ....
|
||||
var $editor_sequence = 0;
|
||||
var $component_path = '';
|
||||
|
||||
/**
|
||||
* @brief editor_sequence and components out of the path
|
||||
**/
|
||||
function poll_maker($editor_sequence, $component_path) {
|
||||
*/
|
||||
function poll_maker($editor_sequence, $component_path)
|
||||
{
|
||||
$this->editor_sequence = $editor_sequence;
|
||||
$this->component_path = $component_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief popup window to display in popup window request is to add content
|
||||
**/
|
||||
function getPopupContent() {
|
||||
*/
|
||||
function getPopupContent()
|
||||
{
|
||||
// Wanted Skins survey
|
||||
$oModuleModel = &getModel('module');
|
||||
$skin_list = $oModuleModel->getSkins("./modules/poll/");
|
||||
|
|
@ -39,8 +41,9 @@
|
|||
*
|
||||
* Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then
|
||||
* DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own
|
||||
**/
|
||||
function transHTML($xml_obj) {
|
||||
*/
|
||||
function transHTML($xml_obj)
|
||||
{
|
||||
$poll_srl = $xml_obj->attrs->poll_srl;
|
||||
$skin = $xml_obj->attrs->skin;
|
||||
if(!$skin) $skin = 'default';
|
||||
|
|
@ -53,5 +56,6 @@
|
|||
$oPollModel = &getModel('poll');
|
||||
return $oPollModel->getPollHtml($poll_srl, $style, $skin);
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
||||
/* End of file poll_maker.class.php */
|
||||
/* Location: ./modules/editor/components/poll_maker/poll_maker.class.php */
|
||||
|
|
|
|||
|
|
@ -1,22 +1,23 @@
|
|||
<?php
|
||||
/**
|
||||
/**
|
||||
* @class editorAdminController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief editor of the module admin controller class
|
||||
**/
|
||||
|
||||
class editorAdminController extends editor {
|
||||
|
||||
*/
|
||||
class editorAdminController extends editor
|
||||
{
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 컴포넌트 사용설정, 목록 순서 변경
|
||||
**/
|
||||
function procEditorAdminCheckUseListOrder(){
|
||||
*/
|
||||
function procEditorAdminCheckUseListOrder()
|
||||
{
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
$enables = Context::get('enables');
|
||||
$component_names = Context::get('component_names');
|
||||
|
|
@ -27,10 +28,12 @@
|
|||
$unables = array_diff($component_names, $enables);
|
||||
$componentList = array();
|
||||
|
||||
foreach($enables as $component_name) {
|
||||
foreach($enables as $component_name)
|
||||
{
|
||||
$componentList[$component_name] = 'Y';
|
||||
}
|
||||
foreach($unables as $component_name) {
|
||||
foreach($unables as $component_name)
|
||||
{
|
||||
$componentList[$component_name] = 'N';
|
||||
}
|
||||
|
||||
|
|
@ -47,16 +50,21 @@
|
|||
|
||||
/**
|
||||
* @brief check use component
|
||||
**/
|
||||
function editorCheckUse($componentList, $site_srl = 0){
|
||||
*/
|
||||
function editorCheckUse($componentList, $site_srl = 0)
|
||||
{
|
||||
$args->site_srl = $site_srl;
|
||||
|
||||
foreach($componentList as $componentName => $value){
|
||||
foreach($componentList as $componentName => $value)
|
||||
{
|
||||
$args->component_name = $componentName;
|
||||
$args->enabled = $value;
|
||||
if($site_srl == 0) {
|
||||
if($site_srl == 0)
|
||||
{
|
||||
$output = executeQuery('editor.updateComponent', $args);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = executeQuery('editor.updateSiteComponent', $args);
|
||||
}
|
||||
}
|
||||
|
|
@ -68,21 +76,26 @@
|
|||
|
||||
/**
|
||||
* @brief list order componet
|
||||
**/
|
||||
function editorListOrder($component_names, $site_srl = 0){
|
||||
*/
|
||||
function editorListOrder($component_names, $site_srl = 0)
|
||||
{
|
||||
$args->site_srl = $site_srl;
|
||||
$list_order_num = '30';
|
||||
if(is_array($component_names)) {
|
||||
foreach($component_names as $name){
|
||||
if(is_array($component_names))
|
||||
{
|
||||
foreach($component_names as $name)
|
||||
{
|
||||
$args->list_order = $list_order_num;
|
||||
$args->component_name = $name;
|
||||
if($site_srl == 0) {
|
||||
if($site_srl == 0)
|
||||
{
|
||||
$output = executeQuery('editor.updateComponent', $args);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = executeQuery('editor.updateSiteComponent', $args);
|
||||
}
|
||||
|
||||
|
||||
if(!$output->toBool()) return new Object();
|
||||
$list_order_num++;
|
||||
}
|
||||
|
|
@ -93,8 +106,9 @@
|
|||
|
||||
/**
|
||||
* @brief Set components
|
||||
**/
|
||||
function procEditorAdminSetupComponent() {
|
||||
*/
|
||||
function procEditorAdminSetupComponent()
|
||||
{
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
|
||||
$component_name = Context::get('component_name');
|
||||
|
|
@ -121,9 +135,9 @@
|
|||
|
||||
/**
|
||||
* @brief Config components
|
||||
**/
|
||||
|
||||
function procEditorAdminGeneralConfig(){
|
||||
*/
|
||||
function procEditorAdminGeneralConfig()
|
||||
{
|
||||
$oModuleController = &getController('module');
|
||||
$configVars = Context::getRequestVars();
|
||||
|
||||
|
|
@ -147,13 +161,13 @@
|
|||
|
||||
$oModuleController->insertModuleConfig('editor',$config);
|
||||
$this->setRedirectUrl(Context::get('error_return_url'));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Add a component to DB
|
||||
**/
|
||||
function insertComponent($component_name, $enabled = false, $site_srl = 0) {
|
||||
*/
|
||||
function insertComponent($component_name, $enabled = false, $site_srl = 0)
|
||||
{
|
||||
if($enabled) $enabled = 'Y';
|
||||
else $enabled = 'N';
|
||||
|
||||
|
|
@ -173,5 +187,6 @@
|
|||
$oEditorController->removeCache($site_srl);
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
||||
/* End of file editor.admin.controller.php */
|
||||
/* Location: ./modules/editor/editor.admin.controller.php */
|
||||
|
|
|
|||
|
|
@ -1,23 +1,24 @@
|
|||
<?php
|
||||
/**
|
||||
/**
|
||||
* @class editorAdminView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief editor admin view of the module class
|
||||
**/
|
||||
|
||||
class editorAdminView extends editor {
|
||||
|
||||
*/
|
||||
class editorAdminView extends editor
|
||||
{
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Administrator Setting page
|
||||
* Settings to enable/disable editor component and other features
|
||||
**/
|
||||
function dispEditorAdminIndex() {
|
||||
*/
|
||||
function dispEditorAdminIndex()
|
||||
{
|
||||
$component_count = 0;
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
$site_srl = (int)$site_module_info->site_srl;
|
||||
|
|
@ -41,7 +42,8 @@
|
|||
$skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->editor_skin);
|
||||
|
||||
$contents = FileHandler::readDir(_XE_PATH_.'modules/editor/styles');
|
||||
for($i=0,$c=count($contents);$i<$c;$i++) {
|
||||
for($i=0,$c=count($contents);$i<$c;$i++)
|
||||
{
|
||||
$style = $contents[$i];
|
||||
$info = $oModuleModel->loadSkinInfo($this->module_path,$style,'styles');
|
||||
$content_style_list[$style]->title = $info->title;
|
||||
|
|
@ -49,7 +51,8 @@
|
|||
|
||||
// Get install info, update info, count
|
||||
$oAutoinstallModel = &getModel('autoinstall');
|
||||
foreach($component_list as $component_name => $xml_info) {
|
||||
foreach($component_list as $component_name => $xml_info)
|
||||
{
|
||||
$component_count++;
|
||||
$xml_info->path = './modules/editor/components/'.$xml_info->component_name;
|
||||
$xml_info->delete_url = $oAutoinstallModel->getRemoveUrlByPath($xml_info->path);
|
||||
|
|
@ -59,7 +62,8 @@
|
|||
|
||||
if(is_array($targetpackages)) $packages = $oAutoinstallModel->getInstalledPackages(array_keys($targetpackages));
|
||||
|
||||
foreach($component_list as $component_name => $xml_info) {
|
||||
foreach($component_list as $component_name => $xml_info)
|
||||
{
|
||||
if($packages[$xml_info->package_srl]) $xml_info->need_update = $packages[$xml_info->package_srl]->need_update;
|
||||
}
|
||||
$editor_config_default = array( "editor_height" => "300", "comment_editor_height" => "100","content_font_size"=>"12");
|
||||
|
|
@ -120,8 +124,9 @@
|
|||
|
||||
/**
|
||||
* @brief Component setup
|
||||
**/
|
||||
function dispEditorAdminSetupComponent() {
|
||||
*/
|
||||
function dispEditorAdminSetupComponent()
|
||||
{
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
$site_srl = (int)$site_module_info->site_srl;
|
||||
|
||||
|
|
@ -141,15 +146,19 @@
|
|||
$columnList = array('module_srl', 'mid', 'module_category_srl', 'browser_title');
|
||||
$mid_list = $oModuleModel->getMidList($args, $columnList);
|
||||
// Combination of module_category and module
|
||||
if(!$args->site_srl) {
|
||||
if(!$args->site_srl)
|
||||
{
|
||||
// Get a list of module category
|
||||
$module_categories = $oModuleModel->getModuleCategories();
|
||||
|
||||
if(!is_array($mid_list)) $mid_list = array($mid_list);
|
||||
foreach($mid_list as $module_srl => $module) {
|
||||
foreach($mid_list as $module_srl => $module)
|
||||
{
|
||||
if($module) $module_categories[$module->module_category_srl]->list[$module_srl] = $module;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$module_categories[0]->list = $mid_list;
|
||||
}
|
||||
|
||||
|
|
@ -164,5 +173,6 @@
|
|||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('setup_component');
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
||||
/* End of file editor.admin.view.php */
|
||||
/* Location: ./modules/editor/editor.admin.view.php */
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
<?php
|
||||
/**
|
||||
/**
|
||||
* @class editorAPI
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief
|
||||
**/
|
||||
|
||||
class editorAPI extends editor {
|
||||
function dispEditorSkinColorset(&$oModule) {
|
||||
*/
|
||||
class editorAPI extends editor
|
||||
{
|
||||
function dispEditorSkinColorset(&$oModule)
|
||||
{
|
||||
$oModule->add('colorset', Context::get('colorset'));
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
||||
/* End of file editor.api.php */
|
||||
/* Location: ./modules/editor/editor.api.php */
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
<?php
|
||||
/**
|
||||
/**
|
||||
* @class editor
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief high class of the editor odule
|
||||
**/
|
||||
|
||||
class editor extends ModuleObject {
|
||||
|
||||
*/
|
||||
class editor extends ModuleObject
|
||||
{
|
||||
/**
|
||||
* @brief Implement if additional tasks are necessary when installing
|
||||
**/
|
||||
function moduleInstall() {
|
||||
*/
|
||||
function moduleInstall()
|
||||
{
|
||||
// Register action forward (to use in administrator mode)
|
||||
$oModuleController = &getController('module');
|
||||
// Add the default editor component
|
||||
|
|
@ -40,8 +40,9 @@
|
|||
|
||||
/**
|
||||
* @brief a method to check if successfully installed
|
||||
**/
|
||||
function checkUpdate() {
|
||||
*/
|
||||
function checkUpdate()
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
|
||||
$oDB = &DB::getInstance();
|
||||
|
|
@ -49,7 +50,6 @@
|
|||
if(!$oDB->isColumnExists("editor_autosave","module_srl")) return true;
|
||||
if(!$oDB->isIndexExists("editor_autosave","idx_module_srl")) return true;
|
||||
|
||||
|
||||
// 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified
|
||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) return true;
|
||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) return true;
|
||||
|
|
@ -68,8 +68,9 @@
|
|||
|
||||
/**
|
||||
* @brief Execute update
|
||||
**/
|
||||
function moduleUpdate() {
|
||||
*/
|
||||
function moduleUpdate()
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleController = &getController('module');
|
||||
|
||||
|
|
@ -107,8 +108,10 @@
|
|||
|
||||
/**
|
||||
* @brief Re-generate the cache file
|
||||
**/
|
||||
function recompileCache() {
|
||||
*/
|
||||
function recompileCache()
|
||||
{
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
||||
/* End of file editor.class.php */
|
||||
/* Location: ./modules/editor/editor.class.php */
|
||||
|
|
|
|||
|
|
@ -1,22 +1,23 @@
|
|||
<?php
|
||||
/**
|
||||
/**
|
||||
* @class editor
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief editor module's controller class
|
||||
**/
|
||||
|
||||
class editorController extends editor {
|
||||
|
||||
*/
|
||||
class editorController extends editor
|
||||
{
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AutoSave
|
||||
**/
|
||||
function procEditorSaveDoc() {
|
||||
*/
|
||||
function procEditorSaveDoc()
|
||||
{
|
||||
|
||||
$this->deleteSavedDoc(false);
|
||||
|
||||
|
|
@ -30,16 +31,18 @@
|
|||
|
||||
/**
|
||||
* @brief Delete autosaved documents
|
||||
**/
|
||||
function procEditorRemoveSavedDoc() {
|
||||
*/
|
||||
function procEditorRemoveSavedDoc()
|
||||
{
|
||||
$oEditorController = &getController('editor');
|
||||
$oEditorController->deleteSavedDoc(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Execute a method of the component when the component requests ajax
|
||||
**/
|
||||
function procEditorCall() {
|
||||
*/
|
||||
function procEditorCall()
|
||||
{
|
||||
$component = Context::get('component');
|
||||
$method = Context::get('method');
|
||||
if(!$component) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
|
||||
|
|
@ -61,15 +64,17 @@
|
|||
$this->setMessage($oComponent->getMessage());
|
||||
|
||||
$vars = $oComponent->getVariables();
|
||||
if(count($vars)) {
|
||||
if(count($vars))
|
||||
{
|
||||
foreach($vars as $key=>$val) $this->add($key, $val);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Save Editor's additional form for each module
|
||||
**/
|
||||
function procEditorInsertModuleConfig() {
|
||||
*/
|
||||
function procEditorInsertModuleConfig()
|
||||
{
|
||||
$module_srl = Context::get('target_module_srl');
|
||||
// To configure many of modules at once
|
||||
if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
|
||||
|
|
@ -82,10 +87,12 @@
|
|||
$editor_config->content_style = Context::get('content_style');
|
||||
$editor_config->comment_content_style = Context::get('comment_content_style');
|
||||
$editor_config->content_font = Context::get('content_font');
|
||||
if($editor_config->content_font) {
|
||||
if($editor_config->content_font)
|
||||
{
|
||||
$font_list = array();
|
||||
$fonts = explode(',',$editor_config->content_font);
|
||||
for($i=0,$c=count($fonts);$i<$c;$i++) {
|
||||
for($i=0,$c=count($fonts);$i<$c;$i++)
|
||||
{
|
||||
$font = trim(str_replace(array('"','\''),'',$fonts[$i]));
|
||||
if(!$font) continue;
|
||||
$font_list[] = $font;
|
||||
|
|
@ -116,15 +123,13 @@
|
|||
}
|
||||
|
||||
$editor_config->editor_height = (int)Context::get('editor_height');
|
||||
|
||||
$editor_config->comment_editor_height = (int)Context::get('comment_editor_height');
|
||||
|
||||
$editor_config->enable_autosave = Context::get('enable_autosave');
|
||||
|
||||
if($editor_config->enable_autosave != 'Y') $editor_config->enable_autosave = 'N';
|
||||
|
||||
$oModuleController = &getController('module');
|
||||
for($i=0;$i<count($module_srl);$i++) {
|
||||
for($i=0;$i<count($module_srl);$i++)
|
||||
{
|
||||
$srl = trim($module_srl[$i]);
|
||||
if(!$srl) continue;
|
||||
$oModuleController->insertModulePartConfig('editor',$srl,$editor_config);
|
||||
|
|
@ -139,21 +144,26 @@
|
|||
|
||||
/**
|
||||
* @brief convert editor component codes to be returned and specify content style.
|
||||
**/
|
||||
function triggerEditorComponentCompile(&$content) {
|
||||
*/
|
||||
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) {
|
||||
if($module_srl)
|
||||
{
|
||||
$oEditorModel = &getModel('editor');
|
||||
$editor_config = $oEditorModel->getEditorConfig($module_srl);
|
||||
$content_style = $editor_config->content_style;
|
||||
if($content_style) {
|
||||
if($content_style)
|
||||
{
|
||||
$path = _XE_PATH_.'modules/editor/styles/'.$content_style.'/';
|
||||
if(is_dir($path) && file_exists($path.'style.ini')) {
|
||||
if(is_dir($path) && file_exists($path.'style.ini'))
|
||||
{
|
||||
$ini = file($path.'style.ini');
|
||||
for($i=0,$c=count($ini);$i<$c;$i++) {
|
||||
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);
|
||||
|
|
@ -163,7 +173,8 @@
|
|||
}
|
||||
$content_font = $editor_config->content_font;
|
||||
$content_font_size = $editor_config->content_font_size;
|
||||
if($content_font || $content_font_size) {
|
||||
if($content_font || $content_font_size)
|
||||
{
|
||||
$buff = '<style> .xe_content { ';
|
||||
if($content_font) $buff .= 'font-family:'.$content_font.';';
|
||||
if($content_font_size) $buff .= 'font-size:'.$content_font_size.';';
|
||||
|
|
@ -178,22 +189,25 @@
|
|||
|
||||
/**
|
||||
* @brief Convert editor component codes to be returned
|
||||
**/
|
||||
function transComponent($content) {
|
||||
*/
|
||||
function transComponent($content)
|
||||
{
|
||||
$content = preg_replace_callback('!<(?:(div)|img)([^>]*)editor_component=([^>]*)>(?(1)(.*?)</div>)!is', array($this,'transEditorComponent'), $content);
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert editor component code of the contents
|
||||
**/
|
||||
function transEditorComponent($match) {
|
||||
*/
|
||||
function transEditorComponent($match)
|
||||
{
|
||||
$script = " {$match[2]} editor_component={$match[3]}";
|
||||
$script = preg_replace('/([\w:-]+)\s*=(?:\s*(["\']))?((?(2).*?|[^ ]+))\2/i', '\1="\3"', $script);
|
||||
preg_match_all('/([a-z0-9_-]+)="([^"]+)"/is', $script, $m);
|
||||
|
||||
$xml_obj = new stdClass;
|
||||
for($i=0,$c=count($m[0]);$i<$c;$i++) {
|
||||
for($i=0,$c=count($m[0]);$i<$c;$i++)
|
||||
{
|
||||
$xml_obj->attrs->{$m[1][$i]} = $m[2][$i];
|
||||
}
|
||||
$xml_obj->body = $match[4];
|
||||
|
|
@ -207,24 +221,28 @@
|
|||
return $oComponent->transHTML($xml_obj);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief AutoSave
|
||||
**/
|
||||
function doSaveDoc($args) {
|
||||
|
||||
*/
|
||||
function doSaveDoc($args)
|
||||
{
|
||||
if(!$args->document_srl) $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
|
||||
if(Context::get('is_logged')) {
|
||||
if(Context::get('is_logged'))
|
||||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
$args->member_srl = $logged_info->member_srl;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
// Get the current module if module_srl doesn't exist
|
||||
if(!$args->module_srl) {
|
||||
if(!$args->module_srl)
|
||||
{
|
||||
$args->module_srl = Context::get('module_srl');
|
||||
}
|
||||
if(!$args->module_srl) {
|
||||
if(!$args->module_srl)
|
||||
{
|
||||
$current_module_info = Context::get('current_module_info');
|
||||
$args->module_srl = $current_module_info->module_srl;
|
||||
}
|
||||
|
|
@ -234,8 +252,9 @@
|
|||
|
||||
/**
|
||||
* @brief Load the srl of autosaved document - for those who uses XE older versions.
|
||||
**/
|
||||
function procEditorLoadSavedDocument() {
|
||||
*/
|
||||
function procEditorLoadSavedDocument()
|
||||
{
|
||||
$editor_sequence = Context::get('editor_sequence');
|
||||
$primary_key = Context::get('primary_key');
|
||||
$oEditorModel = &getModel('editor');
|
||||
|
|
@ -252,11 +271,11 @@
|
|||
$this->add("document_srl", $saved_doc->document_srl);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief A trigger to remove auto-saved document when inserting/updating the document
|
||||
**/
|
||||
function triggerDeleteSavedDoc(&$obj) {
|
||||
*/
|
||||
function triggerDeleteSavedDoc(&$obj)
|
||||
{
|
||||
$this->deleteSavedDoc(false);
|
||||
return new Object();
|
||||
}
|
||||
|
|
@ -264,17 +283,22 @@
|
|||
/**
|
||||
* @brief Delete the auto-saved document
|
||||
* Based on the current logged-in user
|
||||
**/
|
||||
function deleteSavedDoc($mode = false) {
|
||||
if(Context::get('is_logged')) {
|
||||
*/
|
||||
function deleteSavedDoc($mode = false)
|
||||
{
|
||||
if(Context::get('is_logged'))
|
||||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
$args->member_srl = $logged_info->member_srl;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
$args->module_srl = Context::get('module_srl');
|
||||
// Get the current module if module_srl doesn't exist
|
||||
if(!$args->module_srl) {
|
||||
if(!$args->module_srl)
|
||||
{
|
||||
$current_module_info = Context::get('current_module_info');
|
||||
$args->module_srl = $current_module_info->module_srl;
|
||||
}
|
||||
|
|
@ -285,8 +309,10 @@
|
|||
|
||||
$oDocumentModel = &getModel('document');
|
||||
$oSaved = $oDocumentModel->getDocument($saved_doc->document_srl);
|
||||
if(!$oSaved->isExists()) {
|
||||
if($mode) {
|
||||
if(!$oSaved->isExists())
|
||||
{
|
||||
if($mode)
|
||||
{
|
||||
$output = executeQuery('editor.getSavedDocument', $args);
|
||||
$output = ModuleHandler::triggerCall('editor.deleteSavedDoc', 'after', $saved_doc);
|
||||
}
|
||||
|
|
@ -297,8 +323,9 @@
|
|||
|
||||
/**
|
||||
* @brief ERemove editor component information used on the virtual site
|
||||
**/
|
||||
function removeEditorConfig($site_srl) {
|
||||
*/
|
||||
function removeEditorConfig($site_srl)
|
||||
{
|
||||
$args->site_srl = $site_srl;
|
||||
executeQuery('editor.deleteSiteComponent', $args);
|
||||
}
|
||||
|
|
@ -306,30 +333,37 @@
|
|||
/**
|
||||
* @brief Caching a list of editor component (editorModel::getComponentList)
|
||||
* For the editor component list, use a caching file because of DB query and Xml parsing
|
||||
**/
|
||||
function makeCache($filter_enabled = true, $site_srl) {
|
||||
*/
|
||||
function makeCache($filter_enabled = true, $site_srl)
|
||||
{
|
||||
$oEditorModel = &getModel('editor');
|
||||
|
||||
if($filter_enabled) $args->enabled = "Y";
|
||||
|
||||
if($site_srl) {
|
||||
if($site_srl)
|
||||
{
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('editor.getSiteComponentList', $args);
|
||||
} else $output = executeQuery('editor.getComponentList', $args);
|
||||
}
|
||||
else $output = executeQuery('editor.getComponentList', $args);
|
||||
$db_list = $output->data;
|
||||
// Get a list of files
|
||||
$downloaded_list = FileHandler::readDir(_XE_PATH_.'modules/editor/components');
|
||||
// Get information about log-in status and its group
|
||||
$is_logged = Context::get('is_logged');
|
||||
if($is_logged) {
|
||||
if($is_logged)
|
||||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
if($logged_info->group_list && is_array($logged_info->group_list)) {
|
||||
if($logged_info->group_list && is_array($logged_info->group_list))
|
||||
{
|
||||
$group_list = array_keys($logged_info->group_list);
|
||||
} else $group_list = array();
|
||||
}
|
||||
else $group_list = array();
|
||||
}
|
||||
// Get xml information for looping DB list
|
||||
if(!is_array($db_list)) $db_list = array($db_list);
|
||||
foreach($db_list as $component) {
|
||||
foreach($db_list as $component)
|
||||
{
|
||||
if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) continue;
|
||||
|
||||
$component_name = $component->component_name;
|
||||
|
|
@ -341,9 +375,11 @@
|
|||
$xml_info = $oEditorModel->getComponentXmlInfo($component_name);
|
||||
$xml_info->enabled = $component->enabled;
|
||||
|
||||
if($component->extra_vars) {
|
||||
if($component->extra_vars)
|
||||
{
|
||||
$extra_vars = unserialize($component->extra_vars);
|
||||
if($extra_vars->target_group) {
|
||||
if($extra_vars->target_group)
|
||||
{
|
||||
$xml_info->target_group = $extra_vars->target_group;
|
||||
}
|
||||
|
||||
|
|
@ -374,8 +410,10 @@
|
|||
if(!in_array(Context::get('mid'), $extra_vars->mid_list)) continue;
|
||||
}*/
|
||||
// Check the configuration of the editor component
|
||||
if($xml_info->extra_vars) {
|
||||
foreach($xml_info->extra_vars as $key => $val) {
|
||||
if($xml_info->extra_vars)
|
||||
{
|
||||
foreach($xml_info->extra_vars as $key => $val)
|
||||
{
|
||||
$xml_info->extra_vars->{$key}->value = $extra_vars->{$key};
|
||||
}
|
||||
}
|
||||
|
|
@ -389,14 +427,16 @@
|
|||
if(file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true;
|
||||
}
|
||||
// Return if it checks enabled only
|
||||
if($filter_enabled) {
|
||||
if($filter_enabled)
|
||||
{
|
||||
$cache_file = $oEditorModel->getCacheFile($filter_enabled, $site_srl);
|
||||
$buff = sprintf('<?php if(!defined("__ZBXE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"','\\"',serialize($component_list)));
|
||||
FileHandler::writeFile($cache_file, $buff);
|
||||
return $component_list;
|
||||
}
|
||||
// Get xml_info of downloaded list
|
||||
foreach($downloaded_list as $component_name) {
|
||||
foreach($downloaded_list as $component_name)
|
||||
{
|
||||
if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) continue;
|
||||
// Pass if configured
|
||||
if($component_list->{$component_name}) continue;
|
||||
|
|
@ -420,8 +460,9 @@
|
|||
|
||||
/**
|
||||
* @brief Delete cache files
|
||||
**/
|
||||
function removeCache($site_srl = 0) {
|
||||
*/
|
||||
function removeCache($site_srl = 0)
|
||||
{
|
||||
$oEditorModel = &getModel('editor');
|
||||
FileHandler::removeFile($oEditorModel->getCacheFile(true, $site_srl));
|
||||
FileHandler::removeFile($oEditorModel->getCacheFile(false, $site_srl));
|
||||
|
|
@ -441,5 +482,6 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
||||
/* End of file editor.controller.php */
|
||||
/* Location: ./modules/editor/editor.controller.php */
|
||||
|
|
|
|||
|
|
@ -1,14 +1,12 @@
|
|||
<?php
|
||||
/**
|
||||
/**
|
||||
* @class editorModel
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief model class of the editor odule
|
||||
**/
|
||||
|
||||
class editorModel extends editor {
|
||||
|
||||
*/
|
||||
class editorModel extends editor
|
||||
{
|
||||
var $loaded_component_list = array();
|
||||
|
||||
/**
|
||||
* @brief Return the editor
|
||||
*
|
||||
|
|
@ -17,13 +15,15 @@
|
|||
*
|
||||
* However, editor_sequence can be value from getNextSequence() in case of the modified or the auto-saved for file upload
|
||||
*
|
||||
**/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Return editor setting for each module
|
||||
**/
|
||||
function getEditorConfig($module_srl = null) {
|
||||
if(!$GLOBALS['__editor_module_config__'][$module_srl] && $module_srl) {
|
||||
*/
|
||||
function getEditorConfig($module_srl = null)
|
||||
{
|
||||
if(!$GLOBALS['__editor_module_config__'][$module_srl] && $module_srl)
|
||||
{
|
||||
// Get trackback settings of the selected module
|
||||
$oModuleModel = &getModel('module');
|
||||
$GLOBALS['__editor_module_config__'][$module_srl] = $oModuleModel->getModulePartConfig('editor', $module_srl);
|
||||
|
|
@ -61,15 +61,18 @@
|
|||
return $editor_config;
|
||||
}
|
||||
|
||||
function loadDrComponents(){
|
||||
function loadDrComponents()
|
||||
{
|
||||
$drComponentPath = './modules/editor/skins/dreditor/drcomponents/';
|
||||
$drComponentList = FileHandler::readDir($drComponentPath);
|
||||
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
|
||||
$drComponentInfo = array();
|
||||
if($drComponentList){
|
||||
foreach($drComponentList as $i => $drComponent){
|
||||
if($drComponentList)
|
||||
{
|
||||
foreach($drComponentList as $i => $drComponent)
|
||||
{
|
||||
unset($obj);
|
||||
$obj = $this->getDrComponentXmlInfo($drComponent);
|
||||
Context::loadLang(sprintf('%s%s/lang/',$drComponentPath,$drComponent));
|
||||
|
|
@ -81,7 +84,8 @@
|
|||
Context::set('drComponentList',$drComponentInfo);
|
||||
}
|
||||
|
||||
function getDrComponentXmlInfo($drComponentName){
|
||||
function getDrComponentXmlInfo($drComponentName)
|
||||
{
|
||||
$lang_type = Context::getLangType();
|
||||
// Get the xml file path of requested component
|
||||
$component_path = sprintf('%s/skins/dreditor/drcomponents/%s/', $this->module_path, $drComponentName);
|
||||
|
|
@ -89,7 +93,8 @@
|
|||
$xml_file = sprintf('%sinfo.xml', $component_path);
|
||||
$cache_file = sprintf('./files/cache/editor/dr_%s.%s.php', $drComponentName, $lang_type);
|
||||
// Return information after including it after cached xml file exists
|
||||
if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file)) {
|
||||
if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file))
|
||||
{
|
||||
include($cache_file);
|
||||
return $xml_info;
|
||||
}
|
||||
|
|
@ -120,18 +125,21 @@
|
|||
if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
|
||||
else $author_list = $xml_doc->component->author;
|
||||
|
||||
for($i=0; $i < count($author_list); $i++) {
|
||||
for($i=0; $i < count($author_list); $i++)
|
||||
{
|
||||
$buff .= sprintf('$xml_info->author['.$i.']->name = "%s";', $author_list[$i]->name->body);
|
||||
$buff .= sprintf('$xml_info->author['.$i.']->email_address = "%s";', $author_list[$i]->attrs->email_address);
|
||||
$buff .= sprintf('$xml_info->author['.$i.']->homepage = "%s";', $author_list[$i]->attrs->link);
|
||||
}
|
||||
|
||||
// history
|
||||
if($xml_doc->component->history) {
|
||||
if($xml_doc->component->history)
|
||||
{
|
||||
if(!is_array($xml_doc->component->history)) $history_list[] = $xml_doc->component->history;
|
||||
else $history_list = $xml_doc->component->history;
|
||||
|
||||
for($i=0; $i < count($history_list); $i++) {
|
||||
for($i=0; $i < count($history_list); $i++)
|
||||
{
|
||||
unset($obj);
|
||||
sscanf($history_list[$i]->attrs->date, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
|
||||
$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
|
||||
|
|
@ -139,20 +147,24 @@
|
|||
$buff .= sprintf('$xml_info->history['.$i.']->version = "%s";', $history_list[$i]->attrs->version);
|
||||
$buff .= sprintf('$xml_info->history['.$i.']->date = "%s";', $date);
|
||||
|
||||
if($history_list[$i]->author) {
|
||||
if($history_list[$i]->author)
|
||||
{
|
||||
(!is_array($history_list[$i]->author)) ? $obj->author_list[] = $history_list[$i]->author : $obj->author_list = $history_list[$i]->author;
|
||||
|
||||
for($j=0; $j < count($obj->author_list); $j++) {
|
||||
for($j=0; $j < count($obj->author_list); $j++)
|
||||
{
|
||||
$buff .= sprintf('$xml_info->history['.$i.']->author['.$j.']->name = "%s";', $obj->author_list[$j]->name->body);
|
||||
$buff .= sprintf('$xml_info->history['.$i.']->author['.$j.']->email_address = "%s";', $obj->author_list[$j]->attrs->email_address);
|
||||
$buff .= sprintf('$xml_info->history['.$i.']->author['.$j.']->homepage = "%s";', $obj->author_list[$j]->attrs->link);
|
||||
}
|
||||
}
|
||||
|
||||
if($history_list[$i]->log) {
|
||||
if($history_list[$i]->log)
|
||||
{
|
||||
(!is_array($history_list[$i]->log)) ? $obj->log_list[] = $history_list[$i]->log : $obj->log_list = $history_list[$i]->log;
|
||||
|
||||
for($j=0; $j < count($obj->log_list); $j++) {
|
||||
for($j=0; $j < count($obj->log_list); $j++)
|
||||
{
|
||||
$buff .= sprintf('$xml_info->history['.$i.']->logs['.$j.']->text = "%s";', $obj->log_list[$j]->body);
|
||||
$buff .= sprintf('$xml_info->history['.$i.']->logs['.$j.']->link = "%s";', $obj->log_list[$j]->attrs->link);
|
||||
}
|
||||
|
|
@ -161,9 +173,11 @@
|
|||
}
|
||||
// List extra variables (text type only in the editor component)
|
||||
$extra_vars = $xml_doc->component->extra_vars->var;
|
||||
if($extra_vars) {
|
||||
if($extra_vars)
|
||||
{
|
||||
if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
|
||||
foreach($extra_vars as $key => $val) {
|
||||
foreach($extra_vars as $key => $val)
|
||||
{
|
||||
unset($obj);
|
||||
$key = $val->attrs->name;
|
||||
$title = $val->title->body;
|
||||
|
|
@ -189,11 +203,12 @@
|
|||
* @brief Return the editor template
|
||||
* You can call upload_target_srl when modifying content
|
||||
* The upload_target_srl is used for a routine to check if an attachment exists
|
||||
**/
|
||||
function getEditor($upload_target_srl = 0, $option = null) {
|
||||
*/
|
||||
function getEditor($upload_target_srl = 0, $option = null)
|
||||
{
|
||||
/**
|
||||
* Editor's default options
|
||||
**/
|
||||
*/
|
||||
// Option setting to allow file upload
|
||||
if($upload_target_srl)
|
||||
{
|
||||
|
|
@ -232,14 +247,16 @@
|
|||
Context::set('colorset', $colorset);
|
||||
Context::set('skin', $skin);
|
||||
|
||||
if($skin=='dreditor'){
|
||||
if($skin=='dreditor')
|
||||
{
|
||||
$this->loadDrComponents();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the automatic backup feature (do not use if the post is edited)
|
||||
**/
|
||||
if($enable_autosave) {
|
||||
*/
|
||||
if($enable_autosave)
|
||||
{
|
||||
// Extract auto-saved data
|
||||
$saved_doc = $this->getSavedDoc($upload_target_srl);
|
||||
// Context setting auto-saved data
|
||||
|
|
@ -249,18 +266,20 @@
|
|||
|
||||
/**
|
||||
* Extract editor's unique number (in order to display multiple editors on a single page)
|
||||
**/
|
||||
*/
|
||||
if($option->editor_sequence) $editor_sequence = $option->editor_sequence;
|
||||
else {
|
||||
else
|
||||
{
|
||||
if(!$_SESSION['_editor_sequence_']) $_SESSION['_editor_sequence_'] = 1;
|
||||
$editor_sequence = $_SESSION['_editor_sequence_'] ++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload setting by using configuration of the file module internally
|
||||
**/
|
||||
*/
|
||||
$files_count = 0;
|
||||
if($allow_fileupload) {
|
||||
if($allow_fileupload)
|
||||
{
|
||||
$oFileModel = &getModel('file');
|
||||
// Get upload configuration to set on SWFUploader
|
||||
$file_config = $oFileModel->getUploadConfig();
|
||||
|
|
@ -290,14 +309,15 @@
|
|||
// Set content column name to sync contents
|
||||
Context::set('editor_content_key_name', $option->content_key_name);
|
||||
|
||||
|
||||
/**
|
||||
* Check editor component
|
||||
**/
|
||||
*/
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
$site_srl = (int)$site_module_info->site_srl;
|
||||
if($enable_component) {
|
||||
if(!Context::get('component_list')) {
|
||||
if($enable_component)
|
||||
{
|
||||
if(!Context::get('component_list'))
|
||||
{
|
||||
$component_list = $this->getComponentList(true, $site_srl);
|
||||
Context::set('component_list', $component_list);
|
||||
}
|
||||
|
|
@ -307,23 +327,24 @@
|
|||
|
||||
/**
|
||||
* Variable setting if html_mode is available
|
||||
**/
|
||||
*/
|
||||
Context::set('html_mode', $html_mode);
|
||||
|
||||
/**
|
||||
* Set a height of editor
|
||||
**/
|
||||
*/
|
||||
Context::set('editor_height', $editor_height);
|
||||
// Check an option whether to start the editor manually
|
||||
Context::set('editor_manual_start', $option->manual_start);
|
||||
|
||||
/**
|
||||
* Set a skin path to pre-compile the template
|
||||
?**/
|
||||
*/
|
||||
$tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin);
|
||||
$tpl_file = 'editor.html';
|
||||
|
||||
if(!file_exists($tpl_path.$tpl_file)) {
|
||||
if(!file_exists($tpl_path.$tpl_file))
|
||||
{
|
||||
$skin = 'xpresseditor';
|
||||
$tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin);
|
||||
}
|
||||
|
|
@ -342,12 +363,14 @@
|
|||
*
|
||||
* 2 types of editors supported; document and comment.
|
||||
* 2 types of editors can be used on a single module. For instance each for original post and reply port.
|
||||
**/
|
||||
function getModuleEditor($type = 'document', $module_srl, $upload_target_srl, $primary_key_name, $content_key_name) {
|
||||
*/
|
||||
function getModuleEditor($type = 'document', $module_srl, $upload_target_srl, $primary_key_name, $content_key_name)
|
||||
{
|
||||
// Get editor settings of the module
|
||||
$editor_config = $this->getEditorConfig($module_srl);
|
||||
// Configurations listed according to a type
|
||||
if($type == 'document') {
|
||||
if($type == 'document')
|
||||
{
|
||||
$config->editor_skin = $editor_config->editor_skin;
|
||||
$config->content_style = $editor_config->content_style;
|
||||
$config->content_font = $editor_config->content_font;
|
||||
|
|
@ -359,7 +382,9 @@
|
|||
$config->enable_html_grant = $editor_config->enable_html_grant;
|
||||
$config->editor_height = $editor_config->editor_height;
|
||||
$config->enable_autosave = $editor_config->enable_autosave;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$config->editor_skin = $editor_config->comment_editor_skin;
|
||||
$config->content_style = $editor_config->comment_content_style;
|
||||
$config->content_font = $editor_config->content_font;
|
||||
|
|
@ -373,10 +398,13 @@
|
|||
$config->enable_autosave = 'N';
|
||||
}
|
||||
// Check a group_list of the currently logged-in user for permission check
|
||||
if(Context::get('is_logged')) {
|
||||
if(Context::get('is_logged'))
|
||||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
$group_list = $logged_info->group_list;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$group_list = array();
|
||||
}
|
||||
// Pre-set option variables of editor
|
||||
|
|
@ -387,44 +415,60 @@
|
|||
$option->colorset = $config->sel_editor_colorset;
|
||||
// Permission check for file upload
|
||||
$option->allow_fileupload = false;
|
||||
if(count($config->upload_file_grant)) {
|
||||
foreach($group_list as $group_srl => $group_info) {
|
||||
if(in_array($group_srl, $config->upload_file_grant)) {
|
||||
if(count($config->upload_file_grant))
|
||||
{
|
||||
foreach($group_list as $group_srl => $group_info)
|
||||
{
|
||||
if(in_array($group_srl, $config->upload_file_grant))
|
||||
{
|
||||
$option->allow_fileupload = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else $option->allow_fileupload = true;
|
||||
}
|
||||
else $option->allow_fileupload = true;
|
||||
// Permission check for using default components
|
||||
$option->enable_default_component = false;
|
||||
if(count($config->enable_default_component_grant)) {
|
||||
foreach($group_list as $group_srl => $group_info) {
|
||||
if(in_array($group_srl, $config->enable_default_component_grant)) {
|
||||
if(count($config->enable_default_component_grant))
|
||||
{
|
||||
foreach($group_list as $group_srl => $group_info)
|
||||
{
|
||||
if(in_array($group_srl, $config->enable_default_component_grant))
|
||||
{
|
||||
$option->enable_default_component = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else $option->enable_default_component = true;
|
||||
}
|
||||
else $option->enable_default_component = true;
|
||||
// Permisshion check for using extended components
|
||||
$option->enable_component = false;
|
||||
if(count($config->enable_component_grant)) {
|
||||
foreach($group_list as $group_srl => $group_info) {
|
||||
if(in_array($group_srl, $config->enable_component_grant)) {
|
||||
if(count($config->enable_component_grant))
|
||||
{
|
||||
foreach($group_list as $group_srl => $group_info)
|
||||
{
|
||||
if(in_array($group_srl, $config->enable_component_grant))
|
||||
{
|
||||
$option->enable_component = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else $option->enable_component = true;
|
||||
}
|
||||
else $option->enable_component = true;
|
||||
// HTML editing privileges
|
||||
$enable_html = false;
|
||||
if(count($config->enable_html_grant)) {
|
||||
foreach($group_list as $group_srl => $group_info) {
|
||||
if(in_array($group_srl, $config->enable_html_grant)) {
|
||||
if(count($config->enable_html_grant))
|
||||
{
|
||||
foreach($group_list as $group_srl => $group_info)
|
||||
{
|
||||
if(in_array($group_srl, $config->enable_html_grant))
|
||||
{
|
||||
$enable_html = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else $enable_html = true;
|
||||
}
|
||||
else $enable_html = true;
|
||||
|
||||
if($enable_html) $option->disable_html = false;
|
||||
else $option->disable_html = true;
|
||||
|
|
@ -441,18 +485,23 @@
|
|||
|
||||
/**
|
||||
* @brief Get information which has been auto-saved
|
||||
**/
|
||||
function getSavedDoc($upload_target_srl) {
|
||||
*/
|
||||
function getSavedDoc($upload_target_srl)
|
||||
{
|
||||
// Find a document by using member_srl for logged-in user and ipaddress for non-logged user
|
||||
if(Context::get('is_logged')) {
|
||||
if(Context::get('is_logged'))
|
||||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
$auto_save_args->member_srl = $logged_info->member_srl;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
$auto_save_args->module_srl = Context::get('module_srl');
|
||||
// Get the current module if module_srl doesn't exist
|
||||
if(!$auto_save_args->module_srl) {
|
||||
if(!$auto_save_args->module_srl)
|
||||
{
|
||||
$current_module_info = Context::get('current_module_info');
|
||||
$auto_save_args->module_srl = $current_module_info->module_srl;
|
||||
}
|
||||
|
|
@ -467,7 +516,8 @@
|
|||
if($oSaved->isExists()) return;
|
||||
// Move all the files if the auto-saved data contains document_srl and file
|
||||
// Then set document_srl to editor_sequence
|
||||
if($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl')) {
|
||||
if($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl'))
|
||||
{
|
||||
$saved_doc->module_srl = $auto_save_args->module_srl;
|
||||
$oFileController = &getController('file');
|
||||
$oFileController->moveFile($saved_doc->document_srl, $saved_doc->module_srl, $upload_target_srl);
|
||||
|
|
@ -483,11 +533,13 @@
|
|||
|
||||
/**
|
||||
* @brief create objects of the component
|
||||
**/
|
||||
function getComponentObject($component, $editor_sequence = 0, $site_srl = 0) {
|
||||
*/
|
||||
function getComponentObject($component, $editor_sequence = 0, $site_srl = 0)
|
||||
{
|
||||
if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) return;
|
||||
|
||||
if(!$this->loaded_component_list[$component][$editor_sequence]) {
|
||||
if(!$this->loaded_component_list[$component][$editor_sequence])
|
||||
{
|
||||
// Create an object of the component and execute
|
||||
$class_path = sprintf('%scomponents/%s/', $this->module_path, $component);
|
||||
$class_file = sprintf('%s%s.class.php', $class_path, $component);
|
||||
|
|
@ -508,15 +560,17 @@
|
|||
|
||||
/**
|
||||
* @brief Return a list of the editor skin
|
||||
**/
|
||||
function getEditorSkinList() {
|
||||
*/
|
||||
function getEditorSkinList()
|
||||
{
|
||||
return FileHandler::readDir('./modules/editor/skins');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the cache file name of editor component list
|
||||
**/
|
||||
function getCacheFile($filter_enabled= true, $site_srl = 0) {
|
||||
*/
|
||||
function getCacheFile($filter_enabled= true, $site_srl = 0)
|
||||
{
|
||||
$lang = Context::getLangType();
|
||||
$cache_path = _XE_PATH_.'files/cache/editor/cache/';
|
||||
if(!is_dir($cache_path)) FileHandler::makeDir($cache_path);
|
||||
|
|
@ -529,10 +583,12 @@
|
|||
|
||||
/**
|
||||
* @brief Return a component list (DB Information included)
|
||||
**/
|
||||
function getComponentList($filter_enabled = true, $site_srl=0, $from_db=false) {
|
||||
*/
|
||||
function getComponentList($filter_enabled = true, $site_srl=0, $from_db=false)
|
||||
{
|
||||
$cache_file = $this->getCacheFile(false, $site_srl);
|
||||
if($from_db || !file_exists($cache_file)) {
|
||||
if($from_db || !file_exists($cache_file))
|
||||
{
|
||||
$oEditorController = &getController('editor');
|
||||
$oEditorController->makeCache(false, $site_srl);
|
||||
}
|
||||
|
|
@ -549,25 +605,31 @@
|
|||
$group_list = array();
|
||||
}
|
||||
|
||||
if(count($component_list)) {
|
||||
foreach($component_list as $key => $val) {
|
||||
if(count($component_list))
|
||||
{
|
||||
foreach($component_list as $key => $val)
|
||||
{
|
||||
if(!trim($key)) continue;
|
||||
if(!is_dir(_XE_PATH_.'modules/editor/components/'.$key)) {
|
||||
if(!is_dir(_XE_PATH_.'modules/editor/components/'.$key))
|
||||
{
|
||||
FileHandler::removeFile($cache_file);
|
||||
return $this->getComponentList($filter_enabled, $site_srl);
|
||||
}
|
||||
if(!$filter_enabled) continue;
|
||||
if($val->enabled == "N") {
|
||||
if($val->enabled == "N")
|
||||
{
|
||||
unset($component_list->{$key});
|
||||
continue;
|
||||
}
|
||||
if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue;
|
||||
if($val->target_group)
|
||||
{
|
||||
if(!$logged_info) {
|
||||
if(!$logged_info)
|
||||
{
|
||||
$val->enabled = "N";
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
$is_granted = false;
|
||||
foreach($group_list as $group_srl)
|
||||
{
|
||||
|
|
@ -581,26 +643,30 @@
|
|||
$mid = Context::get('mid');
|
||||
if(!in_array($mid, $val->mid_list)) $val->enabled = "N";
|
||||
}
|
||||
if($val->enabled == "N") {
|
||||
if($val->enabled == "N")
|
||||
{
|
||||
unset($component_list->{$key});
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return $component_list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get xml and db information of the component
|
||||
**/
|
||||
function getComponent($component_name, $site_srl = 0) {
|
||||
*/
|
||||
function getComponent($component_name, $site_srl = 0)
|
||||
{
|
||||
$args->component_name = $component_name;
|
||||
|
||||
if($site_srl) {
|
||||
if($site_srl)
|
||||
{
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('editor.getSiteComponent', $args);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = executeQuery('editor.getComponent', $args);
|
||||
}
|
||||
$component = $output->data;
|
||||
|
|
@ -615,22 +681,26 @@
|
|||
|
||||
$xml_info->mid_list = array();
|
||||
|
||||
if($component->extra_vars) {
|
||||
if($component->extra_vars)
|
||||
{
|
||||
$extra_vars = unserialize($component->extra_vars);
|
||||
|
||||
if($extra_vars->target_group) {
|
||||
if($extra_vars->target_group)
|
||||
{
|
||||
$xml_info->target_group = $extra_vars->target_group;
|
||||
unset($extra_vars->target_group);
|
||||
}
|
||||
|
||||
if($extra_vars->mid_list) {
|
||||
if($extra_vars->mid_list)
|
||||
{
|
||||
$xml_info->mid_list = $extra_vars->mid_list;
|
||||
unset($extra_vars->mid_list);
|
||||
}
|
||||
|
||||
|
||||
if($xml_info->extra_vars) {
|
||||
foreach($xml_info->extra_vars as $key => $val) {
|
||||
if($xml_info->extra_vars)
|
||||
{
|
||||
foreach($xml_info->extra_vars as $key => $val)
|
||||
{
|
||||
$xml_info->extra_vars->{$key}->value = $extra_vars->{$key};
|
||||
}
|
||||
}
|
||||
|
|
@ -641,8 +711,9 @@
|
|||
|
||||
/**
|
||||
* @brief Read xml information of the component
|
||||
**/
|
||||
function getComponentXmlInfo($component) {
|
||||
*/
|
||||
function getComponentXmlInfo($component)
|
||||
{
|
||||
$lang_type = Context::getLangType();
|
||||
// Get xml file path of the requested components
|
||||
$component_path = sprintf('%s/components/%s/', $this->module_path, $component);
|
||||
|
|
@ -650,7 +721,8 @@
|
|||
$xml_file = sprintf('%sinfo.xml', $component_path);
|
||||
$cache_file = sprintf('./files/cache/editor/%s.%s.php', $component, $lang_type);
|
||||
// Include and return xml file information if cached file exists
|
||||
if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file)) {
|
||||
if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file))
|
||||
{
|
||||
include($cache_file);
|
||||
return $xml_info;
|
||||
}
|
||||
|
|
@ -658,7 +730,8 @@
|
|||
$oParser = new XmlParser();
|
||||
$xml_doc = $oParser->loadXmlFile($xml_file);
|
||||
// Component information listed
|
||||
if($xml_doc->component->version && $xml_doc->component->attrs->version == '0.2') {
|
||||
if($xml_doc->component->version && $xml_doc->component->attrs->version == '0.2')
|
||||
{
|
||||
$component_info->component_name = $component;
|
||||
$component_info->title = $xml_doc->component->title->body;
|
||||
$component_info->description = str_replace('\n', "\n", $xml_doc->component->description->body);
|
||||
|
|
@ -681,18 +754,21 @@
|
|||
if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
|
||||
else $author_list = $xml_doc->component->author;
|
||||
|
||||
for($i=0; $i < count($author_list); $i++) {
|
||||
for($i=0; $i < count($author_list); $i++)
|
||||
{
|
||||
$buff .= sprintf('$xml_info->author['.$i.']->name = "%s";', $author_list[$i]->name->body);
|
||||
$buff .= sprintf('$xml_info->author['.$i.']->email_address = "%s";', $author_list[$i]->attrs->email_address);
|
||||
$buff .= sprintf('$xml_info->author['.$i.']->homepage = "%s";', $author_list[$i]->attrs->link);
|
||||
}
|
||||
|
||||
// history
|
||||
if($xml_doc->component->history) {
|
||||
if($xml_doc->component->history)
|
||||
{
|
||||
if(!is_array($xml_doc->component->history)) $history_list[] = $xml_doc->component->history;
|
||||
else $history_list = $xml_doc->component->history;
|
||||
|
||||
for($i=0; $i < count($history_list); $i++) {
|
||||
for($i=0; $i < count($history_list); $i++)
|
||||
{
|
||||
unset($obj);
|
||||
sscanf($history_list[$i]->attrs->date, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
|
||||
$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
|
||||
|
|
@ -700,29 +776,33 @@
|
|||
$buff .= sprintf('$xml_info->history['.$i.']->version = "%s";', $history_list[$i]->attrs->version);
|
||||
$buff .= sprintf('$xml_info->history['.$i.']->date = "%s";', $date);
|
||||
|
||||
if($history_list[$i]->author) {
|
||||
if($history_list[$i]->author)
|
||||
{
|
||||
(!is_array($history_list[$i]->author)) ? $obj->author_list[] = $history_list[$i]->author : $obj->author_list = $history_list[$i]->author;
|
||||
|
||||
for($j=0; $j < count($obj->author_list); $j++) {
|
||||
for($j=0; $j < count($obj->author_list); $j++)
|
||||
{
|
||||
$buff .= sprintf('$xml_info->history['.$i.']->author['.$j.']->name = "%s";', $obj->author_list[$j]->name->body);
|
||||
$buff .= sprintf('$xml_info->history['.$i.']->author['.$j.']->email_address = "%s";', $obj->author_list[$j]->attrs->email_address);
|
||||
$buff .= sprintf('$xml_info->history['.$i.']->author['.$j.']->homepage = "%s";', $obj->author_list[$j]->attrs->link);
|
||||
}
|
||||
}
|
||||
|
||||
if($history_list[$i]->log) {
|
||||
if($history_list[$i]->log)
|
||||
{
|
||||
(!is_array($history_list[$i]->log)) ? $obj->log_list[] = $history_list[$i]->log : $obj->log_list = $history_list[$i]->log;
|
||||
|
||||
for($j=0; $j < count($obj->log_list); $j++) {
|
||||
for($j=0; $j < count($obj->log_list); $j++)
|
||||
{
|
||||
$buff .= sprintf('$xml_info->history['.$i.']->logs['.$j.']->text = "%s";', $obj->log_list[$j]->body);
|
||||
$buff .= sprintf('$xml_info->history['.$i.']->logs['.$j.']->link = "%s";', $obj->log_list[$j]->attrs->link);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
sscanf($xml_doc->component->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
|
||||
$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
|
||||
$xml_info->component_name = $component;
|
||||
|
|
@ -746,9 +826,11 @@
|
|||
}
|
||||
// List extra variables (text type only for editor component)
|
||||
$extra_vars = $xml_doc->component->extra_vars->var;
|
||||
if($extra_vars) {
|
||||
if($extra_vars)
|
||||
{
|
||||
if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
|
||||
foreach($extra_vars as $key => $val) {
|
||||
foreach($extra_vars as $key => $val)
|
||||
{
|
||||
unset($obj);
|
||||
$key = $val->attrs->name;
|
||||
$title = $val->title->body;
|
||||
|
|
@ -769,5 +851,6 @@
|
|||
include($cache_file);
|
||||
return $xml_info;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
||||
/* End of file editor.model.php */
|
||||
/* Location: ./modules/editor/editor.model.php */
|
||||
|
|
|
|||
|
|
@ -1,22 +1,23 @@
|
|||
<?php
|
||||
/**
|
||||
/**
|
||||
* @class editorView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief view class of the editor module
|
||||
**/
|
||||
|
||||
class editorView extends editor {
|
||||
|
||||
*/
|
||||
class editorView extends editor
|
||||
{
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Action to get a request to display compoenet pop-up
|
||||
**/
|
||||
function dispEditorPopup() {
|
||||
*/
|
||||
function dispEditorPopup()
|
||||
{
|
||||
// add a css file
|
||||
Context::loadFile($this->module_path."tpl/css/editor.css", true);
|
||||
// List variables
|
||||
|
|
@ -28,11 +29,14 @@
|
|||
// Get compoenet object
|
||||
$oEditorModel = &getModel('editor');
|
||||
$oComponent = &$oEditorModel->getComponentObject($component, $editor_sequence, $site_srl);
|
||||
if(!$oComponent->toBool()) {
|
||||
if(!$oComponent->toBool())
|
||||
{
|
||||
Context::set('message', sprintf(Context::getLang('msg_component_is_not_founded'), $component));
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('component_not_founded');
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the result after executing a method to display popup url of the component
|
||||
$popup_content = $oComponent->getPopupContent();
|
||||
Context::set('popup_content', $popup_content);
|
||||
|
|
@ -46,8 +50,9 @@
|
|||
|
||||
/**
|
||||
* @brief Get component information
|
||||
**/
|
||||
function dispEditorComponentInfo() {
|
||||
*/
|
||||
function dispEditorComponentInfo()
|
||||
{
|
||||
$component_name = Context::get('component_name');
|
||||
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
|
|
@ -64,12 +69,14 @@
|
|||
|
||||
/**
|
||||
* @brief Add a form for editor addition setup
|
||||
**/
|
||||
function triggerDispEditorAdditionSetup(&$obj) {
|
||||
*/
|
||||
function triggerDispEditorAdditionSetup(&$obj)
|
||||
{
|
||||
$current_module_srl = Context::get('module_srl');
|
||||
$current_module_srls = Context::get('module_srls');
|
||||
|
||||
if(!$current_module_srl && !$current_module_srls) {
|
||||
if(!$current_module_srl && !$current_module_srls)
|
||||
{
|
||||
// Get information of the current module
|
||||
$current_module_info = Context::get('current_module_info');
|
||||
$current_module_srl = $current_module_info->module_srl;
|
||||
|
|
@ -92,7 +99,8 @@
|
|||
Context::set('editor_comment_colorset_list', $skin_info->colorset);
|
||||
|
||||
$contents = FileHandler::readDir(_XE_PATH_.'modules/editor/styles');
|
||||
for($i=0,$c=count($contents);$i<$c;$i++) {
|
||||
for($i=0,$c=count($contents);$i<$c;$i++)
|
||||
{
|
||||
$style = $contents[$i];
|
||||
$info = $oModuleModel->loadSkinInfo($this->module_path,$style,'styles');
|
||||
$content_style_list[$style]->title = $info->title;
|
||||
|
|
@ -120,12 +128,14 @@
|
|||
}
|
||||
|
||||
|
||||
function dispEditorPreview(){
|
||||
function dispEditorPreview()
|
||||
{
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('preview');
|
||||
}
|
||||
|
||||
function dispEditorSkinColorset(){
|
||||
function dispEditorSkinColorset()
|
||||
{
|
||||
$skin = Context::get('skin');
|
||||
$oModuleModel = &getModel('module');
|
||||
$skin_info = $oModuleModel->loadSkinInfo($this->module_path,$skin);
|
||||
|
|
@ -133,7 +143,8 @@
|
|||
Context::set('colorset', $colorset);
|
||||
}
|
||||
|
||||
function dispEditorConfigPreview() {
|
||||
function dispEditorConfigPreview()
|
||||
{
|
||||
$oEditorModel = &getModel('editor');
|
||||
$config = $oEditorModel->getEditorConfig();
|
||||
|
||||
|
|
@ -177,11 +188,10 @@
|
|||
|
||||
Context::set('editor', $editor);
|
||||
|
||||
|
||||
$this->setLayoutFile('popup_layout');
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('config_preview');
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
||||
/* End of file editor.view.php */
|
||||
/* Location: ./modules/editor/editor.view.php */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue