ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
ilMathJaxSetupConfig Class Reference
+ Inheritance diagram for ilMathJaxSetupConfig:
+ Collaboration diagram for ilMathJaxSetupConfig:

Public Member Functions

 __construct (array $data)
 Create the config fron a data array. More...
 
 getConfig ()
 Get the MathJaxConfig object which is created from the data in config.json. More...
 
 getDataFromConfig (ilMathJaxConfig $config)
 Get a data array from a config. More...
 
 isApplicableTo (ilMathJaxConfig $config)
 Check if the setup config can be applied to an existing stored config Only the values that are actually defined in the config.json will be applied The setup config is applicable if at least one setting in config.json is defined and differs fron the stored config. More...
 
 applyTo (ilMathJaxConfig $config)
 Apply the setup config to an existing stored config Only the values that are actually defined in the config.json will be applied. More...
 

Protected Attributes

array $data = []
 
ilMathJaxConfig $config
 

Detailed Description

Definition at line 23 of file class.ilMathJaxSetupConfig.php.

Constructor & Destructor Documentation

◆ __construct()

ilMathJaxSetupConfig::__construct ( array  $data)

Create the config fron a data array.

Definition at line 34 of file class.ilMathJaxSetupConfig.php.

35 {
36 $this->data = $data;
37
38 $this->config = new \ilMathJaxConfig(
39 (bool) ($this->data['client_enabled'] ?? false),
40 (string) ($this->data['client_polyfill_url'] ?? ''),
41 (string) ($this->data['client_script_url'] ?? ''),
42 (int) ($this->data['client_limiter'] ?? 0),
43 (bool) ($this->data['server_enabled'] ?? false),
44 (string) ($this->data['server_address'] ?? ''),
45 (int) ($this->data['server_timeout'] ?? 0),
46 (bool) ($this->data['server_for_browser'] ?? false),
47 (bool) ($this->data['server_for_export'] ?? false),
48 (bool) ($this->data['server_for_pdf'] ?? false)
49 );
50 }

References $data.

Member Function Documentation

◆ applyTo()

ilMathJaxSetupConfig::applyTo ( ilMathJaxConfig  $config)

Apply the setup config to an existing stored config Only the values that are actually defined in the config.json will be applied.

Definition at line 103 of file class.ilMathJaxSetupConfig.php.

104 {
105 if (isset($this->data['client_enabled'])) {
106 $config = $config->withClientEnabled($this->config->isClientEnabled());
107 }
108 if (isset($this->data['client_polyfill_url'])) {
109 $config = $config->withClientPolyfillUrl($this->config->getClintPolyfillUrl());
110 }
111 if (isset($this->data['client_script_url'])) {
112 $config = $config->withClientScriptUrl($this->config->getClientScriptUrl());
113 }
114 if (isset($this->data['client_limiter'])) {
115 $config = $config->withClientLimiter($this->config->getClientLimiter());
116 }
117 if (isset($this->data['server_enabled'])) {
118 $config = $config->withServerEnabled($this->config->isServerEnabled());
119 }
120 if (isset($this->data['server_address'])) {
121 $config = $config->withServerAddress($this->config->getServerAddress());
122 }
123 if (isset($this->data['server_timeout'])) {
124 $config = $config->withServerTimeout($this->config->getServerTimeout());
125 }
126 if (isset($this->data['server_for_browser'])) {
127 $config = $config->withServerForBrowser($this->config->isServerForBrowser());
128 }
129 if (isset($this->data['server_for_export'])) {
130 $config = $config->withServerForExport($this->config->isServerForExport());
131 }
132 if (isset($this->data['server_for_pdf'])) {
133 $config = $config->withServerForPdf($this->config->isServerForPdf());
134 }
135
136 return $config;
137 }
Global Mathjax configuration.
withServerEnabled(bool $server_enabled)
Enable a server side rendering engine configured and enabled.
withClientScriptUrl(string $client_async_url)
Set the url of Mathjax script to be embedded on the page (for MathJax 3)
withClientLimiter(int $client_limiter)
Set the type of enclosing limiters for wich the embedded client-side Mathjax is configured.
withClientPolyfillUrl(string $client_js_url)
Set the url of a polyfill script neededby MathJax 3.
withServerAddress(string $server_address)
Set the url of the Mathjax server.
withClientEnabled(bool $client_enabled)
Enable latex code bing rendered in the browser.
withServerTimeout(int $server_timeout)
Set the timeout (s) to wait for the result of the rendering server.
withServerForPdf(bool $server_for_pdf)
Enable the server-side rendingeing for PDF generation.
withServerForBrowser(bool $server_for_browser)
Enable the server-side rendingeing for browser output.
withServerForExport(bool $server_for_export)
Enable the server-side rendingeing for HTML exports.

References $config, ilMathJaxConfig\withClientEnabled(), ilMathJaxConfig\withClientLimiter(), ilMathJaxConfig\withClientPolyfillUrl(), ilMathJaxConfig\withClientScriptUrl(), ilMathJaxConfig\withServerAddress(), ilMathJaxConfig\withServerEnabled(), ilMathJaxConfig\withServerForBrowser(), ilMathJaxConfig\withServerForExport(), ilMathJaxConfig\withServerForPdf(), and ilMathJaxConfig\withServerTimeout().

