private function createAndSaveAccessibilityText($config, $accessibilityTextPath, $data) { $url = wrs_getImageServiceURL($config, 'mathml2accessible'); $response = wrs_getContents($config, $url, $data); if (is_null($response)) { return false; } if (!is_file($accessibilityTextPath) && file_put_contents($accessibilityTextPath, $response) === false) { throw new Exception('Unable to create accessibility text file.'); } return true; }
// any later version. // // WIRIS Plugin is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with WIRIS Plugin. If not, see <http://www.gnu.org/licenses/>. // require_once 'bootstrap.php'; include 'libwiris.php'; if (isset($_POST['service'])) { global $config; $config = wrs_loadConfig(WRS_CONFIG_FILE); $url = wrs_getImageServiceURL($config, $_POST['service']); $data = array(); foreach ($_POST as $key => $value) { if ($key != 'service') { $data[$key] = $value; } } $response = wrs_getContents($config, $url, $data); if ($response !== false) { echo $response; } else { echo 'Error: the service is unavailable.'; } } else { echo 'Error: undefined service.'; }
function createImage($config, $formulaPath, $formulaPathExtension, $useParams) { $configAndFonts = $formulaPathExtension == 'ini' ? getConfigurationAndFontsFromIni($config, $formulaPath . '.ini') : getConfigurationAndFonts($config, $formulaPath . '.xml'); if ($configAndFonts !== false) { $config = $configAndFonts['config']; // Retrocompatibility: when wirisimagenumbercolor is not defined if (!isset($config['wirisimagenumbercolor']) && isset($config['wirisimagesymbolcolor'])) { $config['wirisimagenumbercolor'] = $config['wirisimagesymbolcolor']; } // Retrocompatibility: when wirisimageidentcolor is not defined if (!isset($config['wirisimageidentcolor']) && isset($config['wirisimagesymbolcolor'])) { $config['wirisimageidentcolor'] = $config['wirisimagesymbolcolor']; } // Converting configuration to parameters. global $wrs_imageConfigProperties; $properties = array('mml' => $configAndFonts['mathml']); foreach ($wrs_imageConfigProperties as $serverParam => $configKey) { if (isset($config[$configKey])) { $properties[$serverParam] = trim($config[$configKey]); } } // Converting fonts to parameters. if (isset($config['wirisimagefontranges'])) { $carry = count($configAndFonts['fonts']); $fontRanges = explode(',', $config['wirisimagefontranges']); $fontRangesCount = count($fontRanges); $j = 0; for ($i = 0; $i < $fontRangesCount; ++$i) { $rangeName = trim($fontRanges[$i]); if (isset($config[$rangeName])) { $configAndFonts['fonts']['font' . ($carry + $j)] = trim($config[$rangeName]); ++$j; } } } // User params. if ($useParams) { global $wrs_xmlFileAttributes; foreach ($_GET as $key => $value) { if (in_array($key, $wrs_xmlFileAttributes) || substr($key, 0, 4) == 'font') { $properties[$key] = $value; } } } // Query. $response = wrs_getContents($config, wrs_getImageServiceURL($config, NULL), array_merge($configAndFonts['fonts'], $properties)); if ($response === false) { return null; } return $response; } return null; }
} else { $i++; } $confVal = $config[$value]; $confVal = str_replace('\\', '\\\\', $confVal); $confVal = str_replace('\'', '\\\'', $confVal); $attr .= '\'' . $key . '\' : \'' . $confVal . '\''; } } if ($i > 0) { $attr = '<script type="text/javascript">window.wrs_attributes = {' . $attr . '};</script>' . "\n"; echo $attr; } ?> <script type="text/javascript" src="<?php echo wrs_getImageServiceURL($config, 'editor') . '?lang=' . rawurlencode($config['wirisformulaeditorlang']); ?> "></script> <script type="text/javascript" src="../core/editor.js"></script> <script type="text/javascript" src="<?php echo '../lang/' . $config['wirisformulaeditorlang'] . '/strings.js'; ?> "></script> <title>WIRIS editor</title> <style type="text/css"> /*<!--*/ html, body, #container { height: 100%;