40 $oEditorController->deleteSavedDoc(
true);
53 $oComponent = &$oEditorModel->getComponentObject($component);
54 if(!$oComponent->toBool())
return $oComponent;
56 if(!method_exists($oComponent, $method))
return new BaseObject(-1, sprintf(
Context::getLang(
'msg_component_is_not_founded'), $component));
60 if(method_exists($oComponent, $method))
$output = $oComponent->{$method}();
61 else return new BaseObject(-1,sprintf(
'%s method is not exists', $method));
65 $this->
setError($oComponent->getError());
68 $vars = $oComponent->getVariables();
71 foreach($vars as $key => $val)
73 $this->
add($key, $val);
84 $target_module_srl = array_map(
'trim', explode(
',', $target_module_srl));
89 foreach($target_module_srl as $srl)
96 return new BaseObject(-1,
'msg_invalid_request');
100 if(!$module_grant->manager)
102 return new BaseObject(-1,
'msg_not_permitted');
108 $editor_config =
new stdClass;
109 $editor_config->editor_skin =
Context::get(
'editor_skin');
110 $editor_config->comment_editor_skin =
Context::get(
'comment_editor_skin');
111 $editor_config->content_style =
Context::get(
'content_style');
112 $editor_config->comment_content_style =
Context::get(
'comment_content_style');
113 $editor_config->content_font =
Context::get(
'content_font');
114 if($editor_config->content_font)
116 $font_list = array();
117 $fonts = explode(
',',$editor_config->content_font);
118 for($i=0,$c=count($fonts);$i<$c;$i++)
120 $font = trim(str_replace(array(
'"',
'\''),
'',$fonts[$i]));
122 $font_list[] = $font;
124 if(count($font_list)) $editor_config->content_font =
'"'.implode(
'","',$font_list).
'"';
126 $editor_config->content_font_size =
Context::get(
'content_font_size');
127 $editor_config->sel_editor_colorset =
Context::get(
'sel_editor_colorset');
128 $editor_config->sel_comment_editor_colorset =
Context::get(
'sel_comment_editor_colorset');
130 $grants = array(
'enable_html_grant',
'enable_comment_html_grant',
'upload_file_grant',
'comment_upload_file_grant',
'enable_default_component_grant',
'enable_comment_default_component_grant',
'enable_component_grant',
'enable_comment_component_grant');
132 foreach($grants as $key)
137 $editor_config->{$key} = array();
139 else if(is_array($grant))
141 $editor_config->{$key} = $grant;
145 $editor_config->{$key} = explode(
'|@|', $grant);
149 $editor_config->editor_height = (int)
Context::get(
'editor_height');
150 $editor_config->comment_editor_height = (int)
Context::get(
'comment_editor_height');
151 $editor_config->enable_autosave =
Context::get(
'enable_autosave');
152 if($editor_config->enable_autosave !=
'Y') $editor_config->enable_autosave =
'N';
161 $this->setMessage(
'success_updated',
'info');
164 $this->setRedirectUrl($returnUrl);
179 $editor_config = $oEditorModel->getEditorConfig(
$module_srl);
180 $content_style = $editor_config->content_style;
183 $path =
_XE_PATH_ .
'modules/editor/styles/'.$content_style.
'/';
184 if(is_dir($path) && file_exists($path .
'style.ini'))
186 $ini =
file($path.
'style.ini');
187 for($i = 0, $c = count($ini); $i < $c; $i++)
189 $file = trim($ini[$i]);
192 if(substr_compare($file,
'.css', -4) === 0)
196 elseif(substr_compare($file,
'.js', -3) === 0)
203 $content_font = $editor_config->content_font;
204 $content_font_size = $editor_config->content_font_size;
205 if($content_font || $content_font_size)
208 $buff[] =
'<style> .xe_content { ';
209 if($content_font) $buff[] =
'font-family:'.$content_font.
';';
210 if($content_font_size) $buff[] =
'font-size:'.$content_font_size.
';';
211 $buff[] =
' }</style>';
216 $content = $this->transComponent($content);
225 $content = preg_replace_callback(
'!<(?:(div)|img)([^>]*)editor_component=([^>]*)>(?(1)(.*?)</div>)!is', array($this,
'transEditorComponent'), $content);
234 $script =
" {$match[2]} editor_component={$match[3]}";
235 $script = preg_replace(
'/([\w:-]+)\s*=(?:\s*(["\']))?((?(2).*?|[^ ]+))\2/i',
'\1="\3"', $script);
236 preg_match_all(
'/([a-z0-9_-]+)="([^"]+)"/is', $script, $m);
238 $xml_obj =
new stdClass;
239 $xml_obj->attrs =
new stdClass;
240 for($i=0,$c=count($m[0]);$i<$c;$i++)
242 if(!isset($xml_obj->attrs)) $xml_obj->attrs =
new stdClass;
243 $xml_obj->attrs->{$m[1][$i]} = $m[2][$i];
245 $xml_obj->body = $match[4];
247 if(!$xml_obj->attrs->editor_component)
return $match[0];
251 $oComponent = &$oEditorModel->getComponentObject($xml_obj->attrs->editor_component, 0);
252 if(!is_object($oComponent)||!method_exists($oComponent,
'transHTML'))
return $match[0];
254 return $oComponent->transHTML($xml_obj);
262 if(!
$args->document_srl)
$args->document_srl = $_SESSION[
'upload_info'][$editor_sequence]->upload_target_srl;
266 if(!
$args->module_srl)
268 $current_module_info =
Context::get(
'current_module_info');
269 $args->module_srl = $current_module_info->module_srl;
279 $args->certify_key = $_COOKIE[
'autosave_certify_key_' .
$args->module_srl];
281 setcookie(
'autosave_certify_key_' .
$args->module_srl,
$args->certify_key, $_SERVER[
'REQUEST_TIME'] + 3600,
'',
'',
false,
true);
297 $saved_doc = $oEditorModel->getSavedDoc(null);
299 $oFileController->setUploadInfo($editor_sequence, $saved_doc->document_srl);
300 $vars = $this->getVariables();
301 $this->add(
"editor_sequence", $editor_sequence);
302 $this->add(
"key", $primary_key);
303 $this->add(
"title", $saved_doc->title);
304 $this->add(
"content", $saved_doc->content);
305 $this->add(
"document_srl", $saved_doc->document_srl);
313 $this->deleteSavedDoc(
false);
323 $args =
new stdClass();
327 if(!
$args->module_srl)
329 $current_module_info =
Context::get(
'current_module_info');
330 $args->module_srl = $current_module_info->module_srl;
339 $args->certify_key = $_COOKIE[
'autosave_certify_key_' .
$args->module_srl];
342 if(!
$args->certify_key) {
343 unset(
$args->certify_key);
344 $args->ipaddress = $_SERVER[
'REMOTE_ADDR'];
350 if(!$saved_doc)
return;
354 if(!$oSaved->isExists())
372 $args->site_srl = $site_srl;
383 $args =
new stdClass;
385 if($filter_enabled)
$args->enabled =
"Y";
389 $args->site_srl = $site_srl;
407 else $group_list = array();
411 if(!is_array($db_list)) $db_list = array($db_list);
412 $component_list =
new stdClass();
413 foreach($db_list as $component)
415 if(in_array($component->component_name, array(
'colorpicker_text',
'colorpicker_bg')))
continue;
417 $component_name = $component->component_name;
418 if(!$component_name)
continue;
420 if(!in_array($component_name, $downloaded_list))
continue;
423 $xml_info = $oEditorModel->getComponentXmlInfo($component_name);
424 $xml_info->enabled = $component->enabled;
426 if($component->extra_vars)
431 $xml_info->target_group =
$extra_vars->target_group;
461 if($xml_info->extra_vars)
463 foreach($xml_info->extra_vars as $key => $val)
465 $xml_info->extra_vars->{$key}->value =
$extra_vars->{$key};
470 $component_list->{$component_name} = $xml_info;
472 $icon_file =
_XE_PATH_.
'modules/editor/components/'.$component_name.
'/icon.gif';
473 $component_icon_file =
_XE_PATH_.
'modules/editor/components/'.$component_name.
'/component_icon.gif';
474 if(file_exists($icon_file)) $component_list->{$component_name}->icon =
true;
475 if(file_exists($component_icon_file)) $component_list->{$component_name}->component_icon =
true;
479 if(!$filter_enabled) {
481 foreach($downloaded_list as $component_name)
483 if(!is_dir(
_XE_PATH_.
'modules/editor/components/'.$component_name))
continue;
484 if(in_array($component_name, array(
'colorpicker_text',
'colorpicker_bg')))
continue;
486 if($component_list->{$component_name})
continue;
489 $oEditorController->insertComponent($component_name,
false, $site_srl);
492 $xml_info = $oEditorModel->getComponentXmlInfo($component_name);
493 $xml_info->enabled =
'N';
495 $component_list->{$component_name} = $xml_info;
500 if($oCacheHandler->isSupport()) {
501 $cache_key = $oEditorModel->getComponentListCacheKey($filter_enabled, $site_srl);
502 $oCacheHandler->put($cache_key, $component_list);
505 return $component_list;
518 if($oCacheHandler->isSupport()) {
519 $cache_key = $oEditorModel->getComponentListCacheKey(
true, $site_srl);
520 $oCacheHandler->delete($cache_key);
521 $cache_key = $oEditorModel->getComponentListCacheKey(
false, $site_srl);
522 $oCacheHandler->delete($cache_key);
529 $editorConfig =
$oModuleModel->getModulePartConfig(
'editor',
$obj->originModuleSrl);
532 if(is_array(
$obj->moduleSrlList))
534 foreach(
$obj->moduleSrlList AS $key=>$moduleSrl)
setMessage($message= 'success', $type=NULL)
getController($module_name)
procEditorRemoveSavedDoc()
Delete autosaved documents.
procEditorSaveDoc()
AutoSave.
removeCache($site_srl=0)
Delete cache files.
& getInstance($target= 'object', $info=null, $always_use_file=false)
transComponent($content)
Convert editor component codes to be returned.
makeCache($filter_enabled=true, $site_srl)
Caching a list of editor component (editorModel::getComponentList) For the editor component list...
foreach($sitemap as $id=> &$val) $extra_vars
deleteSavedDoc($mode=false)
Delete the auto-saved document Based on the current logged-in user.
procEditorCall()
Execute a method of the component when the component requests ajax.
triggerDeleteSavedDoc(&$obj)
A trigger to remove auto-saved document when inserting/updating the document.
transEditorComponent($match)
Convert editor component code of the contents.
triggerEditorComponentCompile(&$content)
convert editor component codes to be returned and specify content style.
addJsFile($file, $optimized=FALSE, $targetie= '', $index=0, $type= 'head', $isRuleset=FALSE, $autoPath=null)
addCSSFile($file, $optimized=FALSE, $media= 'all', $targetie= '', $index=0)
createSecureSalt($length, $format= 'hex')
Generate a cryptographically secure random string to use as a salt.
doSaveDoc($args)
AutoSave.
high class of the editor odule
removeEditorConfig($site_srl)
ERemove editor component information used on the virtual site.
getAdminController($module_name)
readDir($path, $filter= '', $to_lower=FALSE, $concat_prefix=FALSE)
executeQuery($query_id, $args=NULL, $arg_columns=NULL)
procEditorLoadSavedDocument()
Load the srl of autosaved document - for those who uses XE older versions.
triggerCall($trigger_name, $called_position, &$obj)
procEditorInsertModuleConfig()
Save Editor's additional form for each module.