CMS  Version 3.9
HtmlEditorManager Class Reference

Provides a central management class for event handlers and common functionality for the html_editor component. More...

Public Member Functions

 HtmlEditorManager ()
 

Static Public Member Functions

static registerPlugin ($title, $plugin)
 
static registerAdditionalPlugin ($title, $plugin)
 
static registerActionFilter ($filter)
 
static upgradeComponent ($version)
 
static setDefaults ()
 
static registerSerializationHandler ()
 
static onInitialize ()
 
static handleActionFilters ($context)
 
static applyCustomCSS ($template)
 
static formatSnippetParameters ($snippet)
 

Static Public Attributes

static $plugins = array()
 
static $additionalPlugins = array()
 
static $actionFilters = array()
 

Detailed Description

Provides a central management class for event handlers and common functionality for the html_editor component.

Definition at line 12 of file html_editor_manager.inc.

Member Function Documentation

◆ applyCustomCSS()

static HtmlEditorManager::applyCustomCSS (   $template)
static

Definition at line 91 of file html_editor_manager.inc.

92  {
93  if (Settings::getValue("html_editor", "enable_custom_css"))
94  {
95  $template = str_replace("</head>", " <link href='/action/html_editor/custom_css' rel='stylesheet'/>\n</head>", $template);
96  }
97  return $template;
98  }
static getValue($component, $name)
Retrieve the value of the specified Setting.
Definition: settings.inc:104

◆ formatSnippetParameters()

static HtmlEditorManager::formatSnippetParameters (   $snippet)
static

Definition at line 100 of file html_editor_manager.inc.

101  {
102  $matches = array();
103  if (preg_match_all("/{([^}]+)}/", $snippet->snippet, $matches, PREG_PATTERN_ORDER))
104  {
105  $fields = array_unique($matches[1]);
106 
107  ?>
108  <h4>Snippet Parameters</h4>
109  <table class='form' id='snippet_parameters'>
110 
111  <?
112  foreach($fields as $field)
113  {
114  ?>
115  <tr><td class='label'><label><?echo $field?></label></td>
116  <td class='value'><input type='text' name='<?echo $field?>' class='snippet_parameter' id='snippet_parameter_{$i}' value='' size='75'/></td></tr>
117  <?
118  }
119  ?>
120  </table>
121  <br/>
122  <?
123  }
124  }
$imageUpload size
Definition: image_form.inc:68
$snippet
Definition: snippet.inc:7

◆ handleActionFilters()

static HtmlEditorManager::handleActionFilters (   $context)
static

Definition at line 82 of file html_editor_manager.inc.

83  {
84  foreach(HTMLEditorManager::$actionFilters as $filter)
85  {
86  $context = $filter($context);
87  }
88  return $context;
89  }
$filter
Definition: update.inc:44

◆ HtmlEditorManager()

HtmlEditorManager::HtmlEditorManager ( )

Definition at line 18 of file html_editor_manager.inc.

19  {
20 
21  }

◆ onInitialize()

static HtmlEditorManager::onInitialize ( )
static

Definition at line 59 of file html_editor_manager.inc.

60  {
61  global $tiny_mce_application_plugins;
62  global $tiny_mce_application_toolbar_section;
63  global $tiny_mce_application_context_menu_section;
64  global $tiny_mce_content_css;
65  global $tiny_mce_body_class;
66 
67  ComponentManager::fireEvent("RegisterHTMLEditorPlugins");
68  ComponentManager::fireEvent("RegisterHTMLEditorActionFilters");
69 
70  $tiny_mce_application_plugins = implode(",", array_keys(HtmlEditorManager::$plugins));
71  $tiny_mce_application_toolbar_section = implode(" ", array_keys(HtmlEditorManager::$plugins)) . " |";
72  $tiny_mce_application_context_menu_section = implode(" ", array_keys(HtmlEditorManager::$plugins)) . " |";
73  $tiny_mce_content_css = Settings::getValue("html_editor", "CSS_files");
74  $tiny_mce_body_class = Settings::getValue("html_editor", "body_class");
75 
76  if (count(HtmlEditorManager::$actionFilters) > 0)
77  {
78  HTMLFieldRenderer::$actionFilter = 'HTMLEditorManager::handleActionFilters';
79  }
80  }
static fireEvent($event, $parameter=null, $mustBeConsumed=false)
Fire an event to all subscribers as detailed in their manifests.

◆ registerActionFilter()

static HtmlEditorManager::registerActionFilter (   $filter)
static

Definition at line 33 of file html_editor_manager.inc.

34  {
36  }

◆ registerAdditionalPlugin()

static HtmlEditorManager::registerAdditionalPlugin (   $title,
  $plugin 
)
static

Definition at line 28 of file html_editor_manager.inc.

29  {
31  }

◆ registerPlugin()

static HtmlEditorManager::registerPlugin (   $title,
  $plugin 
)
static

Definition at line 23 of file html_editor_manager.inc.

24  {
26  }

◆ registerSerializationHandler()

static HtmlEditorManager::registerSerializationHandler ( )
static

Definition at line 53 of file html_editor_manager.inc.

54  {
56  return true;
57  }
registerHandler($component, $title, $handler)
Registers a serialization handler for a component.
Provides a simple implementation of a SerializationHandler that can serialize a single DataItem class...

◆ setDefaults()

static HtmlEditorManager::setDefaults ( )
static

Definition at line 44 of file html_editor_manager.inc.

45  {
46  Settings::setDefaultValue("html_editor", "CSS_files", "", Text, "List of CSS files to apply within the editor. Put each CSS file on a separate line.", "Appearance");
47  Settings::setDefaultValue("html_editor", "body_class", "", String, "Body class to be applied to content within the editor - use this to override inappropriate styles", "Appearance");
48 
49  Settings::setDefaultValue("html_editor", "enable_custom_CSS", false, Boolean, "", "Custom CSS", null, 1);
50  Settings::setDefaultValue("html_editor", "custom_CSS", "", Text, "This setting can be used to provide custom CSS styles, configurable from the HTML editor. A link tag to /action/html_editor/custom_styles must be added to your site's template files.", "Custom CSS", null, 2);
51  }
static setDefaultValue($component, $name, $value, $field_type="String", $annotation="", $category="", $options="", $weight=0)
Sets the default value of the given component setting.
Definition: settings.inc:174

◆ upgradeComponent()

static HtmlEditorManager::upgradeComponent (   $version)
static

Definition at line 38 of file html_editor_manager.inc.

39  {
41  $mgr->upgrade($version);
42  }

Member Data Documentation

◆ $actionFilters

HtmlEditorManager::$actionFilters = array()
static

Definition at line 16 of file html_editor_manager.inc.

◆ $additionalPlugins

HtmlEditorManager::$additionalPlugins = array()
static

Definition at line 15 of file html_editor_manager.inc.

◆ $plugins

HtmlEditorManager::$plugins = array()
static

Definition at line 14 of file html_editor_manager.inc.


The documentation for this class was generated from the following file: