diff --git a/modules/widget/widget.admin.view.php b/modules/widget/widget.admin.view.php
index 6e2192720..14fa9406c 100644
--- a/modules/widget/widget.admin.view.php
+++ b/modules/widget/widget.admin.view.php
@@ -21,8 +21,7 @@ class WidgetAdminView extends Widget
function dispWidgetAdminDownloadedList()
{
// Set widget list
- $oWidgetModel = getModel('widget');
- $widget_list = $oWidgetModel->getDownloadedWidgetList();
+ $widget_list = WidgetModel::getDownloadedWidgetList();
$security = new Security($widget_list);
$widget_list = $security->encodeHTML('..', '..author..');
@@ -59,20 +58,21 @@ class WidgetAdminView extends Widget
function dispWidgetAdminAddContent()
{
$module_srl = Context::get('module_srl');
- if(!$module_srl) throw new Rhymix\Framework\Exceptions\InvalidRequest;
+ if (!$module_srl)
+ {
+ throw new Rhymix\Framework\Exceptions\InvalidRequest;
+ }
$document_srl = Context::get('document_srl');
- $oDocumentModel = getModel('document');
- $oDocument = $oDocumentModel->getDocument($document_srl);
+ $oDocument = DocumentModel::getDocument($document_srl);
Context::set('oDocument', $oDocument);
- $oModuleModel = getModel('module');
$columnList = array('module_srl', 'mid');
- $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
+ $module_info = ModuleModel::getModuleInfoByModuleSrl($module_srl, $columnList);
Context::set('module_info', $module_info);
+
// Editors settings of the module by calling getEditor
- $oEditorModel = getModel('editor');
- $editor = $oEditorModel->getModuleEditor('document',$module_srl, $module_srl,'module_srl','content');
+ $editor = EditorModel::getModuleEditor('document', $module_srl, $module_srl, 'module_srl', 'content');
Context::set('editor', $editor);
$security = new Security();
diff --git a/modules/widget/widget.controller.php b/modules/widget/widget.controller.php
index c19daf630..aa4b6c7a8 100644
--- a/modules/widget/widget.controller.php
+++ b/modules/widget/widget.controller.php
@@ -28,16 +28,18 @@ class WidgetController extends Widget
$skin = Context::get('skin');
$path = sprintf('./widgets/%s/', $widget);
- $oModuleModel = getModel('module');
- $skin_info = $oModuleModel->loadSkinInfo($path, $skin);
+ $skin_info = ModuleModel::loadSkinInfo($path, $skin);
$colorset_list = [];
- foreach($skin_info->colorset ?: [] as $colorset)
+ foreach ($skin_info->colorset ?: [] as $colorset)
{
$colorset_list[] = sprintf('%s|@|%s', $colorset->name, $colorset->title);
}
+ if (count($colorset_list))
+ {
+ $colorsets = implode("\n", $colorset_list);
+ }
- if(count($colorset_list)) $colorsets = implode("\n", $colorset_list);
$this->add('colorset_list', $colorsets);
}
@@ -47,13 +49,18 @@ class WidgetController extends Widget
function procWidgetGenerateCode()
{
$widget = Context::get('selected_widget');
- if(!$widget) throw new Rhymix\Framework\Exceptions\InvalidRequest;
- if(!Context::get('skin')) throw new Rhymix\Framework\Exception('msg_widget_skin_is_null');
+ if (!$widget)
+ {
+ throw new Rhymix\Framework\Exceptions\InvalidRequest;
+ }
+ if (!Context::get('skin'))
+ {
+ throw new Rhymix\Framework\Exception('msg_widget_skin_is_null');
+ }
$attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars);
$widget_code = sprintf('', $widget, implode(' ',$attribute));
- // Code output
$this->add('widget_code', $widget_code);
}
@@ -63,9 +70,14 @@ class WidgetController extends Widget
function procWidgetGenerateCodeInPage()
{
$widget = Context::get('selected_widget');
- if(!$widget) throw new Rhymix\Framework\Exceptions\InvalidRequest;
-
- if(!in_array($widget,array('widgetBox','widgetContent')) && !Context::get('skin')) throw new Rhymix\Framework\Exception('msg_widget_skin_is_null');
+ if (!$widget)
+ {
+ throw new Rhymix\Framework\Exceptions\InvalidRequest;
+ }
+ if (!in_array($widget,array('widgetBox','widgetContent')) && !Context::get('skin'))
+ {
+ throw new Rhymix\Framework\Exception('msg_widget_skin_is_null');
+ }
$this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars);
@@ -100,17 +112,23 @@ class WidgetController extends Widget
$editor_sequence = Context::get('editor_sequence');
$err = 0;
- $oLayoutModel = getModel('layout');
- $layout_info = $oLayoutModel->getLayout($module_srl);
- if(!$layout_info || $layout_info->type != 'faceoff') $err++;
+ $layout_info = LayoutModel::getLayout($module_srl);
+ if (!$layout_info || $layout_info->type != 'faceoff')
+ {
+ $err++;
+ }
// Destination Information Wanted page module
- $oModuleModel = getModel('module');
$columnList = array('module_srl', 'module');
- $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
- if(!$page_info->module_srl || $page_info->module != 'page') $err++;
-
- if($err > 1) throw new Rhymix\Framework\Exceptions\InvalidRequest;
+ $page_info = ModuleModel::getModuleInfoByModuleSrl($module_srl, $columnList);
+ if (!$page_info->module_srl || $page_info->module != 'page')
+ {
+ $err++;
+ }
+ if ($err > 1)
+ {
+ throw new Rhymix\Framework\Exceptions\InvalidRequest;
+ }
// Check permissions
$logged_info = Context::get('logged_info');
@@ -118,23 +136,21 @@ class WidgetController extends Widget
{
throw new Rhymix\Framework\Exceptions\NotPermitted;
}
- $module_grant = $oModuleModel->getGrant($page_info, $logged_info);
+ $module_grant = ModuleModel::getGrant($page_info, $logged_info);
if (!$module_grant->manager)
{
throw new Rhymix\Framework\Exceptions\NotPermitted;
}
// Enter post
- $oDocumentModel = getModel('document');
- $oDocumentController = getController('document');
-
$obj = new stdClass();
$obj->module_srl = $module_srl;
$obj->content = $content;
$obj->document_srl = $document_srl;
$obj->use_editor = 'Y';
- $oDocument = $oDocumentModel->getDocument($obj->document_srl);
+ $oDocument = DocumentModel::getDocument($obj->document_srl);
+ $oDocumentController = DocumentController::getInstance();
if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl)
{
$output = $oDocumentController->updateDocument($oDocument, $obj);
@@ -146,7 +162,10 @@ class WidgetController extends Widget
}
// Stop when an error occurs
- if(!$output->toBool()) return $output;
+ if (!$output->toBool())
+ {
+ return $output;
+ }
// Return results
$this->add('document_srl', $obj->document_srl);
@@ -160,18 +179,16 @@ class WidgetController extends Widget
// Variable Wanted
$document_srl = Context::get('document_srl');
- $oDocumentModel = getModel('document');
- $oDocumentController = getController('document');
- $oDocumentAdminController = getAdminController('document');
-
- $oDocument = $oDocumentModel->getDocument($document_srl);
- if(!$oDocument->isExists()) throw new Rhymix\Framework\Exceptions\InvalidRequest;
+ $oDocument = DocumentModel::getDocument($document_srl);
+ if (!$oDocument->isExists())
+ {
+ throw new Rhymix\Framework\Exceptions\InvalidRequest;
+ }
$module_srl = $oDocument->get('module_srl');
// Destination Information Wanted page module
- $oModuleModel = getModel('module');
$columnList = array('module_srl', 'module');
- $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
+ $page_info = ModuleModel::getModuleInfoByModuleSrl($module_srl, $columnList);
if(!$page_info->module_srl || $page_info->module != 'page') throw new Rhymix\Framework\Exceptions\InvalidRequest;
// Check permissions
@@ -180,14 +197,18 @@ class WidgetController extends Widget
{
throw new Rhymix\Framework\Exceptions\NotPermitted;
}
- $module_grant = $oModuleModel->getGrant($page_info, $logged_info);
+ $module_grant = ModuleModel::getGrant($page_info, $logged_info);
if (!$module_grant->manager)
{
throw new Rhymix\Framework\Exceptions\NotPermitted;
}
+ $oDocumentAdminController = DocumentAdminController::getInstance();
$output = $oDocumentAdminController->copyDocumentModule(array($oDocument->get('document_srl')), $oDocument->get('module_srl'),0);
- if(!$output->toBool()) return $output;
+ if (!$output->toBool())
+ {
+ return $output;
+ }
// Return results
$copied_srls = $output->get('copied_srls');
@@ -201,18 +222,19 @@ class WidgetController extends Widget
{
// Variable Wanted
$document_srl = Context::get('document_srl');
-
- $oDocumentModel = getModel('document');
- $oDocumentController = getController('document');
-
- $oDocument = $oDocumentModel->getDocument($document_srl);
- if(!$oDocument->isExists()) return;
+ $oDocument = DocumentModel::getDocument($document_srl);
+ if (!$oDocument->isExists())
+ {
+ return;
+ }
$module_srl = $oDocument->get('module_srl');
// Destination Information Wanted page module
- $oModuleModel = getModel('module');
- $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
- if(!$page_info->module_srl || $page_info->module != 'page') throw new Rhymix\Framework\Exceptions\InvalidRequest;
+ $page_info = ModuleModel::getModuleInfoByModuleSrl($module_srl);
+ if (!$page_info->module_srl || $page_info->module != 'page')
+ {
+ throw new Rhymix\Framework\Exceptions\InvalidRequest;
+ }
// Check permissions
$logged_info = Context::get('logged_info');
@@ -220,14 +242,18 @@ class WidgetController extends Widget
{
throw new Rhymix\Framework\Exceptions\NotPermitted;
}
- $module_grant = $oModuleModel->getGrant($page_info, $logged_info);
+ $module_grant = ModuleModel::getGrant($page_info, $logged_info);
if (!$module_grant->manager)
{
throw new Rhymix\Framework\Exceptions\NotPermitted;
}
+ $oDocumentController = DocumentController::getInstance();
$output = $oDocumentController->deleteDocument($oDocument->get('document_srl'));
- if(!$output->toBool()) return $output;
+ if (!$output->toBool())
+ {
+ return $output;
+ }
}
/**
@@ -258,11 +284,14 @@ class WidgetController extends Widget
{
$content = Context::replaceUserLang($content);
}
+
// Check whether to include information about editing
$this->javascript_mode = $javascript_mode;
+
// Widget code box change
$content = preg_replace_callback('!