@@ -16,16 +16,16 @@ discard block |
||
| 16 | 16 | $oModuleController = getController('module'); |
| 17 | 17 | // Add the default editor component |
| 18 | 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); |
|
| 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 | 29 | // Create a directory to use in the editor module |
| 30 | 30 | FileHandler::makeDir('./files/cache/editor'); |
| 31 | 31 | // 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified |
@@ -48,26 +48,26 @@ discard block |
||
| 48 | 48 | $oModuleModel = getModel('module'); |
| 49 | 49 | $oModuleController = getController('module'); |
| 50 | 50 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 51 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 51 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 52 | 52 | { |
| 53 | 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; |
|
| 54 | + if (!$oDB->isColumnExists("editor_autosave", "module_srl")) return true; |
|
| 55 | + if (!$oDB->isIndexExists("editor_autosave", "idx_module_srl")) return true; |
|
| 56 | 56 | |
| 57 | 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; |
|
| 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 | 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; |
|
| 61 | + if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before')) return true; |
|
| 62 | 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; |
|
| 63 | + if (!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before')) return true; |
|
| 64 | 64 | // 2009. 06. 19 Remove unused trigger |
| 65 | - if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before')) return true; |
|
| 65 | + if ($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before')) return true; |
|
| 66 | 66 | |
| 67 | 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; |
|
| 68 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'editor', 'controller', 'triggerCopyModule', 'after')) return true; |
|
| 69 | 69 | |
| 70 | - if(!$oDB->isIndexExists('editor_autosave', 'certify_key')) return true; |
|
| 70 | + if (!$oDB->isIndexExists('editor_autosave', 'certify_key')) return true; |
|
| 71 | 71 | |
| 72 | 72 | $oModuleController->insertUpdatedLog($version_update_id); |
| 73 | 73 | } |
@@ -84,37 +84,37 @@ discard block |
||
| 84 | 84 | $oModuleModel = getModel('module'); |
| 85 | 85 | $oModuleController = getController('module'); |
| 86 | 86 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 87 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 87 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 88 | 88 | { |
| 89 | 89 | // Save module_srl when auto-saving 15/06/2009 |
| 90 | - if(!$oDB->isColumnExists("editor_autosave","module_srl")) |
|
| 91 | - $oDB->addColumn("editor_autosave","module_srl","number",11); |
|
| 90 | + if (!$oDB->isColumnExists("editor_autosave", "module_srl")) |
|
| 91 | + $oDB->addColumn("editor_autosave", "module_srl", "number", 11); |
|
| 92 | 92 | |
| 93 | 93 | // create an index on module_srl |
| 94 | - if(!$oDB->isIndexExists("editor_autosave","idx_module_srl")) $oDB->addIndex("editor_autosave","idx_module_srl", "module_srl"); |
|
| 94 | + if (!$oDB->isIndexExists("editor_autosave", "idx_module_srl")) $oDB->addIndex("editor_autosave", "idx_module_srl", "module_srl"); |
|
| 95 | 95 | |
| 96 | 96 | // 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified |
| 97 | - if(!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) |
|
| 97 | + if (!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) |
|
| 98 | 98 | $oModuleController->insertTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after'); |
| 99 | - if(!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) |
|
| 99 | + if (!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) |
|
| 100 | 100 | $oModuleController->insertTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after'); |
| 101 | 101 | // 2007. 10. Add an editor trigger on the module addition setup |
| 102 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before')) |
|
| 102 | + if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before')) |
|
| 103 | 103 | $oModuleController->insertTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before'); |
| 104 | 104 | // 2009. 04. 14 Add a trigger from compiled codes of the editor component |
| 105 | - if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before')) |
|
| 105 | + if (!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before')) |
|
| 106 | 106 | $oModuleController->insertTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before'); |
| 107 | 107 | // 2009. 06. 19 Remove unused trigger |
| 108 | - if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before')) |
|
| 108 | + if ($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before')) |
|
| 109 | 109 | $oModuleController->deleteTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before'); |
| 110 | 110 | |
| 111 | 111 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
| 112 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'editor', 'controller', 'triggerCopyModule', 'after')) |
|
| 112 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'editor', 'controller', 'triggerCopyModule', 'after')) |
|
| 113 | 113 | { |
| 114 | 114 | $oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'editor', 'controller', 'triggerCopyModule', 'after'); |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - if(!$oDB->isColumnExists('editor_autosave','certify_key')) |
|
| 117 | + if (!$oDB->isColumnExists('editor_autosave', 'certify_key')) |
|
| 118 | 118 | { |
| 119 | 119 | $oDB->addColumn('editor_autosave', 'certify_key', 'varchar', 100); |
| 120 | 120 | } |
@@ -51,23 +51,41 @@ discard block |
||
| 51 | 51 | if($oModuleModel->needUpdate($version_update_id)) |
| 52 | 52 | { |
| 53 | 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; |
|
| 54 | + if(!$oDB->isColumnExists("editor_autosave","module_srl")) { |
|
| 55 | + return true; |
|
| 56 | + } |
|
| 57 | + if(!$oDB->isIndexExists("editor_autosave","idx_module_srl")) { |
|
| 58 | + return true; |
|
| 59 | + } |
|
| 56 | 60 | |
| 57 | 61 | // 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; |
|
| 62 | + if(!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) { |
|
| 63 | + return true; |
|
| 64 | + } |
|
| 65 | + if(!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) { |
|
| 66 | + return true; |
|
| 67 | + } |
|
| 60 | 68 | // 2007. 10. 23 Add an editor trigger on the module addition setup |
| 61 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before')) return true; |
|
| 69 | + if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before')) { |
|
| 70 | + return true; |
|
| 71 | + } |
|
| 62 | 72 | // 2009. 04. 14 Add a trigger from compiled codes of the editor component |
| 63 | - if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before')) return true; |
|
| 73 | + if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before')) { |
|
| 74 | + return true; |
|
| 75 | + } |
|
| 64 | 76 | // 2009. 06. 19 Remove unused trigger |
| 65 | - if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before')) return true; |
|
| 77 | + if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before')) { |
|
| 78 | + return true; |
|
| 79 | + } |
|
| 66 | 80 | |
| 67 | 81 | // 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; |
|
| 82 | + if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'editor', 'controller', 'triggerCopyModule', 'after')) { |
|
| 83 | + return true; |
|
| 84 | + } |
|
| 69 | 85 | |
| 70 | - if(!$oDB->isIndexExists('editor_autosave', 'certify_key')) return true; |
|
| 86 | + if(!$oDB->isIndexExists('editor_autosave', 'certify_key')) { |
|
| 87 | + return true; |
|
| 88 | + } |
|
| 71 | 89 | |
| 72 | 90 | $oModuleController->insertUpdatedLog($version_update_id); |
| 73 | 91 | } |
@@ -87,26 +105,34 @@ discard block |
||
| 87 | 105 | if($oModuleModel->needUpdate($version_update_id)) |
| 88 | 106 | { |
| 89 | 107 | // Save module_srl when auto-saving 15/06/2009 |
| 90 | - if(!$oDB->isColumnExists("editor_autosave","module_srl")) |
|
| 91 | - $oDB->addColumn("editor_autosave","module_srl","number",11); |
|
| 108 | + if(!$oDB->isColumnExists("editor_autosave","module_srl")) { |
|
| 109 | + $oDB->addColumn("editor_autosave","module_srl","number",11); |
|
| 110 | + } |
|
| 92 | 111 | |
| 93 | 112 | // create an index on module_srl |
| 94 | - if(!$oDB->isIndexExists("editor_autosave","idx_module_srl")) $oDB->addIndex("editor_autosave","idx_module_srl", "module_srl"); |
|
| 113 | + if(!$oDB->isIndexExists("editor_autosave","idx_module_srl")) { |
|
| 114 | + $oDB->addIndex("editor_autosave","idx_module_srl", "module_srl"); |
|
| 115 | + } |
|
| 95 | 116 | |
| 96 | 117 | // 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified |
| 97 | - if(!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) |
|
| 98 | - $oModuleController->insertTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after'); |
|
| 99 | - if(!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) |
|
| 100 | - $oModuleController->insertTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after'); |
|
| 118 | + if(!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) { |
|
| 119 | + $oModuleController->insertTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after'); |
|
| 120 | + } |
|
| 121 | + if(!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) { |
|
| 122 | + $oModuleController->insertTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after'); |
|
| 123 | + } |
|
| 101 | 124 | // 2007. 10. Add an editor trigger on the module addition setup |
| 102 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before')) |
|
| 103 | - $oModuleController->insertTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before'); |
|
| 125 | + if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before')) { |
|
| 126 | + $oModuleController->insertTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before'); |
|
| 127 | + } |
|
| 104 | 128 | // 2009. 04. 14 Add a trigger from compiled codes of the editor component |
| 105 | - if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before')) |
|
| 106 | - $oModuleController->insertTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before'); |
|
| 129 | + if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before')) { |
|
| 130 | + $oModuleController->insertTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before'); |
|
| 131 | + } |
|
| 107 | 132 | // 2009. 06. 19 Remove unused trigger |
| 108 | - if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before')) |
|
| 109 | - $oModuleController->deleteTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before'); |
|
| 133 | + if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before')) { |
|
| 134 | + $oModuleController->deleteTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before'); |
|
| 135 | + } |
|
| 110 | 136 | |
| 111 | 137 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
| 112 | 138 | if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'editor', 'controller', 'triggerCopyModule', 'after')) |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | function getEditorConfig($module_srl = null) |
| 25 | 25 | { |
| 26 | - if(!$GLOBALS['__editor_module_config__'][$module_srl] && $module_srl) |
|
| 26 | + if (!$GLOBALS['__editor_module_config__'][$module_srl] && $module_srl) |
|
| 27 | 27 | { |
| 28 | 28 | // Get trackback settings of the selected module |
| 29 | 29 | $oModuleModel = getModel('module'); |
@@ -34,55 +34,55 @@ discard block |
||
| 34 | 34 | $oModuleModel = getModel('module'); |
| 35 | 35 | $editor_default_config = $oModuleModel->getModuleConfig('editor'); |
| 36 | 36 | |
| 37 | - if(!is_object($editor_config)) $editor_config = new stdClass(); |
|
| 37 | + if (!is_object($editor_config)) $editor_config = new stdClass(); |
|
| 38 | 38 | |
| 39 | - if($editor_config->enable_autosave != 'N') $editor_config->enable_autosave = 'Y'; |
|
| 40 | - if(!is_array($editor_config->enable_html_grant)) $editor_config->enable_html_grant = array(); |
|
| 41 | - if(!is_array($editor_config->enable_comment_html_grant)) $editor_config->enable_comment_html_grant = array(); |
|
| 42 | - if(!is_array($editor_config->upload_file_grant)) $editor_config->upload_file_grant = array(); |
|
| 43 | - if(!is_array($editor_config->comment_upload_file_grant)) $editor_config->comment_upload_file_grant = array(); |
|
| 44 | - if(!is_array($editor_config->enable_default_component_grant)) $editor_config->enable_default_component_grant = array(); |
|
| 45 | - if(!is_array($editor_config->enable_comment_default_component_grant)) $editor_config->enable_comment_default_component_grant = array(); |
|
| 46 | - if(!is_array($editor_config->enable_component_grant)) $editor_config->enable_component_grant = array(); |
|
| 47 | - if(!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant= array(); |
|
| 39 | + if ($editor_config->enable_autosave != 'N') $editor_config->enable_autosave = 'Y'; |
|
| 40 | + if (!is_array($editor_config->enable_html_grant)) $editor_config->enable_html_grant = array(); |
|
| 41 | + if (!is_array($editor_config->enable_comment_html_grant)) $editor_config->enable_comment_html_grant = array(); |
|
| 42 | + if (!is_array($editor_config->upload_file_grant)) $editor_config->upload_file_grant = array(); |
|
| 43 | + if (!is_array($editor_config->comment_upload_file_grant)) $editor_config->comment_upload_file_grant = array(); |
|
| 44 | + if (!is_array($editor_config->enable_default_component_grant)) $editor_config->enable_default_component_grant = array(); |
|
| 45 | + if (!is_array($editor_config->enable_comment_default_component_grant)) $editor_config->enable_comment_default_component_grant = array(); |
|
| 46 | + if (!is_array($editor_config->enable_component_grant)) $editor_config->enable_component_grant = array(); |
|
| 47 | + if (!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant = array(); |
|
| 48 | 48 | |
| 49 | - if(!$editor_config->editor_height) |
|
| 49 | + if (!$editor_config->editor_height) |
|
| 50 | 50 | { |
| 51 | 51 | $editor_config->editor_height = ($editor_default_config->editor_height) ? $editor_default_config->editor_height : 500; |
| 52 | 52 | } |
| 53 | - if(!$editor_config->comment_editor_height) |
|
| 53 | + if (!$editor_config->comment_editor_height) |
|
| 54 | 54 | { |
| 55 | 55 | $editor_config->comment_editor_height = ($editor_default_config->comment_editor_height) ? $editor_default_config->comment_editor_height : 120; |
| 56 | 56 | } |
| 57 | - if(!$editor_config->editor_skin) |
|
| 57 | + if (!$editor_config->editor_skin) |
|
| 58 | 58 | { |
| 59 | 59 | $editor_config->editor_skin = ($editor_default_config->editor_skin) ? $editor_default_config->editor_skin : 'ckeditor'; |
| 60 | 60 | } |
| 61 | - if(!$editor_config->comment_editor_skin) |
|
| 61 | + if (!$editor_config->comment_editor_skin) |
|
| 62 | 62 | { |
| 63 | 63 | $editor_config->comment_editor_skin = ($editor_default_config->comment_editor_skin) ? $editor_default_config->comment_editor_skin : 'ckeditor'; |
| 64 | 64 | } |
| 65 | - if(!$editor_config->content_style) |
|
| 65 | + if (!$editor_config->content_style) |
|
| 66 | 66 | { |
| 67 | 67 | $editor_config->content_style = ($editor_default_config->content_style) ? $editor_default_config->content_style : 'ckeditor_light'; |
| 68 | 68 | } |
| 69 | - if(!$editor_config->content_font && $editor_default_config->content_font) |
|
| 69 | + if (!$editor_config->content_font && $editor_default_config->content_font) |
|
| 70 | 70 | { |
| 71 | 71 | $editor_config->content_font = $editor_default_config->content_font; |
| 72 | 72 | } |
| 73 | - if(!$editor_config->content_font_size && $editor_default_config->content_font_size) |
|
| 73 | + if (!$editor_config->content_font_size && $editor_default_config->content_font_size) |
|
| 74 | 74 | { |
| 75 | 75 | $editor_config->content_font_size = $editor_default_config->content_font_size; |
| 76 | 76 | } |
| 77 | - if(!$editor_config->sel_editor_colorset && $editor_default_config->sel_editor_colorset) |
|
| 77 | + if (!$editor_config->sel_editor_colorset && $editor_default_config->sel_editor_colorset) |
|
| 78 | 78 | { |
| 79 | 79 | $editor_config->sel_editor_colorset = $editor_default_config->sel_editor_colorset; |
| 80 | 80 | } |
| 81 | - if(!$editor_config->sel_comment_editor_colorset && $editor_default_config->sel_comment_editor_colorset) |
|
| 81 | + if (!$editor_config->sel_comment_editor_colorset && $editor_default_config->sel_comment_editor_colorset) |
|
| 82 | 82 | { |
| 83 | 83 | $editor_config->sel_comment_editor_colorset = $editor_default_config->sel_comment_editor_colorset; |
| 84 | 84 | } |
| 85 | - if(!$editor_config->comment_content_style && $editor_default_config->comment_content_style) |
|
| 85 | + if (!$editor_config->comment_content_style && $editor_default_config->comment_content_style) |
|
| 86 | 86 | { |
| 87 | 87 | $editor_config->comment_content_style = $editor_default_config->comment_content_style; |
| 88 | 88 | } |
@@ -92,25 +92,25 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | function loadDrComponents() |
| 94 | 94 | { |
| 95 | - $drComponentPath = _XE_PATH_ . 'modules/editor/skins/dreditor/drcomponents/'; |
|
| 95 | + $drComponentPath = _XE_PATH_.'modules/editor/skins/dreditor/drcomponents/'; |
|
| 96 | 96 | $drComponentList = FileHandler::readDir($drComponentPath); |
| 97 | 97 | |
| 98 | 98 | $oTemplate = &TemplateHandler::getInstance(); |
| 99 | 99 | |
| 100 | 100 | $drComponentInfo = array(); |
| 101 | - if($drComponentList) |
|
| 101 | + if ($drComponentList) |
|
| 102 | 102 | { |
| 103 | - foreach($drComponentList as $i => $drComponent) |
|
| 103 | + foreach ($drComponentList as $i => $drComponent) |
|
| 104 | 104 | { |
| 105 | 105 | unset($obj); |
| 106 | 106 | $obj = $this->getDrComponentXmlInfo($drComponent); |
| 107 | - Context::loadLang(sprintf('%s%s/lang/',$drComponentPath,$drComponent)); |
|
| 108 | - $path = sprintf('%s%s/tpl/',$drComponentPath,$drComponent); |
|
| 109 | - $obj->html = $oTemplate->compile($path,$drComponent); |
|
| 107 | + Context::loadLang(sprintf('%s%s/lang/', $drComponentPath, $drComponent)); |
|
| 108 | + $path = sprintf('%s%s/tpl/', $drComponentPath, $drComponent); |
|
| 109 | + $obj->html = $oTemplate->compile($path, $drComponent); |
|
| 110 | 110 | $drComponentInfo[$drComponent] = $obj; |
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | - Context::set('drComponentList',$drComponentInfo); |
|
| 113 | + Context::set('drComponentList', $drComponentInfo); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | function getDrComponentXmlInfo($drComponentName) |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $xml_file = sprintf('%sinfo.xml', $component_path); |
| 123 | 123 | $cache_file = sprintf('./files/cache/editor/dr_%s.%s.php', $drComponentName, $lang_type); |
| 124 | 124 | // Return information after including it after cached xml file exists |
| 125 | - if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file)) |
|
| 125 | + if (file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file)) |
|
| 126 | 126 | { |
| 127 | 127 | include($cache_file); |
| 128 | 128 | return $xml_info; |
@@ -151,10 +151,10 @@ discard block |
||
| 151 | 151 | $buff .= sprintf('$xml_info->license_link = "%s";', $component_info->license_link); |
| 152 | 152 | |
| 153 | 153 | // Author information |
| 154 | - if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author; |
|
| 154 | + if (!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author; |
|
| 155 | 155 | else $author_list = $xml_doc->component->author; |
| 156 | 156 | |
| 157 | - for($i=0; $i < count($author_list); $i++) |
|
| 157 | + for ($i = 0; $i < count($author_list); $i++) |
|
| 158 | 158 | { |
| 159 | 159 | $buff .= sprintf('$xml_info->author['.$i.']->name = "%s";', $author_list[$i]->name->body); |
| 160 | 160 | $buff .= sprintf('$xml_info->author['.$i.']->email_address = "%s";', $author_list[$i]->attrs->email_address); |
@@ -163,10 +163,10 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | // List extra variables (text type only in the editor component) |
| 165 | 165 | $extra_vars = $xml_doc->component->extra_vars->var; |
| 166 | - if($extra_vars) |
|
| 166 | + if ($extra_vars) |
|
| 167 | 167 | { |
| 168 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
| 169 | - foreach($extra_vars as $key => $val) |
|
| 168 | + if (!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
| 169 | + foreach ($extra_vars as $key => $val) |
|
| 170 | 170 | { |
| 171 | 171 | unset($obj); |
| 172 | 172 | $key = $val->attrs->name; |
@@ -198,47 +198,47 @@ discard block |
||
| 198 | 198 | * Editor's default options |
| 199 | 199 | */ |
| 200 | 200 | // Option setting to allow file upload |
| 201 | - if($upload_target_srl) |
|
| 201 | + if ($upload_target_srl) |
|
| 202 | 202 | { |
| 203 | 203 | $option->editor_sequence = $upload_target_srl; |
| 204 | 204 | } |
| 205 | - if(!$option->allow_fileupload) $allow_fileupload = false; |
|
| 205 | + if (!$option->allow_fileupload) $allow_fileupload = false; |
|
| 206 | 206 | else $allow_fileupload = true; |
| 207 | 207 | // content_style setting |
| 208 | - if(!$option->content_style) $option->content_style = 'ckeditor_light'; |
|
| 208 | + if (!$option->content_style) $option->content_style = 'ckeditor_light'; |
|
| 209 | 209 | Context::set('content_style', $option->content_style); |
| 210 | - Context::set('content_style_path', getScriptPath() . ltrim($this->module_path, './') . 'styles/' . $option->content_style); |
|
| 210 | + Context::set('content_style_path', getScriptPath().ltrim($this->module_path, './').'styles/'.$option->content_style); |
|
| 211 | 211 | // Default font setting |
| 212 | 212 | Context::set('content_font', addslashes($option->content_font)); |
| 213 | 213 | Context::set('content_font_size', $option->content_font_size); |
| 214 | 214 | |
| 215 | 215 | // Option setting to allow auto-save |
| 216 | - if(!$option->enable_autosave) $enable_autosave = false; |
|
| 217 | - elseif(Context::get($option->primary_key_name)) $enable_autosave = false; |
|
| 216 | + if (!$option->enable_autosave) $enable_autosave = false; |
|
| 217 | + elseif (Context::get($option->primary_key_name)) $enable_autosave = false; |
|
| 218 | 218 | else $enable_autosave = true; |
| 219 | 219 | // Option setting to allow the default editor component |
| 220 | - if(!$option->enable_default_component) $enable_default_component = false; |
|
| 220 | + if (!$option->enable_default_component) $enable_default_component = false; |
|
| 221 | 221 | else $enable_default_component = true; |
| 222 | 222 | // Option setting to allow other extended components |
| 223 | - if(!$option->enable_component) $enable_component = false; |
|
| 223 | + if (!$option->enable_component) $enable_component = false; |
|
| 224 | 224 | else $enable_component = true; |
| 225 | 225 | // Setting for html-mode |
| 226 | - if($option->disable_html) $html_mode = false; |
|
| 226 | + if ($option->disable_html) $html_mode = false; |
|
| 227 | 227 | else $html_mode = true; |
| 228 | 228 | // Set Height |
| 229 | - if(!$option->height) $editor_height = 300; |
|
| 229 | + if (!$option->height) $editor_height = 300; |
|
| 230 | 230 | else $editor_height = $option->height; |
| 231 | 231 | // Skin Setting |
| 232 | 232 | $skin = $option->skin; |
| 233 | - if(!$skin) $skin = 'ckeditor'; |
|
| 233 | + if (!$skin) $skin = 'ckeditor'; |
|
| 234 | 234 | |
| 235 | 235 | $colorset = $option->colorset; |
| 236 | - if(!$colorset) $colorset = 'moono'; |
|
| 236 | + if (!$colorset) $colorset = 'moono'; |
|
| 237 | 237 | Context::set('colorset', $colorset); |
| 238 | 238 | Context::set('skin', $skin); |
| 239 | 239 | Context::set('module_type', $option->module_type); |
| 240 | 240 | |
| 241 | - if($skin=='dreditor') |
|
| 241 | + if ($skin == 'dreditor') |
|
| 242 | 242 | { |
| 243 | 243 | $this->loadDrComponents(); |
| 244 | 244 | } |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | /** |
| 247 | 247 | * Check the automatic backup feature (do not use if the post is edited) |
| 248 | 248 | */ |
| 249 | - if($enable_autosave) |
|
| 249 | + if ($enable_autosave) |
|
| 250 | 250 | { |
| 251 | 251 | // Extract auto-saved data |
| 252 | 252 | $saved_doc = $this->getSavedDoc($upload_target_srl); |
@@ -258,26 +258,26 @@ discard block |
||
| 258 | 258 | /** |
| 259 | 259 | * Extract editor's unique number (in order to display multiple editors on a single page) |
| 260 | 260 | */ |
| 261 | - if($option->editor_sequence) $editor_sequence = $option->editor_sequence; |
|
| 261 | + if ($option->editor_sequence) $editor_sequence = $option->editor_sequence; |
|
| 262 | 262 | else |
| 263 | 263 | { |
| 264 | - if(!$_SESSION['_editor_sequence_']) $_SESSION['_editor_sequence_'] = 1; |
|
| 265 | - $editor_sequence = $_SESSION['_editor_sequence_'] ++; |
|
| 264 | + if (!$_SESSION['_editor_sequence_']) $_SESSION['_editor_sequence_'] = 1; |
|
| 265 | + $editor_sequence = $_SESSION['_editor_sequence_']++; |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /** |
| 269 | 269 | * Upload setting by using configuration of the file module internally |
| 270 | 270 | */ |
| 271 | 271 | $files_count = 0; |
| 272 | - if($allow_fileupload) |
|
| 272 | + if ($allow_fileupload) |
|
| 273 | 273 | { |
| 274 | 274 | $oFileModel = getModel('file'); |
| 275 | 275 | // Get upload configuration to set on SWFUploader |
| 276 | 276 | $file_config = $oFileModel->getUploadConfig(); |
| 277 | - $file_config->allowed_attach_size = $file_config->allowed_attach_size*1024*1024; |
|
| 278 | - $file_config->allowed_filesize = $file_config->allowed_filesize*1024*1024; |
|
| 277 | + $file_config->allowed_attach_size = $file_config->allowed_attach_size * 1024 * 1024; |
|
| 278 | + $file_config->allowed_filesize = $file_config->allowed_filesize * 1024 * 1024; |
|
| 279 | 279 | |
| 280 | - Context::set('file_config',$file_config); |
|
| 280 | + Context::set('file_config', $file_config); |
|
| 281 | 281 | // Configure upload status such as file size |
| 282 | 282 | $upload_status = $oFileModel->getUploadStatus(); |
| 283 | 283 | Context::set('upload_status', $upload_status); |
@@ -285,9 +285,9 @@ discard block |
||
| 285 | 285 | $oFileController = getController('file'); |
| 286 | 286 | $oFileController->setUploadInfo($editor_sequence, $upload_target_srl); |
| 287 | 287 | // Check if the file already exists |
| 288 | - if($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl); |
|
| 288 | + if ($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl); |
|
| 289 | 289 | } |
| 290 | - Context::set('files_count', (int)$files_count); |
|
| 290 | + Context::set('files_count', (int) $files_count); |
|
| 291 | 291 | |
| 292 | 292 | Context::set('allow_fileupload', $allow_fileupload); |
| 293 | 293 | // Set editor_sequence value |
@@ -304,10 +304,10 @@ discard block |
||
| 304 | 304 | * Check editor component |
| 305 | 305 | */ |
| 306 | 306 | $site_module_info = Context::get('site_module_info'); |
| 307 | - $site_srl = (int)$site_module_info->site_srl; |
|
| 308 | - if($enable_component) |
|
| 307 | + $site_srl = (int) $site_module_info->site_srl; |
|
| 308 | + if ($enable_component) |
|
| 309 | 309 | { |
| 310 | - if(!Context::get('component_list')) |
|
| 310 | + if (!Context::get('component_list')) |
|
| 311 | 311 | { |
| 312 | 312 | $component_list = $this->getComponentList(true, $site_srl); |
| 313 | 313 | Context::set('component_list', $component_list); |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | $tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin); |
| 335 | 335 | $tpl_file = 'editor.html'; |
| 336 | 336 | |
| 337 | - if(!file_exists($tpl_path.$tpl_file)) |
|
| 337 | + if (!file_exists($tpl_path.$tpl_file)) |
|
| 338 | 338 | { |
| 339 | 339 | $skin = 'ckeditor'; |
| 340 | 340 | $tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin); |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | $config->module_type = $type; |
| 365 | 365 | |
| 366 | 366 | // Configurations listed according to a type |
| 367 | - if($type == 'document') |
|
| 367 | + if ($type == 'document') |
|
| 368 | 368 | { |
| 369 | 369 | $config->editor_skin = $editor_config->editor_skin; |
| 370 | 370 | $config->content_style = $editor_config->content_style; |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | $config->enable_autosave = 'N'; |
| 394 | 394 | } |
| 395 | 395 | // Check a group_list of the currently logged-in user for permission check |
| 396 | - if(Context::get('is_logged')) |
|
| 396 | + if (Context::get('is_logged')) |
|
| 397 | 397 | { |
| 398 | 398 | $logged_info = Context::get('logged_info'); |
| 399 | 399 | $group_list = $logged_info->group_list; |
@@ -412,12 +412,12 @@ discard block |
||
| 412 | 412 | $option->colorset = $config->sel_editor_colorset; |
| 413 | 413 | // Permission check for file upload |
| 414 | 414 | $option->allow_fileupload = false; |
| 415 | - if($logged_info->is_admin=='Y') $option->allow_fileupload = true; |
|
| 416 | - elseif(count($config->upload_file_grant)) |
|
| 415 | + if ($logged_info->is_admin == 'Y') $option->allow_fileupload = true; |
|
| 416 | + elseif (count($config->upload_file_grant)) |
|
| 417 | 417 | { |
| 418 | - foreach($group_list as $group_srl => $group_info) |
|
| 418 | + foreach ($group_list as $group_srl => $group_info) |
|
| 419 | 419 | { |
| 420 | - if(in_array($group_srl, $config->upload_file_grant)) |
|
| 420 | + if (in_array($group_srl, $config->upload_file_grant)) |
|
| 421 | 421 | { |
| 422 | 422 | $option->allow_fileupload = true; |
| 423 | 423 | break; |
@@ -427,12 +427,12 @@ discard block |
||
| 427 | 427 | else $option->allow_fileupload = true; |
| 428 | 428 | // Permission check for using default components |
| 429 | 429 | $option->enable_default_component = false; |
| 430 | - if($logged_info->is_admin=='Y') $option->enable_default_component = true; |
|
| 431 | - elseif(count($config->enable_default_component_grant)) |
|
| 430 | + if ($logged_info->is_admin == 'Y') $option->enable_default_component = true; |
|
| 431 | + elseif (count($config->enable_default_component_grant)) |
|
| 432 | 432 | { |
| 433 | - foreach($group_list as $group_srl => $group_info) |
|
| 433 | + foreach ($group_list as $group_srl => $group_info) |
|
| 434 | 434 | { |
| 435 | - if(in_array($group_srl, $config->enable_default_component_grant)) |
|
| 435 | + if (in_array($group_srl, $config->enable_default_component_grant)) |
|
| 436 | 436 | { |
| 437 | 437 | $option->enable_default_component = true; |
| 438 | 438 | break; |
@@ -442,12 +442,12 @@ discard block |
||
| 442 | 442 | else $option->enable_default_component = true; |
| 443 | 443 | // Permisshion check for using extended components |
| 444 | 444 | $option->enable_component = false; |
| 445 | - if($logged_info->is_admin=='Y') $option->enable_component = true; |
|
| 446 | - elseif(count($config->enable_component_grant)) |
|
| 445 | + if ($logged_info->is_admin == 'Y') $option->enable_component = true; |
|
| 446 | + elseif (count($config->enable_component_grant)) |
|
| 447 | 447 | { |
| 448 | - foreach($group_list as $group_srl => $group_info) |
|
| 448 | + foreach ($group_list as $group_srl => $group_info) |
|
| 449 | 449 | { |
| 450 | - if(in_array($group_srl, $config->enable_component_grant)) |
|
| 450 | + if (in_array($group_srl, $config->enable_component_grant)) |
|
| 451 | 451 | { |
| 452 | 452 | $option->enable_component = true; |
| 453 | 453 | break; |
@@ -457,12 +457,12 @@ discard block |
||
| 457 | 457 | else $option->enable_component = true; |
| 458 | 458 | // HTML editing privileges |
| 459 | 459 | $enable_html = false; |
| 460 | - if($logged_info->is_admin=='Y') $enable_html = true; |
|
| 461 | - elseif(count($config->enable_html_grant)) |
|
| 460 | + if ($logged_info->is_admin == 'Y') $enable_html = true; |
|
| 461 | + elseif (count($config->enable_html_grant)) |
|
| 462 | 462 | { |
| 463 | - foreach($group_list as $group_srl => $group_info) |
|
| 463 | + foreach ($group_list as $group_srl => $group_info) |
|
| 464 | 464 | { |
| 465 | - if(in_array($group_srl, $config->enable_html_grant)) |
|
| 465 | + if (in_array($group_srl, $config->enable_html_grant)) |
|
| 466 | 466 | { |
| 467 | 467 | $enable_html = true; |
| 468 | 468 | break; |
@@ -471,12 +471,12 @@ discard block |
||
| 471 | 471 | } |
| 472 | 472 | else $enable_html = true; |
| 473 | 473 | |
| 474 | - if($enable_html) $option->disable_html = false; |
|
| 474 | + if ($enable_html) $option->disable_html = false; |
|
| 475 | 475 | else $option->disable_html = true; |
| 476 | 476 | // Set Height |
| 477 | 477 | $option->height = $config->editor_height; |
| 478 | 478 | // Set an option for Auto-save |
| 479 | - $option->enable_autosave = $config->enable_autosave=='Y'?true:false; |
|
| 479 | + $option->enable_autosave = $config->enable_autosave == 'Y' ?true:false; |
|
| 480 | 480 | // Other settings |
| 481 | 481 | $option->primary_key_name = $primary_key_name; |
| 482 | 482 | $option->content_key_name = $content_key_name; |
@@ -492,42 +492,42 @@ discard block |
||
| 492 | 492 | $auto_save_args = new stdClass(); |
| 493 | 493 | $auto_save_args->module_srl = Context::get('module_srl'); |
| 494 | 494 | // Get the current module if module_srl doesn't exist |
| 495 | - if(!$auto_save_args->module_srl) |
|
| 495 | + if (!$auto_save_args->module_srl) |
|
| 496 | 496 | { |
| 497 | 497 | $current_module_info = Context::get('current_module_info'); |
| 498 | 498 | $auto_save_args->module_srl = $current_module_info->module_srl; |
| 499 | 499 | } |
| 500 | 500 | // Find a document by using member_srl for logged-in user and ipaddress for non-logged user |
| 501 | - if(Context::get('is_logged')) |
|
| 501 | + if (Context::get('is_logged')) |
|
| 502 | 502 | { |
| 503 | 503 | $logged_info = Context::get('logged_info'); |
| 504 | 504 | $auto_save_args->member_srl = $logged_info->member_srl; |
| 505 | 505 | } |
| 506 | 506 | else |
| 507 | 507 | { |
| 508 | - $auto_save_args->certify_key = $_COOKIE['autosave_certify_key_' . $auto_save_args->module_srl]; |
|
| 508 | + $auto_save_args->certify_key = $_COOKIE['autosave_certify_key_'.$auto_save_args->module_srl]; |
|
| 509 | 509 | // @see https://github.com/xpressengine/xe-core/issues/2208 |
| 510 | 510 | // 변경 이전에 작성된 게시물 호환성 유지 |
| 511 | - if(!$auto_save_args->certify_key) $auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR']; |
|
| 511 | + if (!$auto_save_args->certify_key) $auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR']; |
|
| 512 | 512 | } |
| 513 | 513 | // Extract auto-saved data from the DB |
| 514 | 514 | $output = executeQuery('editor.getSavedDocument', $auto_save_args); |
| 515 | 515 | $saved_doc = $output->data; |
| 516 | 516 | // Return null if no result is auto-saved |
| 517 | - if(!$saved_doc) return; |
|
| 517 | + if (!$saved_doc) return; |
|
| 518 | 518 | // Check if the auto-saved document already exists |
| 519 | 519 | $oDocumentModel = getModel('document'); |
| 520 | 520 | $oSaved = $oDocumentModel->getDocument($saved_doc->document_srl); |
| 521 | - if($oSaved->isExists()) return; |
|
| 521 | + if ($oSaved->isExists()) return; |
|
| 522 | 522 | // Move all the files if the auto-saved data contains document_srl and file |
| 523 | 523 | // Then set document_srl to editor_sequence |
| 524 | - if($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl')) |
|
| 524 | + if ($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl')) |
|
| 525 | 525 | { |
| 526 | 526 | $saved_doc->module_srl = $auto_save_args->module_srl; |
| 527 | 527 | $oFileController = getController('file'); |
| 528 | 528 | $oFileController->moveFile($saved_doc->document_srl, $saved_doc->module_srl, $upload_target_srl); |
| 529 | 529 | } |
| 530 | - else if($upload_target_srl) $saved_doc->document_srl = $upload_target_srl; |
|
| 530 | + else if ($upload_target_srl) $saved_doc->document_srl = $upload_target_srl; |
|
| 531 | 531 | // Change auto-saved data |
| 532 | 532 | $saved_doc->certify_key = $auto_save_args->certify_key; |
| 533 | 533 | $oEditorController = getController('editor'); |
@@ -544,18 +544,18 @@ discard block |
||
| 544 | 544 | */ |
| 545 | 545 | function getComponentObject($component, $editor_sequence = 0, $site_srl = 0) |
| 546 | 546 | { |
| 547 | - if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) return; |
|
| 547 | + if (!preg_match('/^[a-zA-Z0-9_-]+$/', $component) || !preg_match('/^[0-9]+$/', $editor_sequence.$site_srl)) return; |
|
| 548 | 548 | |
| 549 | - if(!$this->loaded_component_list[$component][$editor_sequence]) |
|
| 549 | + if (!$this->loaded_component_list[$component][$editor_sequence]) |
|
| 550 | 550 | { |
| 551 | 551 | // Create an object of the component and execute |
| 552 | 552 | $class_path = sprintf('%scomponents/%s/', $this->module_path, $component); |
| 553 | 553 | $class_file = sprintf('%s%s.class.php', $class_path, $component); |
| 554 | - if(!file_exists($class_file)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 554 | + if (!file_exists($class_file)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 555 | 555 | // Create an object after loading the class file |
| 556 | 556 | require_once($class_file); |
| 557 | 557 | $oComponent = new $component($editor_sequence, $class_path); |
| 558 | - if(!$oComponent) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 558 | + if (!$oComponent) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 559 | 559 | // Add configuration information |
| 560 | 560 | $component_info = $this->getComponent($component, $site_srl); |
| 561 | 561 | $oComponent->setInfo($component_info); |
@@ -576,14 +576,14 @@ discard block |
||
| 576 | 576 | /** |
| 577 | 577 | * @brief Return the cache file name of editor component list |
| 578 | 578 | */ |
| 579 | - function getCacheFile($filter_enabled= true, $site_srl = 0) |
|
| 579 | + function getCacheFile($filter_enabled = true, $site_srl = 0) |
|
| 580 | 580 | { |
| 581 | 581 | $lang = Context::getLangType(); |
| 582 | 582 | $cache_path = _XE_PATH_.'files/cache/editor/cache/'; |
| 583 | 583 | FileHandler::makeDir($cache_path); |
| 584 | - $cache_file = $cache_path.'component_list.' . $lang .'.'; |
|
| 585 | - if($filter_enabled) $cache_file .= 'filter.'; |
|
| 586 | - if($site_srl) $cache_file .= $site_srl.'.'; |
|
| 584 | + $cache_file = $cache_path.'component_list.'.$lang.'.'; |
|
| 585 | + if ($filter_enabled) $cache_file .= 'filter.'; |
|
| 586 | + if ($site_srl) $cache_file .= $site_srl.'.'; |
|
| 587 | 587 | $cache_file .= 'php'; |
| 588 | 588 | return $cache_file; |
| 589 | 589 | } |
@@ -591,19 +591,19 @@ discard block |
||
| 591 | 591 | /** |
| 592 | 592 | * @brief Return a component list (DB Information included) |
| 593 | 593 | */ |
| 594 | - function getComponentList($filter_enabled = true, $site_srl=0, $from_db=false) |
|
| 594 | + function getComponentList($filter_enabled = true, $site_srl = 0, $from_db = false) |
|
| 595 | 595 | { |
| 596 | 596 | $cache_file = $this->getCacheFile(false, $site_srl); |
| 597 | - if($from_db || !file_exists($cache_file)) |
|
| 597 | + if ($from_db || !file_exists($cache_file)) |
|
| 598 | 598 | { |
| 599 | 599 | $oEditorController = getController('editor'); |
| 600 | 600 | $oEditorController->makeCache(false, $site_srl); |
| 601 | 601 | } |
| 602 | 602 | |
| 603 | - if(!file_exists($cache_file)) return; |
|
| 603 | + if (!file_exists($cache_file)) return; |
|
| 604 | 604 | include($cache_file); |
| 605 | 605 | $logged_info = Context::get('logged_info'); |
| 606 | - if($logged_info && is_array($logged_info->group_list)) |
|
| 606 | + if ($logged_info && is_array($logged_info->group_list)) |
|
| 607 | 607 | { |
| 608 | 608 | $group_list = array_keys($logged_info->group_list); |
| 609 | 609 | } |
@@ -612,45 +612,45 @@ discard block |
||
| 612 | 612 | $group_list = array(); |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | - if(count($component_list)) |
|
| 615 | + if (count($component_list)) |
|
| 616 | 616 | { |
| 617 | - foreach($component_list as $key => $val) |
|
| 617 | + foreach ($component_list as $key => $val) |
|
| 618 | 618 | { |
| 619 | - if(!trim($key)) continue; |
|
| 620 | - if(!is_dir(_XE_PATH_.'modules/editor/components/'.$key)) |
|
| 619 | + if (!trim($key)) continue; |
|
| 620 | + if (!is_dir(_XE_PATH_.'modules/editor/components/'.$key)) |
|
| 621 | 621 | { |
| 622 | 622 | FileHandler::removeFile($cache_file); |
| 623 | 623 | return $this->getComponentList($filter_enabled, $site_srl); |
| 624 | 624 | } |
| 625 | - if(!$filter_enabled) continue; |
|
| 626 | - if($val->enabled == "N") |
|
| 625 | + if (!$filter_enabled) continue; |
|
| 626 | + if ($val->enabled == "N") |
|
| 627 | 627 | { |
| 628 | 628 | unset($component_list->{$key}); |
| 629 | 629 | continue; |
| 630 | 630 | } |
| 631 | - if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue; |
|
| 632 | - if($val->target_group) |
|
| 631 | + if ($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue; |
|
| 632 | + if ($val->target_group) |
|
| 633 | 633 | { |
| 634 | - if(!$logged_info) |
|
| 634 | + if (!$logged_info) |
|
| 635 | 635 | { |
| 636 | 636 | $val->enabled = "N"; |
| 637 | 637 | } |
| 638 | 638 | else |
| 639 | 639 | { |
| 640 | 640 | $is_granted = false; |
| 641 | - foreach($group_list as $group_srl) |
|
| 641 | + foreach ($group_list as $group_srl) |
|
| 642 | 642 | { |
| 643 | - if(in_array($group_srl, $val->target_group)) $is_granted = true; |
|
| 643 | + if (in_array($group_srl, $val->target_group)) $is_granted = true; |
|
| 644 | 644 | } |
| 645 | - if(!$is_granted) $val->enabled = "N"; |
|
| 645 | + if (!$is_granted) $val->enabled = "N"; |
|
| 646 | 646 | } |
| 647 | 647 | } |
| 648 | - if($val->enabled != "N" && $val->mid_list) |
|
| 648 | + if ($val->enabled != "N" && $val->mid_list) |
|
| 649 | 649 | { |
| 650 | 650 | $mid = Context::get('mid'); |
| 651 | - if(!in_array($mid, $val->mid_list)) $val->enabled = "N"; |
|
| 651 | + if (!in_array($mid, $val->mid_list)) $val->enabled = "N"; |
|
| 652 | 652 | } |
| 653 | - if($val->enabled == "N") |
|
| 653 | + if ($val->enabled == "N") |
|
| 654 | 654 | { |
| 655 | 655 | unset($component_list->{$key}); |
| 656 | 656 | continue; |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | $args = new stdClass(); |
| 669 | 669 | $args->component_name = $component_name; |
| 670 | 670 | |
| 671 | - if($site_srl) |
|
| 671 | + if ($site_srl) |
|
| 672 | 672 | { |
| 673 | 673 | $args->site_srl = $site_srl; |
| 674 | 674 | $output = executeQuery('editor.getSiteComponent', $args); |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | } |
| 680 | 680 | $component = $output->data; |
| 681 | 681 | |
| 682 | - if(!$output->data) return false; |
|
| 682 | + if (!$output->data) return false; |
|
| 683 | 683 | |
| 684 | 684 | $component_name = $component->component_name; |
| 685 | 685 | |
@@ -691,25 +691,25 @@ discard block |
||
| 691 | 691 | |
| 692 | 692 | $xml_info->mid_list = array(); |
| 693 | 693 | |
| 694 | - if($component->extra_vars) |
|
| 694 | + if ($component->extra_vars) |
|
| 695 | 695 | { |
| 696 | 696 | $extra_vars = unserialize($component->extra_vars); |
| 697 | 697 | |
| 698 | - if($extra_vars->target_group) |
|
| 698 | + if ($extra_vars->target_group) |
|
| 699 | 699 | { |
| 700 | 700 | $xml_info->target_group = $extra_vars->target_group; |
| 701 | 701 | unset($extra_vars->target_group); |
| 702 | 702 | } |
| 703 | 703 | |
| 704 | - if($extra_vars->mid_list) |
|
| 704 | + if ($extra_vars->mid_list) |
|
| 705 | 705 | { |
| 706 | 706 | $xml_info->mid_list = $extra_vars->mid_list; |
| 707 | 707 | unset($extra_vars->mid_list); |
| 708 | 708 | } |
| 709 | 709 | |
| 710 | - if($xml_info->extra_vars) |
|
| 710 | + if ($xml_info->extra_vars) |
|
| 711 | 711 | { |
| 712 | - foreach($xml_info->extra_vars as $key => $val) |
|
| 712 | + foreach ($xml_info->extra_vars as $key => $val) |
|
| 713 | 713 | { |
| 714 | 714 | $xml_info->extra_vars->{$key}->value = $extra_vars->{$key}; |
| 715 | 715 | } |
@@ -733,7 +733,7 @@ discard block |
||
| 733 | 733 | $cache_file = sprintf('./files/cache/editor/%s.%s.php', $component, $lang_type); |
| 734 | 734 | |
| 735 | 735 | // Include and return xml file information if cached file exists |
| 736 | - if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file)) |
|
| 736 | + if (file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file)) |
|
| 737 | 737 | { |
| 738 | 738 | include($cache_file); |
| 739 | 739 | |
@@ -750,7 +750,7 @@ discard block |
||
| 750 | 750 | $component_info->component_name = $component; |
| 751 | 751 | $component_info->title = $xml_doc->component->title->body; |
| 752 | 752 | |
| 753 | - if($xml_doc->component->version) |
|
| 753 | + if ($xml_doc->component->version) |
|
| 754 | 754 | { |
| 755 | 755 | $component_info->description = str_replace('\n', "\n", $xml_doc->component->description->body); |
| 756 | 756 | $component_info->version = $xml_doc->component->version->body; |
@@ -776,10 +776,10 @@ discard block |
||
| 776 | 776 | |
| 777 | 777 | // Author information |
| 778 | 778 | $author_list = array(); |
| 779 | - if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author; |
|
| 779 | + if (!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author; |
|
| 780 | 780 | else $author_list = $xml_doc->component->author; |
| 781 | 781 | |
| 782 | - for($i = 0; $i < count($author_list); $i++) |
|
| 782 | + for ($i = 0; $i < count($author_list); $i++) |
|
| 783 | 783 | { |
| 784 | 784 | $author = new stdClass; |
| 785 | 785 | $author->name = $author_list[$i]->name->body; |
@@ -790,39 +790,39 @@ discard block |
||
| 790 | 790 | |
| 791 | 791 | // List extra variables (text type only for editor component) |
| 792 | 792 | $extra_vars = $xml_doc->component->extra_vars; |
| 793 | - if($extra_vars) |
|
| 793 | + if ($extra_vars) |
|
| 794 | 794 | { |
| 795 | 795 | $extra_var_groups = $extra_vars->group; |
| 796 | - if(!$extra_var_groups) |
|
| 796 | + if (!$extra_var_groups) |
|
| 797 | 797 | { |
| 798 | 798 | $extra_var_groups = $extra_vars; |
| 799 | 799 | } |
| 800 | - if(!is_array($extra_var_groups)) |
|
| 800 | + if (!is_array($extra_var_groups)) |
|
| 801 | 801 | { |
| 802 | 802 | $extra_var_groups = array($extra_var_groups); |
| 803 | 803 | } |
| 804 | 804 | |
| 805 | - foreach($extra_var_groups as $group) |
|
| 805 | + foreach ($extra_var_groups as $group) |
|
| 806 | 806 | { |
| 807 | 807 | $extra_vars = $group->var; |
| 808 | - if(!is_array($group->var)) |
|
| 808 | + if (!is_array($group->var)) |
|
| 809 | 809 | { |
| 810 | 810 | $extra_vars = array($group->var); |
| 811 | 811 | } |
| 812 | 812 | |
| 813 | - foreach($extra_vars as $key => $val) |
|
| 813 | + foreach ($extra_vars as $key => $val) |
|
| 814 | 814 | { |
| 815 | - if(!$val) |
|
| 815 | + if (!$val) |
|
| 816 | 816 | { |
| 817 | 817 | continue; |
| 818 | 818 | } |
| 819 | 819 | |
| 820 | 820 | $obj = new stdClass(); |
| 821 | - if(!$val->attrs) |
|
| 821 | + if (!$val->attrs) |
|
| 822 | 822 | { |
| 823 | 823 | $val->attrs = new stdClass(); |
| 824 | 824 | } |
| 825 | - if(!$val->attrs->type) |
|
| 825 | + if (!$val->attrs->type) |
|
| 826 | 826 | { |
| 827 | 827 | $val->attrs->type = 'text'; |
| 828 | 828 | } |
@@ -832,26 +832,26 @@ discard block |
||
| 832 | 832 | $obj->title = $val->title->body; |
| 833 | 833 | $obj->type = $val->attrs->type; |
| 834 | 834 | $obj->description = $val->description->body; |
| 835 | - if($obj->name) |
|
| 835 | + if ($obj->name) |
|
| 836 | 836 | { |
| 837 | 837 | $obj->value = $extra_vals->{$obj->name}; |
| 838 | 838 | } |
| 839 | - if(strpos($obj->value, '|@|') != FALSE) |
|
| 839 | + if (strpos($obj->value, '|@|') != FALSE) |
|
| 840 | 840 | { |
| 841 | 841 | $obj->value = explode('|@|', $obj->value); |
| 842 | 842 | } |
| 843 | - if($obj->type == 'mid_list' && !is_array($obj->value)) |
|
| 843 | + if ($obj->type == 'mid_list' && !is_array($obj->value)) |
|
| 844 | 844 | { |
| 845 | 845 | $obj->value = array($obj->value); |
| 846 | 846 | } |
| 847 | 847 | |
| 848 | 848 | // 'Select'type obtained from the option list. |
| 849 | - if($val->options && !is_array($val->options)) |
|
| 849 | + if ($val->options && !is_array($val->options)) |
|
| 850 | 850 | { |
| 851 | 851 | $val->options = array($val->options); |
| 852 | 852 | } |
| 853 | 853 | |
| 854 | - for($i = 0, $c = count($val->options); $i < $c; $i++) |
|
| 854 | + for ($i = 0, $c = count($val->options); $i < $c; $i++) |
|
| 855 | 855 | { |
| 856 | 856 | $obj->options[$i] = new stdClass(); |
| 857 | 857 | $obj->options[$i]->title = $val->options[$i]->title->body; |
@@ -865,7 +865,7 @@ discard block |
||
| 865 | 865 | |
| 866 | 866 | $buff = array(); |
| 867 | 867 | $buff[] = '<?php if(!defined(\'__XE__\')) exit();'; |
| 868 | - $buff[] = '$xml_info = ' . var_export($component_info, TRUE) . ';'; |
|
| 868 | + $buff[] = '$xml_info = '.var_export($component_info, TRUE).';'; |
|
| 869 | 869 | $buff = str_replace('stdClass::__set_state', '(object)', implode(PHP_EOL, $buff)); |
| 870 | 870 | |
| 871 | 871 | FileHandler::writeFile($cache_file, $buff, 'w'); |
@@ -34,17 +34,37 @@ discard block |
||
| 34 | 34 | $oModuleModel = getModel('module'); |
| 35 | 35 | $editor_default_config = $oModuleModel->getModuleConfig('editor'); |
| 36 | 36 | |
| 37 | - if(!is_object($editor_config)) $editor_config = new stdClass(); |
|
| 38 | - |
|
| 39 | - if($editor_config->enable_autosave != 'N') $editor_config->enable_autosave = 'Y'; |
|
| 40 | - if(!is_array($editor_config->enable_html_grant)) $editor_config->enable_html_grant = array(); |
|
| 41 | - if(!is_array($editor_config->enable_comment_html_grant)) $editor_config->enable_comment_html_grant = array(); |
|
| 42 | - if(!is_array($editor_config->upload_file_grant)) $editor_config->upload_file_grant = array(); |
|
| 43 | - if(!is_array($editor_config->comment_upload_file_grant)) $editor_config->comment_upload_file_grant = array(); |
|
| 44 | - if(!is_array($editor_config->enable_default_component_grant)) $editor_config->enable_default_component_grant = array(); |
|
| 45 | - if(!is_array($editor_config->enable_comment_default_component_grant)) $editor_config->enable_comment_default_component_grant = array(); |
|
| 46 | - if(!is_array($editor_config->enable_component_grant)) $editor_config->enable_component_grant = array(); |
|
| 47 | - if(!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant= array(); |
|
| 37 | + if(!is_object($editor_config)) { |
|
| 38 | + $editor_config = new stdClass(); |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + if($editor_config->enable_autosave != 'N') { |
|
| 42 | + $editor_config->enable_autosave = 'Y'; |
|
| 43 | + } |
|
| 44 | + if(!is_array($editor_config->enable_html_grant)) { |
|
| 45 | + $editor_config->enable_html_grant = array(); |
|
| 46 | + } |
|
| 47 | + if(!is_array($editor_config->enable_comment_html_grant)) { |
|
| 48 | + $editor_config->enable_comment_html_grant = array(); |
|
| 49 | + } |
|
| 50 | + if(!is_array($editor_config->upload_file_grant)) { |
|
| 51 | + $editor_config->upload_file_grant = array(); |
|
| 52 | + } |
|
| 53 | + if(!is_array($editor_config->comment_upload_file_grant)) { |
|
| 54 | + $editor_config->comment_upload_file_grant = array(); |
|
| 55 | + } |
|
| 56 | + if(!is_array($editor_config->enable_default_component_grant)) { |
|
| 57 | + $editor_config->enable_default_component_grant = array(); |
|
| 58 | + } |
|
| 59 | + if(!is_array($editor_config->enable_comment_default_component_grant)) { |
|
| 60 | + $editor_config->enable_comment_default_component_grant = array(); |
|
| 61 | + } |
|
| 62 | + if(!is_array($editor_config->enable_component_grant)) { |
|
| 63 | + $editor_config->enable_component_grant = array(); |
|
| 64 | + } |
|
| 65 | + if(!is_array($editor_config->enable_comment_component_grant)) { |
|
| 66 | + $editor_config->enable_comment_component_grant= array(); |
|
| 67 | + } |
|
| 48 | 68 | |
| 49 | 69 | if(!$editor_config->editor_height) |
| 50 | 70 | { |
@@ -151,8 +171,11 @@ discard block |
||
| 151 | 171 | $buff .= sprintf('$xml_info->license_link = "%s";', $component_info->license_link); |
| 152 | 172 | |
| 153 | 173 | // Author information |
| 154 | - if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author; |
|
| 155 | - else $author_list = $xml_doc->component->author; |
|
| 174 | + if(!is_array($xml_doc->component->author)) { |
|
| 175 | + $author_list[] = $xml_doc->component->author; |
|
| 176 | + } else { |
|
| 177 | + $author_list = $xml_doc->component->author; |
|
| 178 | + } |
|
| 156 | 179 | |
| 157 | 180 | for($i=0; $i < count($author_list); $i++) |
| 158 | 181 | { |
@@ -165,7 +188,9 @@ discard block |
||
| 165 | 188 | $extra_vars = $xml_doc->component->extra_vars->var; |
| 166 | 189 | if($extra_vars) |
| 167 | 190 | { |
| 168 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
| 191 | + if(!is_array($extra_vars)) { |
|
| 192 | + $extra_vars = array($extra_vars); |
|
| 193 | + } |
|
| 169 | 194 | foreach($extra_vars as $key => $val) |
| 170 | 195 | { |
| 171 | 196 | unset($obj); |
@@ -202,10 +227,15 @@ discard block |
||
| 202 | 227 | { |
| 203 | 228 | $option->editor_sequence = $upload_target_srl; |
| 204 | 229 | } |
| 205 | - if(!$option->allow_fileupload) $allow_fileupload = false; |
|
| 206 | - else $allow_fileupload = true; |
|
| 230 | + if(!$option->allow_fileupload) { |
|
| 231 | + $allow_fileupload = false; |
|
| 232 | + } else { |
|
| 233 | + $allow_fileupload = true; |
|
| 234 | + } |
|
| 207 | 235 | // content_style setting |
| 208 | - if(!$option->content_style) $option->content_style = 'ckeditor_light'; |
|
| 236 | + if(!$option->content_style) { |
|
| 237 | + $option->content_style = 'ckeditor_light'; |
|
| 238 | + } |
|
| 209 | 239 | Context::set('content_style', $option->content_style); |
| 210 | 240 | Context::set('content_style_path', getScriptPath() . ltrim($this->module_path, './') . 'styles/' . $option->content_style); |
| 211 | 241 | // Default font setting |
@@ -213,27 +243,47 @@ discard block |
||
| 213 | 243 | Context::set('content_font_size', $option->content_font_size); |
| 214 | 244 | |
| 215 | 245 | // Option setting to allow auto-save |
| 216 | - if(!$option->enable_autosave) $enable_autosave = false; |
|
| 217 | - elseif(Context::get($option->primary_key_name)) $enable_autosave = false; |
|
| 218 | - else $enable_autosave = true; |
|
| 246 | + if(!$option->enable_autosave) { |
|
| 247 | + $enable_autosave = false; |
|
| 248 | + } elseif(Context::get($option->primary_key_name)) { |
|
| 249 | + $enable_autosave = false; |
|
| 250 | + } else { |
|
| 251 | + $enable_autosave = true; |
|
| 252 | + } |
|
| 219 | 253 | // Option setting to allow the default editor component |
| 220 | - if(!$option->enable_default_component) $enable_default_component = false; |
|
| 221 | - else $enable_default_component = true; |
|
| 254 | + if(!$option->enable_default_component) { |
|
| 255 | + $enable_default_component = false; |
|
| 256 | + } else { |
|
| 257 | + $enable_default_component = true; |
|
| 258 | + } |
|
| 222 | 259 | // Option setting to allow other extended components |
| 223 | - if(!$option->enable_component) $enable_component = false; |
|
| 224 | - else $enable_component = true; |
|
| 260 | + if(!$option->enable_component) { |
|
| 261 | + $enable_component = false; |
|
| 262 | + } else { |
|
| 263 | + $enable_component = true; |
|
| 264 | + } |
|
| 225 | 265 | // Setting for html-mode |
| 226 | - if($option->disable_html) $html_mode = false; |
|
| 227 | - else $html_mode = true; |
|
| 266 | + if($option->disable_html) { |
|
| 267 | + $html_mode = false; |
|
| 268 | + } else { |
|
| 269 | + $html_mode = true; |
|
| 270 | + } |
|
| 228 | 271 | // Set Height |
| 229 | - if(!$option->height) $editor_height = 300; |
|
| 230 | - else $editor_height = $option->height; |
|
| 272 | + if(!$option->height) { |
|
| 273 | + $editor_height = 300; |
|
| 274 | + } else { |
|
| 275 | + $editor_height = $option->height; |
|
| 276 | + } |
|
| 231 | 277 | // Skin Setting |
| 232 | 278 | $skin = $option->skin; |
| 233 | - if(!$skin) $skin = 'ckeditor'; |
|
| 279 | + if(!$skin) { |
|
| 280 | + $skin = 'ckeditor'; |
|
| 281 | + } |
|
| 234 | 282 | |
| 235 | 283 | $colorset = $option->colorset; |
| 236 | - if(!$colorset) $colorset = 'moono'; |
|
| 284 | + if(!$colorset) { |
|
| 285 | + $colorset = 'moono'; |
|
| 286 | + } |
|
| 237 | 287 | Context::set('colorset', $colorset); |
| 238 | 288 | Context::set('skin', $skin); |
| 239 | 289 | Context::set('module_type', $option->module_type); |
@@ -258,10 +308,13 @@ discard block |
||
| 258 | 308 | /** |
| 259 | 309 | * Extract editor's unique number (in order to display multiple editors on a single page) |
| 260 | 310 | */ |
| 261 | - if($option->editor_sequence) $editor_sequence = $option->editor_sequence; |
|
| 262 | - else |
|
| 311 | + if($option->editor_sequence) { |
|
| 312 | + $editor_sequence = $option->editor_sequence; |
|
| 313 | + } else |
|
| 263 | 314 | { |
| 264 | - if(!$_SESSION['_editor_sequence_']) $_SESSION['_editor_sequence_'] = 1; |
|
| 315 | + if(!$_SESSION['_editor_sequence_']) { |
|
| 316 | + $_SESSION['_editor_sequence_'] = 1; |
|
| 317 | + } |
|
| 265 | 318 | $editor_sequence = $_SESSION['_editor_sequence_'] ++; |
| 266 | 319 | } |
| 267 | 320 | |
@@ -285,7 +338,9 @@ discard block |
||
| 285 | 338 | $oFileController = getController('file'); |
| 286 | 339 | $oFileController->setUploadInfo($editor_sequence, $upload_target_srl); |
| 287 | 340 | // Check if the file already exists |
| 288 | - if($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl); |
|
| 341 | + if($upload_target_srl) { |
|
| 342 | + $files_count = $oFileModel->getFilesCount($upload_target_srl); |
|
| 343 | + } |
|
| 289 | 344 | } |
| 290 | 345 | Context::set('files_count', (int)$files_count); |
| 291 | 346 | |
@@ -377,8 +432,7 @@ discard block |
||
| 377 | 432 | $config->enable_html_grant = $editor_config->enable_html_grant; |
| 378 | 433 | $config->editor_height = $editor_config->editor_height; |
| 379 | 434 | $config->enable_autosave = $editor_config->enable_autosave; |
| 380 | - } |
|
| 381 | - else |
|
| 435 | + } else |
|
| 382 | 436 | { |
| 383 | 437 | $config->editor_skin = $editor_config->comment_editor_skin; |
| 384 | 438 | $config->content_style = $editor_config->comment_content_style; |
@@ -397,8 +451,7 @@ discard block |
||
| 397 | 451 | { |
| 398 | 452 | $logged_info = Context::get('logged_info'); |
| 399 | 453 | $group_list = $logged_info->group_list; |
| 400 | - } |
|
| 401 | - else |
|
| 454 | + } else |
|
| 402 | 455 | { |
| 403 | 456 | $group_list = array(); |
| 404 | 457 | } |
@@ -412,8 +465,9 @@ discard block |
||
| 412 | 465 | $option->colorset = $config->sel_editor_colorset; |
| 413 | 466 | // Permission check for file upload |
| 414 | 467 | $option->allow_fileupload = false; |
| 415 | - if($logged_info->is_admin=='Y') $option->allow_fileupload = true; |
|
| 416 | - elseif(count($config->upload_file_grant)) |
|
| 468 | + if($logged_info->is_admin=='Y') { |
|
| 469 | + $option->allow_fileupload = true; |
|
| 470 | + } elseif(count($config->upload_file_grant)) |
|
| 417 | 471 | { |
| 418 | 472 | foreach($group_list as $group_srl => $group_info) |
| 419 | 473 | { |
@@ -423,12 +477,14 @@ discard block |
||
| 423 | 477 | break; |
| 424 | 478 | } |
| 425 | 479 | } |
| 480 | + } else { |
|
| 481 | + $option->allow_fileupload = true; |
|
| 426 | 482 | } |
| 427 | - else $option->allow_fileupload = true; |
|
| 428 | 483 | // Permission check for using default components |
| 429 | 484 | $option->enable_default_component = false; |
| 430 | - if($logged_info->is_admin=='Y') $option->enable_default_component = true; |
|
| 431 | - elseif(count($config->enable_default_component_grant)) |
|
| 485 | + if($logged_info->is_admin=='Y') { |
|
| 486 | + $option->enable_default_component = true; |
|
| 487 | + } elseif(count($config->enable_default_component_grant)) |
|
| 432 | 488 | { |
| 433 | 489 | foreach($group_list as $group_srl => $group_info) |
| 434 | 490 | { |
@@ -438,12 +494,14 @@ discard block |
||
| 438 | 494 | break; |
| 439 | 495 | } |
| 440 | 496 | } |
| 497 | + } else { |
|
| 498 | + $option->enable_default_component = true; |
|
| 441 | 499 | } |
| 442 | - else $option->enable_default_component = true; |
|
| 443 | 500 | // Permisshion check for using extended components |
| 444 | 501 | $option->enable_component = false; |
| 445 | - if($logged_info->is_admin=='Y') $option->enable_component = true; |
|
| 446 | - elseif(count($config->enable_component_grant)) |
|
| 502 | + if($logged_info->is_admin=='Y') { |
|
| 503 | + $option->enable_component = true; |
|
| 504 | + } elseif(count($config->enable_component_grant)) |
|
| 447 | 505 | { |
| 448 | 506 | foreach($group_list as $group_srl => $group_info) |
| 449 | 507 | { |
@@ -453,12 +511,14 @@ discard block |
||
| 453 | 511 | break; |
| 454 | 512 | } |
| 455 | 513 | } |
| 514 | + } else { |
|
| 515 | + $option->enable_component = true; |
|
| 456 | 516 | } |
| 457 | - else $option->enable_component = true; |
|
| 458 | 517 | // HTML editing privileges |
| 459 | 518 | $enable_html = false; |
| 460 | - if($logged_info->is_admin=='Y') $enable_html = true; |
|
| 461 | - elseif(count($config->enable_html_grant)) |
|
| 519 | + if($logged_info->is_admin=='Y') { |
|
| 520 | + $enable_html = true; |
|
| 521 | + } elseif(count($config->enable_html_grant)) |
|
| 462 | 522 | { |
| 463 | 523 | foreach($group_list as $group_srl => $group_info) |
| 464 | 524 | { |
@@ -468,11 +528,15 @@ discard block |
||
| 468 | 528 | break; |
| 469 | 529 | } |
| 470 | 530 | } |
| 531 | + } else { |
|
| 532 | + $enable_html = true; |
|
| 471 | 533 | } |
| 472 | - else $enable_html = true; |
|
| 473 | 534 | |
| 474 | - if($enable_html) $option->disable_html = false; |
|
| 475 | - else $option->disable_html = true; |
|
| 535 | + if($enable_html) { |
|
| 536 | + $option->disable_html = false; |
|
| 537 | + } else { |
|
| 538 | + $option->disable_html = true; |
|
| 539 | + } |
|
| 476 | 540 | // Set Height |
| 477 | 541 | $option->height = $config->editor_height; |
| 478 | 542 | // Set an option for Auto-save |
@@ -502,23 +566,28 @@ discard block |
||
| 502 | 566 | { |
| 503 | 567 | $logged_info = Context::get('logged_info'); |
| 504 | 568 | $auto_save_args->member_srl = $logged_info->member_srl; |
| 505 | - } |
|
| 506 | - else |
|
| 569 | + } else |
|
| 507 | 570 | { |
| 508 | 571 | $auto_save_args->certify_key = $_COOKIE['autosave_certify_key_' . $auto_save_args->module_srl]; |
| 509 | 572 | // @see https://github.com/xpressengine/xe-core/issues/2208 |
| 510 | 573 | // 변경 이전에 작성된 게시물 호환성 유지 |
| 511 | - if(!$auto_save_args->certify_key) $auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR']; |
|
| 574 | + if(!$auto_save_args->certify_key) { |
|
| 575 | + $auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR']; |
|
| 576 | + } |
|
| 512 | 577 | } |
| 513 | 578 | // Extract auto-saved data from the DB |
| 514 | 579 | $output = executeQuery('editor.getSavedDocument', $auto_save_args); |
| 515 | 580 | $saved_doc = $output->data; |
| 516 | 581 | // Return null if no result is auto-saved |
| 517 | - if(!$saved_doc) return; |
|
| 582 | + if(!$saved_doc) { |
|
| 583 | + return; |
|
| 584 | + } |
|
| 518 | 585 | // Check if the auto-saved document already exists |
| 519 | 586 | $oDocumentModel = getModel('document'); |
| 520 | 587 | $oSaved = $oDocumentModel->getDocument($saved_doc->document_srl); |
| 521 | - if($oSaved->isExists()) return; |
|
| 588 | + if($oSaved->isExists()) { |
|
| 589 | + return; |
|
| 590 | + } |
|
| 522 | 591 | // Move all the files if the auto-saved data contains document_srl and file |
| 523 | 592 | // Then set document_srl to editor_sequence |
| 524 | 593 | if($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl')) |
@@ -526,8 +595,9 @@ discard block |
||
| 526 | 595 | $saved_doc->module_srl = $auto_save_args->module_srl; |
| 527 | 596 | $oFileController = getController('file'); |
| 528 | 597 | $oFileController->moveFile($saved_doc->document_srl, $saved_doc->module_srl, $upload_target_srl); |
| 598 | + } else if($upload_target_srl) { |
|
| 599 | + $saved_doc->document_srl = $upload_target_srl; |
|
| 529 | 600 | } |
| 530 | - else if($upload_target_srl) $saved_doc->document_srl = $upload_target_srl; |
|
| 531 | 601 | // Change auto-saved data |
| 532 | 602 | $saved_doc->certify_key = $auto_save_args->certify_key; |
| 533 | 603 | $oEditorController = getController('editor'); |
@@ -544,18 +614,24 @@ discard block |
||
| 544 | 614 | */ |
| 545 | 615 | function getComponentObject($component, $editor_sequence = 0, $site_srl = 0) |
| 546 | 616 | { |
| 547 | - if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) return; |
|
| 617 | + if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) { |
|
| 618 | + return; |
|
| 619 | + } |
|
| 548 | 620 | |
| 549 | 621 | if(!$this->loaded_component_list[$component][$editor_sequence]) |
| 550 | 622 | { |
| 551 | 623 | // Create an object of the component and execute |
| 552 | 624 | $class_path = sprintf('%scomponents/%s/', $this->module_path, $component); |
| 553 | 625 | $class_file = sprintf('%s%s.class.php', $class_path, $component); |
| 554 | - if(!file_exists($class_file)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 626 | + if(!file_exists($class_file)) { |
|
| 627 | + return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 628 | + } |
|
| 555 | 629 | // Create an object after loading the class file |
| 556 | 630 | require_once($class_file); |
| 557 | 631 | $oComponent = new $component($editor_sequence, $class_path); |
| 558 | - if(!$oComponent) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 632 | + if(!$oComponent) { |
|
| 633 | + return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 634 | + } |
|
| 559 | 635 | // Add configuration information |
| 560 | 636 | $component_info = $this->getComponent($component, $site_srl); |
| 561 | 637 | $oComponent->setInfo($component_info); |
@@ -582,8 +658,12 @@ discard block |
||
| 582 | 658 | $cache_path = _XE_PATH_.'files/cache/editor/cache/'; |
| 583 | 659 | FileHandler::makeDir($cache_path); |
| 584 | 660 | $cache_file = $cache_path.'component_list.' . $lang .'.'; |
| 585 | - if($filter_enabled) $cache_file .= 'filter.'; |
|
| 586 | - if($site_srl) $cache_file .= $site_srl.'.'; |
|
| 661 | + if($filter_enabled) { |
|
| 662 | + $cache_file .= 'filter.'; |
|
| 663 | + } |
|
| 664 | + if($site_srl) { |
|
| 665 | + $cache_file .= $site_srl.'.'; |
|
| 666 | + } |
|
| 587 | 667 | $cache_file .= 'php'; |
| 588 | 668 | return $cache_file; |
| 589 | 669 | } |
@@ -600,14 +680,15 @@ discard block |
||
| 600 | 680 | $oEditorController->makeCache(false, $site_srl); |
| 601 | 681 | } |
| 602 | 682 | |
| 603 | - if(!file_exists($cache_file)) return; |
|
| 683 | + if(!file_exists($cache_file)) { |
|
| 684 | + return; |
|
| 685 | + } |
|
| 604 | 686 | include($cache_file); |
| 605 | 687 | $logged_info = Context::get('logged_info'); |
| 606 | 688 | if($logged_info && is_array($logged_info->group_list)) |
| 607 | 689 | { |
| 608 | 690 | $group_list = array_keys($logged_info->group_list); |
| 609 | - } |
|
| 610 | - else |
|
| 691 | + } else |
|
| 611 | 692 | { |
| 612 | 693 | $group_list = array(); |
| 613 | 694 | } |
@@ -616,39 +697,50 @@ discard block |
||
| 616 | 697 | { |
| 617 | 698 | foreach($component_list as $key => $val) |
| 618 | 699 | { |
| 619 | - if(!trim($key)) continue; |
|
| 700 | + if(!trim($key)) { |
|
| 701 | + continue; |
|
| 702 | + } |
|
| 620 | 703 | if(!is_dir(_XE_PATH_.'modules/editor/components/'.$key)) |
| 621 | 704 | { |
| 622 | 705 | FileHandler::removeFile($cache_file); |
| 623 | 706 | return $this->getComponentList($filter_enabled, $site_srl); |
| 624 | 707 | } |
| 625 | - if(!$filter_enabled) continue; |
|
| 708 | + if(!$filter_enabled) { |
|
| 709 | + continue; |
|
| 710 | + } |
|
| 626 | 711 | if($val->enabled == "N") |
| 627 | 712 | { |
| 628 | 713 | unset($component_list->{$key}); |
| 629 | 714 | continue; |
| 630 | 715 | } |
| 631 | - if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue; |
|
| 716 | + if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") { |
|
| 717 | + continue; |
|
| 718 | + } |
|
| 632 | 719 | if($val->target_group) |
| 633 | 720 | { |
| 634 | 721 | if(!$logged_info) |
| 635 | 722 | { |
| 636 | 723 | $val->enabled = "N"; |
| 637 | - } |
|
| 638 | - else |
|
| 724 | + } else |
|
| 639 | 725 | { |
| 640 | 726 | $is_granted = false; |
| 641 | 727 | foreach($group_list as $group_srl) |
| 642 | 728 | { |
| 643 | - if(in_array($group_srl, $val->target_group)) $is_granted = true; |
|
| 729 | + if(in_array($group_srl, $val->target_group)) { |
|
| 730 | + $is_granted = true; |
|
| 731 | + } |
|
| 732 | + } |
|
| 733 | + if(!$is_granted) { |
|
| 734 | + $val->enabled = "N"; |
|
| 644 | 735 | } |
| 645 | - if(!$is_granted) $val->enabled = "N"; |
|
| 646 | 736 | } |
| 647 | 737 | } |
| 648 | 738 | if($val->enabled != "N" && $val->mid_list) |
| 649 | 739 | { |
| 650 | 740 | $mid = Context::get('mid'); |
| 651 | - if(!in_array($mid, $val->mid_list)) $val->enabled = "N"; |
|
| 741 | + if(!in_array($mid, $val->mid_list)) { |
|
| 742 | + $val->enabled = "N"; |
|
| 743 | + } |
|
| 652 | 744 | } |
| 653 | 745 | if($val->enabled == "N") |
| 654 | 746 | { |
@@ -672,14 +764,15 @@ discard block |
||
| 672 | 764 | { |
| 673 | 765 | $args->site_srl = $site_srl; |
| 674 | 766 | $output = executeQuery('editor.getSiteComponent', $args); |
| 675 | - } |
|
| 676 | - else |
|
| 767 | + } else |
|
| 677 | 768 | { |
| 678 | 769 | $output = executeQuery('editor.getComponent', $args); |
| 679 | 770 | } |
| 680 | 771 | $component = $output->data; |
| 681 | 772 | |
| 682 | - if(!$output->data) return false; |
|
| 773 | + if(!$output->data) { |
|
| 774 | + return false; |
|
| 775 | + } |
|
| 683 | 776 | |
| 684 | 777 | $component_name = $component->component_name; |
| 685 | 778 | |
@@ -758,8 +851,7 @@ discard block |
||
| 758 | 851 | $component_info->homepage = $xml_doc->component->link->body; |
| 759 | 852 | $component_info->license = $xml_doc->component->license->body; |
| 760 | 853 | $component_info->license_link = $xml_doc->component->license->attrs->link; |
| 761 | - } |
|
| 762 | - else |
|
| 854 | + } else |
|
| 763 | 855 | { |
| 764 | 856 | sscanf($xml_doc->component->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d); |
| 765 | 857 | $date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
@@ -776,8 +868,11 @@ discard block |
||
| 776 | 868 | |
| 777 | 869 | // Author information |
| 778 | 870 | $author_list = array(); |
| 779 | - if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author; |
|
| 780 | - else $author_list = $xml_doc->component->author; |
|
| 871 | + if(!is_array($xml_doc->component->author)) { |
|
| 872 | + $author_list[] = $xml_doc->component->author; |
|
| 873 | + } else { |
|
| 874 | + $author_list = $xml_doc->component->author; |
|
| 875 | + } |
|
| 781 | 876 | |
| 782 | 877 | for($i = 0; $i < count($author_list); $i++) |
| 783 | 878 | { |
@@ -47,28 +47,28 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | $component = Context::get('component'); |
| 49 | 49 | $method = Context::get('method'); |
| 50 | - if(!$component) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 50 | + if (!$component) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 51 | 51 | |
| 52 | 52 | $oEditorModel = getModel('editor'); |
| 53 | 53 | $oComponent = &$oEditorModel->getComponentObject($component); |
| 54 | - if(!$oComponent->toBool()) return $oComponent; |
|
| 54 | + if (!$oComponent->toBool()) return $oComponent; |
|
| 55 | 55 | |
| 56 | - if(!method_exists($oComponent, $method)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 56 | + if (!method_exists($oComponent, $method)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 57 | 57 | |
| 58 | 58 | //$output = call_user_method($method, $oComponent); |
| 59 | 59 | //$output = call_user_func(array($oComponent, $method)); |
| 60 | - if(method_exists($oComponent, $method)) $output = $oComponent->{$method}(); |
|
| 61 | - else return new BaseObject(-1,sprintf('%s method is not exists', $method)); |
|
| 60 | + if (method_exists($oComponent, $method)) $output = $oComponent->{$method}(); |
|
| 61 | + else return new BaseObject(-1, sprintf('%s method is not exists', $method)); |
|
| 62 | 62 | |
| 63 | - if((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) return $output; |
|
| 63 | + if ((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) return $output; |
|
| 64 | 64 | |
| 65 | 65 | $this->setError($oComponent->getError()); |
| 66 | 66 | $this->setMessage($oComponent->getMessage()); |
| 67 | 67 | |
| 68 | 68 | $vars = $oComponent->getVariables(); |
| 69 | - if(count($vars)) |
|
| 69 | + if (count($vars)) |
|
| 70 | 70 | { |
| 71 | - foreach($vars as $key => $val) |
|
| 71 | + foreach ($vars as $key => $val) |
|
| 72 | 72 | { |
| 73 | 73 | $this->add($key, $val); |
| 74 | 74 | } |
@@ -86,18 +86,18 @@ discard block |
||
| 86 | 86 | $module_srl = array(); |
| 87 | 87 | $oModuleModel = getModel('module'); |
| 88 | 88 | |
| 89 | - foreach($target_module_srl as $srl) |
|
| 89 | + foreach ($target_module_srl as $srl) |
|
| 90 | 90 | { |
| 91 | - if(!$srl) continue; |
|
| 91 | + if (!$srl) continue; |
|
| 92 | 92 | |
| 93 | 93 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($srl); |
| 94 | - if(!$module_info->module_srl) |
|
| 94 | + if (!$module_info->module_srl) |
|
| 95 | 95 | { |
| 96 | 96 | return new BaseObject(-1, 'msg_invalid_request'); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | $module_grant = $oModuleModel->getGrant($module_info, $logged_info); |
| 100 | - if(!$module_grant->manager) |
|
| 100 | + if (!$module_grant->manager) |
|
| 101 | 101 | { |
| 102 | 102 | return new BaseObject(-1, 'msg_not_permitted'); |
| 103 | 103 | } |
@@ -111,32 +111,32 @@ discard block |
||
| 111 | 111 | $editor_config->content_style = Context::get('content_style'); |
| 112 | 112 | $editor_config->comment_content_style = Context::get('comment_content_style'); |
| 113 | 113 | $editor_config->content_font = Context::get('content_font'); |
| 114 | - if($editor_config->content_font) |
|
| 114 | + if ($editor_config->content_font) |
|
| 115 | 115 | { |
| 116 | 116 | $font_list = array(); |
| 117 | - $fonts = explode(',',$editor_config->content_font); |
|
| 118 | - for($i=0,$c=count($fonts);$i<$c;$i++) |
|
| 117 | + $fonts = explode(',', $editor_config->content_font); |
|
| 118 | + for ($i = 0, $c = count($fonts); $i < $c; $i++) |
|
| 119 | 119 | { |
| 120 | - $font = trim(str_replace(array('"','\''),'',$fonts[$i])); |
|
| 121 | - if(!$font) continue; |
|
| 120 | + $font = trim(str_replace(array('"', '\''), '', $fonts[$i])); |
|
| 121 | + if (!$font) continue; |
|
| 122 | 122 | $font_list[] = $font; |
| 123 | 123 | } |
| 124 | - if(count($font_list)) $editor_config->content_font = '"'.implode('","',$font_list).'"'; |
|
| 124 | + if (count($font_list)) $editor_config->content_font = '"'.implode('","', $font_list).'"'; |
|
| 125 | 125 | } |
| 126 | 126 | $editor_config->content_font_size = Context::get('content_font_size'); |
| 127 | 127 | $editor_config->sel_editor_colorset = Context::get('sel_editor_colorset'); |
| 128 | 128 | $editor_config->sel_comment_editor_colorset = Context::get('sel_comment_editor_colorset'); |
| 129 | 129 | |
| 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'); |
|
| 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'); |
|
| 131 | 131 | |
| 132 | - foreach($grants as $key) |
|
| 132 | + foreach ($grants as $key) |
|
| 133 | 133 | { |
| 134 | 134 | $grant = Context::get($key); |
| 135 | - if(!$grant) |
|
| 135 | + if (!$grant) |
|
| 136 | 136 | { |
| 137 | 137 | $editor_config->{$key} = array(); |
| 138 | 138 | } |
| 139 | - else if(is_array($grant)) |
|
| 139 | + else if (is_array($grant)) |
|
| 140 | 140 | { |
| 141 | 141 | $editor_config->{$key} = $grant; |
| 142 | 142 | } |
@@ -146,13 +146,13 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - $editor_config->editor_height = (int)Context::get('editor_height'); |
|
| 150 | - $editor_config->comment_editor_height = (int)Context::get('comment_editor_height'); |
|
| 149 | + $editor_config->editor_height = (int) Context::get('editor_height'); |
|
| 150 | + $editor_config->comment_editor_height = (int) Context::get('comment_editor_height'); |
|
| 151 | 151 | $editor_config->enable_autosave = Context::get('enable_autosave'); |
| 152 | - if($editor_config->enable_autosave != 'Y') $editor_config->enable_autosave = 'N'; |
|
| 152 | + if ($editor_config->enable_autosave != 'Y') $editor_config->enable_autosave = 'N'; |
|
| 153 | 153 | |
| 154 | 154 | $oModuleController = getController('module'); |
| 155 | - foreach($module_srl as $srl) |
|
| 155 | + foreach ($module_srl as $srl) |
|
| 156 | 156 | { |
| 157 | 157 | $oModuleController->insertModulePartConfig('editor', $srl, $editor_config); |
| 158 | 158 | } |
@@ -169,31 +169,31 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | function triggerEditorComponentCompile(&$content) |
| 171 | 171 | { |
| 172 | - if(Context::getResponseMethod()!='HTML') return new BaseObject(); |
|
| 172 | + if (Context::getResponseMethod() != 'HTML') return new BaseObject(); |
|
| 173 | 173 | |
| 174 | 174 | $module_info = Context::get('module_info'); |
| 175 | 175 | $module_srl = $module_info->module_srl; |
| 176 | - if($module_srl) |
|
| 176 | + if ($module_srl) |
|
| 177 | 177 | { |
| 178 | 178 | $oEditorModel = getModel('editor'); |
| 179 | 179 | $editor_config = $oEditorModel->getEditorConfig($module_srl); |
| 180 | 180 | $content_style = $editor_config->content_style; |
| 181 | - if($content_style) |
|
| 181 | + if ($content_style) |
|
| 182 | 182 | { |
| 183 | - $path = _XE_PATH_ . 'modules/editor/styles/'.$content_style.'/'; |
|
| 184 | - if(is_dir($path) && file_exists($path . 'style.ini')) |
|
| 183 | + $path = _XE_PATH_.'modules/editor/styles/'.$content_style.'/'; |
|
| 184 | + if (is_dir($path) && file_exists($path.'style.ini')) |
|
| 185 | 185 | { |
| 186 | 186 | $ini = file($path.'style.ini'); |
| 187 | - for($i = 0, $c = count($ini); $i < $c; $i++) |
|
| 187 | + for ($i = 0, $c = count($ini); $i < $c; $i++) |
|
| 188 | 188 | { |
| 189 | 189 | $file = trim($ini[$i]); |
| 190 | - if(!$file) continue; |
|
| 190 | + if (!$file) continue; |
|
| 191 | 191 | |
| 192 | - if(substr_compare($file, '.css', -4) === 0) |
|
| 192 | + if (substr_compare($file, '.css', -4) === 0) |
|
| 193 | 193 | { |
| 194 | 194 | Context::addCSSFile('./modules/editor/styles/'.$content_style.'/'.$file, false); |
| 195 | 195 | } |
| 196 | - elseif(substr_compare($file, '.js', -3) === 0) |
|
| 196 | + elseif (substr_compare($file, '.js', -3) === 0) |
|
| 197 | 197 | { |
| 198 | 198 | Context::addJsFile('./modules/editor/styles/'.$content_style.'/'.$file, false); |
| 199 | 199 | } |
@@ -202,12 +202,12 @@ discard block |
||
| 202 | 202 | } |
| 203 | 203 | $content_font = $editor_config->content_font; |
| 204 | 204 | $content_font_size = $editor_config->content_font_size; |
| 205 | - if($content_font || $content_font_size) |
|
| 205 | + if ($content_font || $content_font_size) |
|
| 206 | 206 | { |
| 207 | 207 | $buff = array(); |
| 208 | 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.';'; |
|
| 209 | + if ($content_font) $buff[] = 'font-family:'.$content_font.';'; |
|
| 210 | + if ($content_font_size) $buff[] = 'font-size:'.$content_font_size.';'; |
|
| 211 | 211 | $buff[] = ' }</style>'; |
| 212 | 212 | Context::addHtmlHeader(implode('', $buff)); |
| 213 | 213 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | function transComponent($content) |
| 224 | 224 | { |
| 225 | - $content = preg_replace_callback('!<(?:(div)|img)([^>]*)editor_component=([^>]*)>(?(1)(.*?)</div>)!is', array($this,'transEditorComponent'), $content); |
|
| 225 | + $content = preg_replace_callback('!<(?:(div)|img)([^>]*)editor_component=([^>]*)>(?(1)(.*?)</div>)!is', array($this, 'transEditorComponent'), $content); |
|
| 226 | 226 | return $content; |
| 227 | 227 | } |
| 228 | 228 | |
@@ -237,19 +237,19 @@ discard block |
||
| 237 | 237 | |
| 238 | 238 | $xml_obj = new stdClass; |
| 239 | 239 | $xml_obj->attrs = new stdClass; |
| 240 | - for($i=0,$c=count($m[0]);$i<$c;$i++) |
|
| 240 | + for ($i = 0, $c = count($m[0]); $i < $c; $i++) |
|
| 241 | 241 | { |
| 242 | - if(!isset($xml_obj->attrs)) $xml_obj->attrs = new stdClass; |
|
| 242 | + if (!isset($xml_obj->attrs)) $xml_obj->attrs = new stdClass; |
|
| 243 | 243 | $xml_obj->attrs->{$m[1][$i]} = $m[2][$i]; |
| 244 | 244 | } |
| 245 | 245 | $xml_obj->body = $match[4]; |
| 246 | 246 | |
| 247 | - if(!$xml_obj->attrs->editor_component) return $match[0]; |
|
| 247 | + if (!$xml_obj->attrs->editor_component) return $match[0]; |
|
| 248 | 248 | |
| 249 | 249 | // Get converted codes by using component::transHTML() |
| 250 | 250 | $oEditorModel = getModel('editor'); |
| 251 | 251 | $oComponent = &$oEditorModel->getComponentObject($xml_obj->attrs->editor_component, 0); |
| 252 | - if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) return $match[0]; |
|
| 252 | + if (!is_object($oComponent) || !method_exists($oComponent, 'transHTML')) return $match[0]; |
|
| 253 | 253 | |
| 254 | 254 | return $oComponent->transHTML($xml_obj); |
| 255 | 255 | } |
@@ -259,26 +259,26 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | function doSaveDoc($args) |
| 261 | 261 | { |
| 262 | - if(!$args->document_srl) $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 262 | + if (!$args->document_srl) $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 263 | 263 | |
| 264 | 264 | // Get the current module if module_srl doesn't exist |
| 265 | - if(!$args->module_srl) $args->module_srl = Context::get('module_srl'); |
|
| 266 | - if(!$args->module_srl) |
|
| 265 | + if (!$args->module_srl) $args->module_srl = Context::get('module_srl'); |
|
| 266 | + if (!$args->module_srl) |
|
| 267 | 267 | { |
| 268 | 268 | $current_module_info = Context::get('current_module_info'); |
| 269 | 269 | $args->module_srl = $current_module_info->module_srl; |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - if(Context::get('is_logged')) |
|
| 272 | + if (Context::get('is_logged')) |
|
| 273 | 273 | { |
| 274 | 274 | $logged_info = Context::get('logged_info'); |
| 275 | 275 | $args->member_srl = $logged_info->member_srl; |
| 276 | 276 | } |
| 277 | 277 | else |
| 278 | 278 | { |
| 279 | - $args->certify_key = $_COOKIE['autosave_certify_key_' . $args->module_srl]; |
|
| 280 | - if(!$args->certify_key) $args->certify_key = Password::createSecureSalt(40); |
|
| 281 | - setcookie('autosave_certify_key_' . $args->module_srl, $args->certify_key, $_SERVER['REQUEST_TIME'] + 3600, '', '', false, true); |
|
| 279 | + $args->certify_key = $_COOKIE['autosave_certify_key_'.$args->module_srl]; |
|
| 280 | + if (!$args->certify_key) $args->certify_key = Password::createSecureSalt(40); |
|
| 281 | + setcookie('autosave_certify_key_'.$args->module_srl, $args->certify_key, $_SERVER['REQUEST_TIME'] + 3600, '', '', false, true); |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | return executeQuery('editor.insertSavedDoc', $args); |
@@ -324,22 +324,22 @@ discard block |
||
| 324 | 324 | $args->module_srl = Context::get('module_srl'); |
| 325 | 325 | |
| 326 | 326 | // Get the current module if module_srl doesn't exist |
| 327 | - if(!$args->module_srl) |
|
| 327 | + if (!$args->module_srl) |
|
| 328 | 328 | { |
| 329 | 329 | $current_module_info = Context::get('current_module_info'); |
| 330 | 330 | $args->module_srl = $current_module_info->module_srl; |
| 331 | 331 | } |
| 332 | - if(Context::get('is_logged')) |
|
| 332 | + if (Context::get('is_logged')) |
|
| 333 | 333 | { |
| 334 | 334 | $logged_info = Context::get('logged_info'); |
| 335 | 335 | $args->member_srl = $logged_info->member_srl; |
| 336 | 336 | } |
| 337 | 337 | else |
| 338 | 338 | { |
| 339 | - $args->certify_key = $_COOKIE['autosave_certify_key_' . $args->module_srl]; |
|
| 339 | + $args->certify_key = $_COOKIE['autosave_certify_key_'.$args->module_srl]; |
|
| 340 | 340 | // @see https://github.com/xpressengine/xe-core/issues/2208 |
| 341 | 341 | // 변경 이전에 작성된 게시물 호환성 유지 |
| 342 | - if(!$args->certify_key) { |
|
| 342 | + if (!$args->certify_key) { |
|
| 343 | 343 | unset($args->certify_key); |
| 344 | 344 | $args->ipaddress = $_SERVER['REMOTE_ADDR']; |
| 345 | 345 | } |
@@ -347,13 +347,13 @@ discard block |
||
| 347 | 347 | // Check if the auto-saved document already exists |
| 348 | 348 | $output = executeQuery('editor.getSavedDocument', $args); |
| 349 | 349 | $saved_doc = $output->data; |
| 350 | - if(!$saved_doc) return; |
|
| 350 | + if (!$saved_doc) return; |
|
| 351 | 351 | |
| 352 | 352 | $oDocumentModel = getModel('document'); |
| 353 | 353 | $oSaved = $oDocumentModel->getDocument($saved_doc->document_srl); |
| 354 | - if(!$oSaved->isExists()) |
|
| 354 | + if (!$oSaved->isExists()) |
|
| 355 | 355 | { |
| 356 | - if($mode) |
|
| 356 | + if ($mode) |
|
| 357 | 357 | { |
| 358 | 358 | $output = executeQuery('editor.getSavedDocument', $args); |
| 359 | 359 | $output = ModuleHandler::triggerCall('editor.deleteSavedDoc', 'after', $saved_doc); |
@@ -382,9 +382,9 @@ discard block |
||
| 382 | 382 | $oEditorModel = getModel('editor'); |
| 383 | 383 | $args = new stdClass; |
| 384 | 384 | |
| 385 | - if($filter_enabled) $args->enabled = "Y"; |
|
| 385 | + if ($filter_enabled) $args->enabled = "Y"; |
|
| 386 | 386 | |
| 387 | - if($site_srl) |
|
| 387 | + if ($site_srl) |
|
| 388 | 388 | { |
| 389 | 389 | $args->site_srl = $site_srl; |
| 390 | 390 | $output = executeQuery('editor.getSiteComponentList', $args); |
@@ -397,10 +397,10 @@ discard block |
||
| 397 | 397 | |
| 398 | 398 | // Get information about log-in status and its group |
| 399 | 399 | $is_logged = Context::get('is_logged'); |
| 400 | - if($is_logged) |
|
| 400 | + if ($is_logged) |
|
| 401 | 401 | { |
| 402 | 402 | $logged_info = Context::get('logged_info'); |
| 403 | - if($logged_info->group_list && is_array($logged_info->group_list)) |
|
| 403 | + if ($logged_info->group_list && is_array($logged_info->group_list)) |
|
| 404 | 404 | { |
| 405 | 405 | $group_list = array_keys($logged_info->group_list); |
| 406 | 406 | } |
@@ -408,30 +408,30 @@ discard block |
||
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | // Get xml information for looping DB list |
| 411 | - if(!is_array($db_list)) $db_list = array($db_list); |
|
| 411 | + if (!is_array($db_list)) $db_list = array($db_list); |
|
| 412 | 412 | $component_list = new stdClass(); |
| 413 | - foreach($db_list as $component) |
|
| 413 | + foreach ($db_list as $component) |
|
| 414 | 414 | { |
| 415 | - if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) continue; |
|
| 415 | + if (in_array($component->component_name, array('colorpicker_text', 'colorpicker_bg'))) continue; |
|
| 416 | 416 | |
| 417 | 417 | $component_name = $component->component_name; |
| 418 | - if(!$component_name) continue; |
|
| 418 | + if (!$component_name) continue; |
|
| 419 | 419 | |
| 420 | - if(!in_array($component_name, $downloaded_list)) continue; |
|
| 420 | + if (!in_array($component_name, $downloaded_list)) continue; |
|
| 421 | 421 | |
| 422 | 422 | unset($xml_info); |
| 423 | 423 | $xml_info = $oEditorModel->getComponentXmlInfo($component_name); |
| 424 | 424 | $xml_info->enabled = $component->enabled; |
| 425 | 425 | |
| 426 | - if($component->extra_vars) |
|
| 426 | + if ($component->extra_vars) |
|
| 427 | 427 | { |
| 428 | 428 | $extra_vars = unserialize($component->extra_vars); |
| 429 | - if($extra_vars->target_group) |
|
| 429 | + if ($extra_vars->target_group) |
|
| 430 | 430 | { |
| 431 | 431 | $xml_info->target_group = $extra_vars->target_group; |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | - if($extra_vars->mid_list && count($extra_vars->mid_list)) |
|
| 434 | + if ($extra_vars->mid_list && count($extra_vars->mid_list)) |
|
| 435 | 435 | { |
| 436 | 436 | $xml_info->mid_list = $extra_vars->mid_list; |
| 437 | 437 | } |
@@ -458,9 +458,9 @@ discard block |
||
| 458 | 458 | if(!in_array(Context::get('mid'), $extra_vars->mid_list)) continue; |
| 459 | 459 | }*/ |
| 460 | 460 | // Check the configuration of the editor component |
| 461 | - if($xml_info->extra_vars) |
|
| 461 | + if ($xml_info->extra_vars) |
|
| 462 | 462 | { |
| 463 | - foreach($xml_info->extra_vars as $key => $val) |
|
| 463 | + foreach ($xml_info->extra_vars as $key => $val) |
|
| 464 | 464 | { |
| 465 | 465 | $xml_info->extra_vars->{$key}->value = $extra_vars->{$key}; |
| 466 | 466 | } |
@@ -471,25 +471,25 @@ discard block |
||
| 471 | 471 | // Get buttons, icons, images |
| 472 | 472 | $icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/icon.gif'; |
| 473 | 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; |
|
| 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; |
|
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | // Return if it checks enabled only |
| 479 | - if($filter_enabled) |
|
| 479 | + if ($filter_enabled) |
|
| 480 | 480 | { |
| 481 | 481 | $cache_file = $oEditorModel->getCacheFile($filter_enabled, $site_srl); |
| 482 | - $buff = sprintf('<?php if(!defined("__XE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"','\\"',serialize($component_list))); |
|
| 482 | + $buff = sprintf('<?php if(!defined("__XE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"', '\\"', serialize($component_list))); |
|
| 483 | 483 | FileHandler::writeFile($cache_file, $buff); |
| 484 | 484 | return $component_list; |
| 485 | 485 | } |
| 486 | 486 | |
| 487 | 487 | // Get xml_info of downloaded list |
| 488 | - foreach($downloaded_list as $component_name) |
|
| 488 | + foreach ($downloaded_list as $component_name) |
|
| 489 | 489 | { |
| 490 | - if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) continue; |
|
| 490 | + if (in_array($component_name, array('colorpicker_text', 'colorpicker_bg'))) continue; |
|
| 491 | 491 | // Pass if configured |
| 492 | - if($component_list->{$component_name}) continue; |
|
| 492 | + if ($component_list->{$component_name}) continue; |
|
| 493 | 493 | // Insert data into the DB |
| 494 | 494 | $oEditorController = getAdminController('editor'); |
| 495 | 495 | $oEditorController->insertComponent($component_name, false, $site_srl); |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | } |
| 503 | 503 | |
| 504 | 504 | $cache_file = $oEditorModel->getCacheFile($filter_enabled, $site_srl); |
| 505 | - $buff = sprintf('<?php if(!defined("__XE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"','\\"',serialize($component_list))); |
|
| 505 | + $buff = sprintf('<?php if(!defined("__XE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"', '\\"', serialize($component_list))); |
|
| 506 | 506 | FileHandler::writeFile($cache_file, $buff); |
| 507 | 507 | |
| 508 | 508 | return $component_list; |
@@ -524,9 +524,9 @@ discard block |
||
| 524 | 524 | $editorConfig = $oModuleModel->getModulePartConfig('editor', $obj->originModuleSrl); |
| 525 | 525 | |
| 526 | 526 | $oModuleController = getController('module'); |
| 527 | - if(is_array($obj->moduleSrlList)) |
|
| 527 | + if (is_array($obj->moduleSrlList)) |
|
| 528 | 528 | { |
| 529 | - foreach($obj->moduleSrlList AS $key=>$moduleSrl) |
|
| 529 | + foreach ($obj->moduleSrlList AS $key=>$moduleSrl) |
|
| 530 | 530 | { |
| 531 | 531 | $oModuleController->insertModulePartConfig('editor', $moduleSrl, $editorConfig); |
| 532 | 532 | } |
@@ -47,20 +47,31 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | $component = Context::get('component'); |
| 49 | 49 | $method = Context::get('method'); |
| 50 | - if(!$component) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 50 | + if(!$component) { |
|
| 51 | + return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 52 | + } |
|
| 51 | 53 | |
| 52 | 54 | $oEditorModel = getModel('editor'); |
| 53 | 55 | $oComponent = &$oEditorModel->getComponentObject($component); |
| 54 | - if(!$oComponent->toBool()) return $oComponent; |
|
| 56 | + if(!$oComponent->toBool()) { |
|
| 57 | + return $oComponent; |
|
| 58 | + } |
|
| 55 | 59 | |
| 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)) { |
|
| 61 | + return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 62 | + } |
|
| 57 | 63 | |
| 58 | 64 | //$output = call_user_method($method, $oComponent); |
| 59 | 65 | //$output = call_user_func(array($oComponent, $method)); |
| 60 | - if(method_exists($oComponent, $method)) $output = $oComponent->{$method}(); |
|
| 61 | - else return new BaseObject(-1,sprintf('%s method is not exists', $method)); |
|
| 66 | + if(method_exists($oComponent, $method)) { |
|
| 67 | + $output = $oComponent->{$method}(); |
|
| 68 | + } else { |
|
| 69 | + return new BaseObject(-1,sprintf('%s method is not exists', $method)); |
|
| 70 | + } |
|
| 62 | 71 | |
| 63 | - if((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) return $output; |
|
| 72 | + if((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) { |
|
| 73 | + return $output; |
|
| 74 | + } |
|
| 64 | 75 | |
| 65 | 76 | $this->setError($oComponent->getError()); |
| 66 | 77 | $this->setMessage($oComponent->getMessage()); |
@@ -88,7 +99,9 @@ discard block |
||
| 88 | 99 | |
| 89 | 100 | foreach($target_module_srl as $srl) |
| 90 | 101 | { |
| 91 | - if(!$srl) continue; |
|
| 102 | + if(!$srl) { |
|
| 103 | + continue; |
|
| 104 | + } |
|
| 92 | 105 | |
| 93 | 106 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($srl); |
| 94 | 107 | if(!$module_info->module_srl) |
@@ -118,10 +131,14 @@ discard block |
||
| 118 | 131 | for($i=0,$c=count($fonts);$i<$c;$i++) |
| 119 | 132 | { |
| 120 | 133 | $font = trim(str_replace(array('"','\''),'',$fonts[$i])); |
| 121 | - if(!$font) continue; |
|
| 134 | + if(!$font) { |
|
| 135 | + continue; |
|
| 136 | + } |
|
| 122 | 137 | $font_list[] = $font; |
| 123 | 138 | } |
| 124 | - if(count($font_list)) $editor_config->content_font = '"'.implode('","',$font_list).'"'; |
|
| 139 | + if(count($font_list)) { |
|
| 140 | + $editor_config->content_font = '"'.implode('","',$font_list).'"'; |
|
| 141 | + } |
|
| 125 | 142 | } |
| 126 | 143 | $editor_config->content_font_size = Context::get('content_font_size'); |
| 127 | 144 | $editor_config->sel_editor_colorset = Context::get('sel_editor_colorset'); |
@@ -135,12 +152,10 @@ discard block |
||
| 135 | 152 | if(!$grant) |
| 136 | 153 | { |
| 137 | 154 | $editor_config->{$key} = array(); |
| 138 | - } |
|
| 139 | - else if(is_array($grant)) |
|
| 155 | + } else if(is_array($grant)) |
|
| 140 | 156 | { |
| 141 | 157 | $editor_config->{$key} = $grant; |
| 142 | - } |
|
| 143 | - else |
|
| 158 | + } else |
|
| 144 | 159 | { |
| 145 | 160 | $editor_config->{$key} = explode('|@|', $grant); |
| 146 | 161 | } |
@@ -149,7 +164,9 @@ discard block |
||
| 149 | 164 | $editor_config->editor_height = (int)Context::get('editor_height'); |
| 150 | 165 | $editor_config->comment_editor_height = (int)Context::get('comment_editor_height'); |
| 151 | 166 | $editor_config->enable_autosave = Context::get('enable_autosave'); |
| 152 | - if($editor_config->enable_autosave != 'Y') $editor_config->enable_autosave = 'N'; |
|
| 167 | + if($editor_config->enable_autosave != 'Y') { |
|
| 168 | + $editor_config->enable_autosave = 'N'; |
|
| 169 | + } |
|
| 153 | 170 | |
| 154 | 171 | $oModuleController = getController('module'); |
| 155 | 172 | foreach($module_srl as $srl) |
@@ -169,7 +186,9 @@ discard block |
||
| 169 | 186 | */ |
| 170 | 187 | function triggerEditorComponentCompile(&$content) |
| 171 | 188 | { |
| 172 | - if(Context::getResponseMethod()!='HTML') return new BaseObject(); |
|
| 189 | + if(Context::getResponseMethod()!='HTML') { |
|
| 190 | + return new BaseObject(); |
|
| 191 | + } |
|
| 173 | 192 | |
| 174 | 193 | $module_info = Context::get('module_info'); |
| 175 | 194 | $module_srl = $module_info->module_srl; |
@@ -187,13 +206,14 @@ discard block |
||
| 187 | 206 | for($i = 0, $c = count($ini); $i < $c; $i++) |
| 188 | 207 | { |
| 189 | 208 | $file = trim($ini[$i]); |
| 190 | - if(!$file) continue; |
|
| 209 | + if(!$file) { |
|
| 210 | + continue; |
|
| 211 | + } |
|
| 191 | 212 | |
| 192 | 213 | if(substr_compare($file, '.css', -4) === 0) |
| 193 | 214 | { |
| 194 | 215 | Context::addCSSFile('./modules/editor/styles/'.$content_style.'/'.$file, false); |
| 195 | - } |
|
| 196 | - elseif(substr_compare($file, '.js', -3) === 0) |
|
| 216 | + } elseif(substr_compare($file, '.js', -3) === 0) |
|
| 197 | 217 | { |
| 198 | 218 | Context::addJsFile('./modules/editor/styles/'.$content_style.'/'.$file, false); |
| 199 | 219 | } |
@@ -206,8 +226,12 @@ discard block |
||
| 206 | 226 | { |
| 207 | 227 | $buff = array(); |
| 208 | 228 | $buff[] = '<style> .xe_content { '; |
| 209 | - if($content_font) $buff[] = 'font-family:'.$content_font.';'; |
|
| 210 | - if($content_font_size) $buff[] = 'font-size:'.$content_font_size.';'; |
|
| 229 | + if($content_font) { |
|
| 230 | + $buff[] = 'font-family:'.$content_font.';'; |
|
| 231 | + } |
|
| 232 | + if($content_font_size) { |
|
| 233 | + $buff[] = 'font-size:'.$content_font_size.';'; |
|
| 234 | + } |
|
| 211 | 235 | $buff[] = ' }</style>'; |
| 212 | 236 | Context::addHtmlHeader(implode('', $buff)); |
| 213 | 237 | } |
@@ -239,17 +263,23 @@ discard block |
||
| 239 | 263 | $xml_obj->attrs = new stdClass; |
| 240 | 264 | for($i=0,$c=count($m[0]);$i<$c;$i++) |
| 241 | 265 | { |
| 242 | - if(!isset($xml_obj->attrs)) $xml_obj->attrs = new stdClass; |
|
| 266 | + if(!isset($xml_obj->attrs)) { |
|
| 267 | + $xml_obj->attrs = new stdClass; |
|
| 268 | + } |
|
| 243 | 269 | $xml_obj->attrs->{$m[1][$i]} = $m[2][$i]; |
| 244 | 270 | } |
| 245 | 271 | $xml_obj->body = $match[4]; |
| 246 | 272 | |
| 247 | - if(!$xml_obj->attrs->editor_component) return $match[0]; |
|
| 273 | + if(!$xml_obj->attrs->editor_component) { |
|
| 274 | + return $match[0]; |
|
| 275 | + } |
|
| 248 | 276 | |
| 249 | 277 | // Get converted codes by using component::transHTML() |
| 250 | 278 | $oEditorModel = getModel('editor'); |
| 251 | 279 | $oComponent = &$oEditorModel->getComponentObject($xml_obj->attrs->editor_component, 0); |
| 252 | - if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) return $match[0]; |
|
| 280 | + if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) { |
|
| 281 | + return $match[0]; |
|
| 282 | + } |
|
| 253 | 283 | |
| 254 | 284 | return $oComponent->transHTML($xml_obj); |
| 255 | 285 | } |
@@ -259,10 +289,14 @@ discard block |
||
| 259 | 289 | */ |
| 260 | 290 | function doSaveDoc($args) |
| 261 | 291 | { |
| 262 | - if(!$args->document_srl) $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 292 | + if(!$args->document_srl) { |
|
| 293 | + $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 294 | + } |
|
| 263 | 295 | |
| 264 | 296 | // Get the current module if module_srl doesn't exist |
| 265 | - if(!$args->module_srl) $args->module_srl = Context::get('module_srl'); |
|
| 297 | + if(!$args->module_srl) { |
|
| 298 | + $args->module_srl = Context::get('module_srl'); |
|
| 299 | + } |
|
| 266 | 300 | if(!$args->module_srl) |
| 267 | 301 | { |
| 268 | 302 | $current_module_info = Context::get('current_module_info'); |
@@ -273,11 +307,12 @@ discard block |
||
| 273 | 307 | { |
| 274 | 308 | $logged_info = Context::get('logged_info'); |
| 275 | 309 | $args->member_srl = $logged_info->member_srl; |
| 276 | - } |
|
| 277 | - else |
|
| 310 | + } else |
|
| 278 | 311 | { |
| 279 | 312 | $args->certify_key = $_COOKIE['autosave_certify_key_' . $args->module_srl]; |
| 280 | - if(!$args->certify_key) $args->certify_key = Password::createSecureSalt(40); |
|
| 313 | + if(!$args->certify_key) { |
|
| 314 | + $args->certify_key = Password::createSecureSalt(40); |
|
| 315 | + } |
|
| 281 | 316 | setcookie('autosave_certify_key_' . $args->module_srl, $args->certify_key, $_SERVER['REQUEST_TIME'] + 3600, '', '', false, true); |
| 282 | 317 | } |
| 283 | 318 | |
@@ -333,8 +368,7 @@ discard block |
||
| 333 | 368 | { |
| 334 | 369 | $logged_info = Context::get('logged_info'); |
| 335 | 370 | $args->member_srl = $logged_info->member_srl; |
| 336 | - } |
|
| 337 | - else |
|
| 371 | + } else |
|
| 338 | 372 | { |
| 339 | 373 | $args->certify_key = $_COOKIE['autosave_certify_key_' . $args->module_srl]; |
| 340 | 374 | // @see https://github.com/xpressengine/xe-core/issues/2208 |
@@ -347,7 +381,9 @@ discard block |
||
| 347 | 381 | // Check if the auto-saved document already exists |
| 348 | 382 | $output = executeQuery('editor.getSavedDocument', $args); |
| 349 | 383 | $saved_doc = $output->data; |
| 350 | - if(!$saved_doc) return; |
|
| 384 | + if(!$saved_doc) { |
|
| 385 | + return; |
|
| 386 | + } |
|
| 351 | 387 | |
| 352 | 388 | $oDocumentModel = getModel('document'); |
| 353 | 389 | $oSaved = $oDocumentModel->getDocument($saved_doc->document_srl); |
@@ -382,14 +418,17 @@ discard block |
||
| 382 | 418 | $oEditorModel = getModel('editor'); |
| 383 | 419 | $args = new stdClass; |
| 384 | 420 | |
| 385 | - if($filter_enabled) $args->enabled = "Y"; |
|
| 421 | + if($filter_enabled) { |
|
| 422 | + $args->enabled = "Y"; |
|
| 423 | + } |
|
| 386 | 424 | |
| 387 | 425 | if($site_srl) |
| 388 | 426 | { |
| 389 | 427 | $args->site_srl = $site_srl; |
| 390 | 428 | $output = executeQuery('editor.getSiteComponentList', $args); |
| 429 | + } else { |
|
| 430 | + $output = executeQuery('editor.getComponentList', $args); |
|
| 391 | 431 | } |
| 392 | - else $output = executeQuery('editor.getComponentList', $args); |
|
| 393 | 432 | $db_list = $output->data; |
| 394 | 433 | |
| 395 | 434 | // Get a list of files |
@@ -403,21 +442,30 @@ discard block |
||
| 403 | 442 | if($logged_info->group_list && is_array($logged_info->group_list)) |
| 404 | 443 | { |
| 405 | 444 | $group_list = array_keys($logged_info->group_list); |
| 445 | + } else { |
|
| 446 | + $group_list = array(); |
|
| 406 | 447 | } |
| 407 | - else $group_list = array(); |
|
| 408 | 448 | } |
| 409 | 449 | |
| 410 | 450 | // Get xml information for looping DB list |
| 411 | - if(!is_array($db_list)) $db_list = array($db_list); |
|
| 451 | + if(!is_array($db_list)) { |
|
| 452 | + $db_list = array($db_list); |
|
| 453 | + } |
|
| 412 | 454 | $component_list = new stdClass(); |
| 413 | 455 | foreach($db_list as $component) |
| 414 | 456 | { |
| 415 | - if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) continue; |
|
| 457 | + if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) { |
|
| 458 | + continue; |
|
| 459 | + } |
|
| 416 | 460 | |
| 417 | 461 | $component_name = $component->component_name; |
| 418 | - if(!$component_name) continue; |
|
| 462 | + if(!$component_name) { |
|
| 463 | + continue; |
|
| 464 | + } |
|
| 419 | 465 | |
| 420 | - if(!in_array($component_name, $downloaded_list)) continue; |
|
| 466 | + if(!in_array($component_name, $downloaded_list)) { |
|
| 467 | + continue; |
|
| 468 | + } |
|
| 421 | 469 | |
| 422 | 470 | unset($xml_info); |
| 423 | 471 | $xml_info = $oEditorModel->getComponentXmlInfo($component_name); |
@@ -471,8 +519,12 @@ discard block |
||
| 471 | 519 | // Get buttons, icons, images |
| 472 | 520 | $icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/icon.gif'; |
| 473 | 521 | $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; |
|
| 522 | + if(file_exists($icon_file)) { |
|
| 523 | + $component_list->{$component_name}->icon = true; |
|
| 524 | + } |
|
| 525 | + if(file_exists($component_icon_file)) { |
|
| 526 | + $component_list->{$component_name}->component_icon = true; |
|
| 527 | + } |
|
| 476 | 528 | } |
| 477 | 529 | |
| 478 | 530 | // Return if it checks enabled only |
@@ -487,9 +539,13 @@ discard block |
||
| 487 | 539 | // Get xml_info of downloaded list |
| 488 | 540 | foreach($downloaded_list as $component_name) |
| 489 | 541 | { |
| 490 | - if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) continue; |
|
| 542 | + if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) { |
|
| 543 | + continue; |
|
| 544 | + } |
|
| 491 | 545 | // Pass if configured |
| 492 | - if($component_list->{$component_name}) continue; |
|
| 546 | + if($component_list->{$component_name}) { |
|
| 547 | + continue; |
|
| 548 | + } |
|
| 493 | 549 | // Insert data into the DB |
| 494 | 550 | $oEditorController = getAdminController('editor'); |
| 495 | 551 | $oEditorController->insertComponent($component_name, false, $site_srl); |