diff --git a/conf/config-defaults.php b/conf/config-defaults.php index 499c654228b..0cfba855575 100755 --- a/conf/config-defaults.php +++ b/conf/config-defaults.php @@ -81,6 +81,7 @@ $Configuration['Garden']['Thumbnail']['Size'] = 50; $Configuration['Garden']['Menu']['Sort'] = array('Dashboard', 'Discussions', 'Activity', 'Conversations', 'User'); $Configuration['Garden']['InputFormatter'] = 'Html'; +$Configuration['Garden']['Html']['nl2br'] = TRUE; // Default Preferences $Configuration['Preferences']['Email']['ConversationMessage'] = '1'; diff --git a/library/core/class.controller.php b/library/core/class.controller.php index 25dc41fcad5..5bbd9dd7136 100755 --- a/library/core/class.controller.php +++ b/library/core/class.controller.php @@ -375,13 +375,41 @@ public function AddDefinition($Term, $Definition = NULL) { /** * Adds a JS file to search for in the application or global js folder(s). * - * @param string $FileName The CSS file to search for. + * @param string $FileName The JS file to search for. * @param string $AppFolder The application folder that should contain the JS file. Default is to * use the application folder that this controller belongs to. */ public function AddJsFile($FileName, $AppFolder = '') { $this->_JsFiles[] = array('FileName' => $FileName, 'AppFolder' => $AppFolder); } + + /** + * Removes a CSS file to search for in the theme folder(s). + * + * @param string $FileName The CSS file to search for. + * @param string $AppFolder The application folder that should contain the CSS file. Default is to + * use the application folder that this controller belongs to. + */ + public function RemoveCssFile($FileName, $AppFolder = '') { + $keys = array_keys($this->_CssFiles, array('FileName' => $FileName, 'AppFolder' => $AppFolder)); + foreach($keys as $key) { + unset($this->_CssFiles[$key]); + } + } + + /** + * Removes a JS file to search for in the application or global js folder(s). + * + * @param string $FileName The JS file to search for. + * @param string $AppFolder The application folder that should contain the JS file. Default is to + * use the application folder that this controller belongs to. + */ + public function RemoveJsFile($FileName, $AppFolder = '') { + $keys = array_keys($this->_JsFiles, array('FileName' => $FileName, 'AppFolder' => $AppFolder)); + foreach($keys as $key) { + unset($this->_JsFiles[$key]); + } + } /** * Adds the specified module to the specified asset target. If no asset diff --git a/library/core/class.format.php b/library/core/class.format.php index 7ebebed19c3..a58202c3441 100644 --- a/library/core/class.format.php +++ b/library/core/class.format.php @@ -235,8 +235,10 @@ public static function Html($Mixed) { $Mixed ); - // nl2br - $Mixed = preg_replace("/(\015\012)|(\015)|(\012)/", "
", $Mixed); + if(Gdn::Config('Garden.Html.nl2br', TRUE)) { + // nl2br + $Mixed = preg_replace("/(\015\012)|(\015)|(\012)/", "
", $Mixed); + } return $Formatter->Format($Mixed); } diff --git a/library/core/interface.iplugin.php b/library/core/interface.iplugin.php index d91f5b2401a..596b8f2aa66 100755 --- a/library/core/interface.iplugin.php +++ b/library/core/interface.iplugin.php @@ -28,7 +28,7 @@ * them. * * @package Garden - * @todo Could it include a Disable and Uninstall method? (from damien) + * @todo Document the existence of OnDisable & CleanUp function calls (optional so they don't appear here) */ interface Gdn_IPlugin { diff --git a/plugins/CKEditor/default.php b/plugins/CKEditor/default.php index 30dd4e5c6bb..d9da11250e8 100644 --- a/plugins/CKEditor/default.php +++ b/plugins/CKEditor/default.php @@ -29,9 +29,16 @@ public function Base_Render_Before(&$Sender) { $Sender->AddJsFile('/plugins/CKEditor/ckeditor/ckeditor.js'); $Sender->AddJsFile('/plugins/CKEditor/ckeditor/adapters/jquery.js'); $Sender->AddJsFile('/plugins/CKEditor/start.js'); + $Sender->RemoveJsFile('js/library/jquery.autogrow.js'); $Sender->RemoveJsFile('/js/library/jquery.autogrow.js'); - $Sender->RemoveJsFile('autosave.js'); + $Sender->RemoveJsFile('post.js'); + //$Sender->RemoveJsFile('autosave.js'); + } + + public function DiscussionController_BeforeDiscussionRender_Handler(&$Sender) { + $Sender->RemoveJsFile('discussion.js'); + $Sender->AddJsFile('/plugins/CKEditor/discussion.js'); } /* Adding CKEditor settings link to side menu */