+ Here is the call graph for this function:

◆ getConfig()

ilMathJaxSetupConfig::getConfig ( )

Get the MathJaxConfig object which is created from the data in config.json.

Returns
ilMathJaxConfig

Definition at line 56 of file class.ilMathJaxSetupConfig.php.

57 {
58 return $this->config;
59 }

References $config.

◆ getDataFromConfig()

ilMathJaxSetupConfig::getDataFromConfig ( ilMathJaxConfig  $config)

Get a data array from a config.

Definition at line 64 of file class.ilMathJaxSetupConfig.php.

64 : array
65 {
66 return [
67 'client_enabled' => $config->isClientEnabled(),
68 'client_polyfill_url' => $config->getClintPolyfillUrl(),
69 'client_script_url' => $config->getClientScriptUrl(),
70 'client_limiter' => $config->getClientLimiter(),
71 'server_enabled' => $config->isServerEnabled(),
72 'server_address' => $config->getServerAddress(),
73 'server_timeout' => $config->getServerTimeout(),
74 'server_for_browser' => $config->isServerForBrowser(),
75 'server_for_export' => $config->isServerForExport(),
76 'server_for_pdf' => $config->isServerForPdf()
77 ];
78 }
getClientLimiter()
Type of enclosing limiters for wich the embedded client-side Mathjax is configured.
getServerTimeout()
timeout (s) to wait for the result of the rendering server
isServerForBrowser()
Should the server-side rendingeing be used for browser output.
isServerForPdf()
Should the server-side rendingeing be used for PDF generation.
getServerAddress()
Url of Mathjax server.
isServerEnabled()
Is a server side rendering engine configured and enabled.
isServerForExport()
Should the server-side rendingeing be used for HTML exports.
getClientScriptUrl()
Url of Mathjax script to be embedded with script tag on the page.
getClintPolyfillUrl()
Url of a javascript polyfill (needed by MathJax 3)
isClientEnabled()
Should latex code be rendered in the browser.

References $config, ilMathJaxConfig\getClientLimiter(), ilMathJaxConfig\getClientScriptUrl(), ilMathJaxConfig\getClintPolyfillUrl(), ilMathJaxConfig\getServerAddress(), ilMathJaxConfig\getServerTimeout(), ilMathJaxConfig\isClientEnabled(), ilMathJaxConfig\isServerEnabled(), ilMathJaxConfig\isServerForBrowser(), ilMathJaxConfig\isServerForExport(), and ilMathJaxConfig\isServerForPdf().

+ Here is the call graph for this function:

◆ isApplicableTo()

ilMathJaxSetupConfig::isApplicableTo ( ilMathJaxConfig  $config)

Check if the setup config can be applied to an existing stored config Only the values that are actually defined in the config.json will be applied The setup config is applicable if at least one setting in config.json is defined and differs fron the stored config.

Definition at line 85 of file class.ilMathJaxSetupConfig.php.

85 : bool
86 {
87 return isset($this->data['client_enabled']) && $this->config->isClientEnabled() !== $config->isClientEnabled()
88 || isset($this->data['client_polyfill_url']) && $this->config->getClintPolyfillUrl() !== $config->getClintPolyfillUrl()
89 || isset($this->data['client_script_url']) && $this->config->getClientScriptUrl() !== $config->getClientScriptUrl()
90 || isset($this->data['client_limiter']) && $this->config->getClientLimiter() !== $config->getClientLimiter()
91 || isset($this->data['server_enabled']) && $this->config->isServerEnabled() !== $config->isServerEnabled()
92 || isset($this->data['server_address']) && $this->config->getServerAddress() !== $config->getServerAddress()
93 || isset($this->data['server_timeout']) && $this->config->getServerAddress() !== $config->getServerAddress()
94 || isset($this->data['server_for_browser']) && $this->config->isServerForBrowser() !== $config->isServerForBrowser()
95 || isset($this->data['server_for_export']) && $this->config->isServerForExport() !== $config->isServerForExport()
96 || isset($this->data['server_for_pdf']) && $this->config->isServerForPdf() !== $config->isServerForPdf();
97 }

References $config, ilMathJaxConfig\getClientLimiter(), ilMathJaxConfig\getClientScriptUrl(), ilMathJaxConfig\getClintPolyfillUrl(), ilMathJaxConfig\getServerAddress(), ilMathJaxConfig\isClientEnabled(), ilMathJaxConfig\isServerEnabled(), ilMathJaxConfig\isServerForBrowser(), ilMathJaxConfig\isServerForExport(), and ilMathJaxConfig\isServerForPdf().

+ Here is the call graph for this function:

Field Documentation

◆ $config

ilMathJaxConfig ilMathJaxSetupConfig::$config
protected

◆ $data

array ilMathJaxSetupConfig::$data = []
protected

Definition at line 26 of file class.ilMathJaxSetupConfig.php.

Referenced by __construct().


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