issue 2119. supporting php 5.4. modules and widgets.

git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12706 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
flyskyko 2013-02-05 09:45:04 +00:00
parent ff75082eee
commit 8a7c28babc
90 changed files with 572 additions and 83 deletions

View file

@ -53,6 +53,7 @@ class editorAdminController extends editor
*/
function editorCheckUse($componentList, $site_srl = 0)
{
$args = new stdClass();
$args->site_srl = $site_srl;
foreach($componentList as $componentName => $value)
@ -79,6 +80,7 @@ class editorAdminController extends editor
*/
function editorListOrder($component_names, $site_srl = 0)
{
$args = new stdClass();
$args->site_srl = $site_srl;
$list_order_num = '30';
if(is_array($component_names))

View file

@ -28,6 +28,11 @@ class editorAdminView extends editor
$oModuleModel = &getModel('module');
$editor_config = $oModuleModel->getModuleConfig('editor');
if(!$editor_config)
{
$editor_config = new stdClass();
}
//editor_config init
if(!$editor_config->editor_height) $editor_config->editor_height = 300;
if(!$editor_config->comment_editor_height) $editor_config->comment_editor_height = 100;
@ -42,10 +47,12 @@ class editorAdminView extends editor
$skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->editor_skin);
$contents = FileHandler::readDir(_XE_PATH_.'modules/editor/styles');
$content_style_list = array();
for($i=0,$c=count($contents);$i<$c;$i++)
{
$style = $contents[$i];
$info = $oModuleModel->loadSkinInfo($this->module_path,$style,'styles');
$content_style_list[$style] = new stdClass();
$content_style_list[$style]->title = $info->title;
}
@ -71,6 +78,7 @@ class editorAdminView extends editor
//editor preview
$config = $oEditorModel->getEditorConfig();
$option = new stdClass();
$option->allow_fileupload = false;
$option->content_style = $config->content_style;
$option->content_font = $config->content_font;
@ -88,6 +96,7 @@ class editorAdminView extends editor
Context::set('preview_editor', $editor);
$option_com = new stdClass();
$option_com->allow_fileupload = false;
$option_com->content_style = $config->content_style;
$option_com->content_font = $config->content_font;
@ -142,6 +151,7 @@ class editorAdminView extends editor
// Get a mid list
$oModuleModel = &getModel('module');
$args =new stdClass();
$args->site_srl = $site_srl;
$columnList = array('module_srl', 'mid', 'module_category_srl', 'browser_title');
$mid_list = $oModuleModel->getMidList($args, $columnList);

View file

@ -286,6 +286,7 @@ class editorController extends editor
*/
function deleteSavedDoc($mode = false)
{
$args = new stdClass();
if(Context::get('is_logged'))
{
$logged_info = Context::get('logged_info');
@ -362,6 +363,7 @@ class editorController extends editor
}
// Get xml information for looping DB list
if(!is_array($db_list)) $db_list = array($db_list);
$component_list = new stdClass();
foreach($db_list as $component)
{
if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) continue;

View file

@ -33,7 +33,7 @@ class editorModel extends editor
$oModuleModel = &getModel('module');
$editor_default_config = $oModuleModel->getModuleConfig('editor');
if(!is_object($editor_config)) $editor_config = null;
if(!is_object($editor_config)) $editor_config = new stdClass();
if(!is_array($editor_config->enable_html_grant)) $editor_config->enable_html_grant = array();
if(!is_array($editor_config->enable_comment_html_grant)) $editor_config->enable_comment_html_grant = array();
@ -368,6 +368,9 @@ class editorModel extends editor
{
// Get editor settings of the module
$editor_config = $this->getEditorConfig($module_srl);
$config = new stdClass();
// Configurations listed according to a type
if($type == 'document')
{
@ -408,6 +411,7 @@ class editorModel extends editor
$group_list = array();
}
// Pre-set option variables of editor
$option = new stdClass();
$option->skin = $config->editor_skin;
$option->content_style = $config->content_style;
$option->content_font = $config->content_font;
@ -488,6 +492,7 @@ class editorModel extends editor
*/
function getSavedDoc($upload_target_srl)
{
$auto_save_args = new stdClass();
// Find a document by using member_srl for logged-in user and ipaddress for non-logged user
if(Context::get('is_logged'))
{
@ -658,6 +663,7 @@ class editorModel extends editor
*/
function getComponent($component_name, $site_srl = 0)
{
$args =new stdClass();
$args->component_name = $component_name;
if($site_srl)
@ -732,6 +738,7 @@ class editorModel extends editor
// Component information listed
if($xml_doc->component->version && $xml_doc->component->attrs->version == '0.2')
{
$component_info = new stdClass();
$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);
@ -742,6 +749,7 @@ class editorModel extends editor
$component_info->license_link = $xml_doc->component->license->attrs->link;
$buff = '<?php if(!defined("__ZBXE__")) exit(); ';
$buff .= '$xml_info = new stdClass();';
$buff .= sprintf('$xml_info->component_name = "%s";', $component_info->component_name);
$buff .= sprintf('$xml_info->title = "%s";', $component_info->title);
$buff .= sprintf('$xml_info->description = "%s";', $component_info->description);
@ -756,6 +764,7 @@ class editorModel extends editor
for($i=0; $i < count($author_list); $i++)
{
$buff .= '$xml_info->author[' . $i .']= new stdClass();';
$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);
@ -772,6 +781,7 @@ class editorModel extends editor
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);
$buff .= '$xml_info->history[' . $i . '] = new stdClass();';
$buff .= sprintf('$xml_info->history['.$i.']->description = "%s";', $history_list[$i]->description->body);
$buff .= sprintf('$xml_info->history['.$i.']->version = "%s";', $history_list[$i]->attrs->version);
$buff .= sprintf('$xml_info->history['.$i.']->date = "%s";', $date);
@ -782,6 +792,7 @@ class editorModel extends editor
for($j=0; $j < count($obj->author_list); $j++)
{
$buff .= '$xml_info->history[' . $i . ']->author[' . $j . '] = new stdClass();';
$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);
@ -794,6 +805,7 @@ class editorModel extends editor
for($j=0; $j < count($obj->log_list); $j++)
{
$buff .= '$xml_info->history[' . $i . ']->log[' . $j . '] = new stdClass();';
$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);
}
@ -805,6 +817,7 @@ class editorModel extends editor
{
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 = new stdClass();
$xml_info->component_name = $component;
$xml_info->title = $xml_doc->component->title->body;
$xml_info->description = str_replace('\n', "\n", $xml_doc->component->author->description->body);
@ -815,6 +828,7 @@ class editorModel extends editor
$xml_info->author->homepage = $xml_doc->component->author->attrs->link;
$buff = '<?php if(!defined("__ZBXE__")) exit(); ';
$buff .= '$xml_info = new stdClass();';
$buff .= sprintf('$xml_info->component_name = "%s";', $xml_info->component_name);
$buff .= sprintf('$xml_info->title = "%s";', $xml_info->title);
$buff .= sprintf('$xml_info->description = "%s";', $xml_info->description);
@ -838,6 +852,7 @@ class editorModel extends editor
$xml_info->extra_vars->{$key}->title = $title;
$xml_info->extra_vars->{$key}->description = $description;
$buff .= sprintf('$xml_info->extra_vars->%s = new stdClass();', $key);
$buff .= sprintf('$xml_info->extra_vars->%s->%s = "%s";', $key, 'title', $title);
$buff .= sprintf('$xml_info->extra_vars->%s->%s = "%s";', $key, 'description', $description);
}

View file

@ -99,10 +99,12 @@ class editorView extends editor
Context::set('editor_comment_colorset_list', $skin_info->colorset);
$contents = FileHandler::readDir(_XE_PATH_.'modules/editor/styles');
$content_style_list = array();
for($i=0,$c=count($contents);$i<$c;$i++)
{
$style = $contents[$i];
$info = $oModuleModel->loadSkinInfo($this->module_path,$style,'styles');
$content_style_list[$style] = new stdClass();
$content_style_list[$style]->title = $info->title;
}
Context::set('content_style_list', $content_style_list);
@ -152,6 +154,7 @@ class editorView extends editor
if($mode != 'main')
{
$option_com = new stdClass();
$option_com->allow_fileupload = false;
$option_com->content_style = $config->content_style;
$option_com->content_font = $config->content_font;
@ -170,6 +173,7 @@ class editorView extends editor
}
else
{
$option = new stdClass();
$option->allow_fileupload = false;
$option->content_style = $config->content_style;
$option->content_font = $config->content_font;