XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
editor.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
8 class editor extends ModuleObject
9 {
13  function moduleInstall()
14  {
15  // Register action forward (to use in administrator mode)
17  // Add the default editor component
18  $oEditorController = getAdminController('editor');
19  $oEditorController->insertComponent('colorpicker_text',true);
20  $oEditorController->insertComponent('colorpicker_bg',true);
21  $oEditorController->insertComponent('emoticon',true);
22  $oEditorController->insertComponent('url_link',true);
23  $oEditorController->insertComponent('image_link',true);
24  $oEditorController->insertComponent('multimedia_link',true);
25  $oEditorController->insertComponent('quotation',true);
26  $oEditorController->insertComponent('table_maker',true);
27  $oEditorController->insertComponent('poll_maker',true);
28  $oEditorController->insertComponent('image_gallery',true);
29  // Create a directory to use in the editor module
30  FileHandler::makeDir('./files/cache/editor');
31  // 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified
32  $oModuleController->insertTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
33  $oModuleController->insertTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
34  // 2007. 10. 23 Add an editor trigger on the module addition setup
35  $oModuleController->insertTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before');
36  // 2009. 04. 14 Add a trigger from compiled codes of the editor component
37  $oModuleController->insertTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before');
38 
39  return new BaseObject();
40  }
41 
45  function checkUpdate()
46  {
47  $oDB = &DB::getInstance();
48  $oModuleModel = getModel('module');
50  $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
51  if($oModuleModel->needUpdate($version_update_id))
52  {
53  // 2009. 06. 15 Save module_srl when auto-saving
54  if(!$oDB->isColumnExists("editor_autosave","module_srl")) return true;
55  if(!$oDB->isIndexExists("editor_autosave","idx_module_srl")) return true;
56 
57  // 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified
58  if(!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) return true;
59  if(!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) return true;
60  // 2007. 10. 23 Add an editor trigger on the module addition setup
61  if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before')) return true;
62  // 2009. 04. 14 Add a trigger from compiled codes of the editor component
63  if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before')) return true;
64  // 2009. 06. 19 Remove unused trigger
65  if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before')) return true;
66 
67  // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
68  if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'editor', 'controller', 'triggerCopyModule', 'after')) return true;
69 
70  if(!$oDB->isColumnExists("editor_autosave", "certify_key")) return true;
71  if(!$oDB->isIndexExists('editor_autosave', 'idx_certify_key')) return true;
72 
73  $oModuleController->insertUpdatedLog($version_update_id);
74  }
75 
76  return false;
77  }
78 
82  function moduleUpdate()
83  {
84  $oDB = &DB::getInstance();
85  $oModuleModel = getModel('module');
87  $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
88  if($oModuleModel->needUpdate($version_update_id))
89  {
90  // Save module_srl when auto-saving 15/06/2009
91  if(!$oDB->isColumnExists("editor_autosave","module_srl"))
92  $oDB->addColumn("editor_autosave","module_srl","number",11);
93 
94  // create an index on module_srl
95  if(!$oDB->isIndexExists("editor_autosave","idx_module_srl")) $oDB->addIndex("editor_autosave","idx_module_srl", "module_srl");
96 
97  // 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified
98  if(!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after'))
99  $oModuleController->insertTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
100  if(!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after'))
101  $oModuleController->insertTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
102  // 2007. 10. Add an editor trigger on the module addition setup
103  if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before'))
104  $oModuleController->insertTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before');
105  // 2009. 04. 14 Add a trigger from compiled codes of the editor component
106  if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before'))
107  $oModuleController->insertTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before');
108  // 2009. 06. 19 Remove unused trigger
109  if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before'))
110  $oModuleController->deleteTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before');
111 
112  // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
113  if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'editor', 'controller', 'triggerCopyModule', 'after'))
114  {
115  $oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'editor', 'controller', 'triggerCopyModule', 'after');
116  }
117 
118  // @see https://github.com/xpressengine/xe-core/issues/2229
119  if(!$oDB->isColumnExists('editor_autosave','certify_key'))
120  {
121  $oDB->addColumn('editor_autosave', 'certify_key', 'varchar', 100);
122  }
123  if(!$oDB->isIndexExists("editor_autosave","idx_certify_key"))
124  {
125  $oDB->addIndex("editor_autosave","idx_certify_key", "certify_key");
126  }
127 
128  $oModuleController->insertUpdatedLog($version_update_id);
129  }
130 
131  return new BaseObject(0, 'success_updated');
132  }
133 
137  function recompileCache()
138  {
139  }
140 }
141 /* End of file editor.class.php */
142 /* Location: ./modules/editor/editor.class.php */
recompileCache()
Re-generate the cache file.
$oModuleModel
Definition: ko.install.php:236
getController($module_name)
Definition: func.inc.php:90
moduleInstall()
Implement if additional tasks are necessary when installing.
const __XE_VERSION__
Definition: config.inc.php:32
checkUpdate()
a method to check if successfully installed
moduleUpdate()
Execute update.
getInstance($db_type=NULL)
Definition: DB.class.php:142
makeDir($path_string)
high class of the editor odule
Definition: editor.class.php:8
getModel($module_name)
Definition: func.inc.php:145
getAdminController($module_name)
Definition: func.inc.php:101
$oModuleController
Definition: ko.install.php:287