/**
  * Convert markdown text to HTML for preview
  *
  * @returns JSON encoded HTML output
  */
 public function actionPreview()
 {
     $output = '';
     $module = Config::getModule(Module::MODULE);
     if (isset($_POST['source'])) {
         $output = strlen($_POST['source']) > 0 ? Markdown::convert($_POST['source'], ['custom' => $module->customConversion]) : $_POST['nullMsg'];
     }
     echo Json::encode(HtmlPurifier::process($output));
 }
Example #2
0
 /**
  * Returns the tree view module
  *
  * @return Module
  */
 public static function module()
 {
     return Config::getModule(Module::MODULE);
 }
Example #3
0
 /**
  * Gets the module
  *
  * @param string $module the module name
  *
  * @return Module
  */
 public static function fetchModule($module = self::MODULE)
 {
     return Config::getModule($module);
 }
Example #4
0
 /**
  * Gets configuration for a widget from the module
  *
  * @param string $widget name of the widget
  * @return array
  */
 public function getConfig($widget)
 {
     $module = Config::getModule($this->moduleName);
     return isset($module->{$widget}) ? $module->{$widget} : [];
 }