本文整理汇总了PHP中CMbString::purifyHTML方法的典型用法代码示例。如果您正苦于以下问题:PHP CMbString::purifyHTML方法的具体用法?PHP CMbString::purifyHTML怎么用?PHP CMbString::purifyHTML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMbString
的用法示例。
在下文中一共展示了CMbString::purifyHTML方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filter
/**
* @see parent::filter()
*/
function filter($value)
{
if (CAppUI::conf("purify_text_input")) {
$value = CMbString::purifyHTML($value);
}
return parent::filter($value);
}
示例2: CPlanningWeekNew
$calendar = new CPlanningWeekNew($date, $week_monday, $week_sunday);
break;
}
$calendar->guid = "CPlanning-{$mode}-{$date}";
$calendar->title = "Astreintes-{$mode}-{$date}";
$astreintes = $astreinte->loadList($where, $order);
/** @var $astreintes CPlageAstreinte[] */
foreach ($astreintes as $_astreinte) {
$length = CMbDT::minutesRelative($_astreinte->start, $_astreinte->end);
//not in the current group
$_astreinte->loadRefUser();
$_astreinte->loadRefColor();
$libelle = "<span style=\"text-align:center;\">";
$libelle .= $_astreinte->libelle ? "<strong>{$_astreinte->libelle}</strong><br/>" : null;
$libelle .= $_astreinte->_ref_user . '<br/>' . $_astreinte->phone_astreinte . "</span>";
$libelle = CMbString::purifyHTML($libelle);
$plage = new CPlanningEvent($_astreinte->_guid, $_astreinte->start, $length, $libelle, "#" . $_astreinte->_color, true, 'astreinte', false, false);
$plage->setObject($_astreinte);
$plage->plage["id"] = $_astreinte->_id;
$plage->type = $_astreinte->type;
$plage->end = $_astreinte->end;
$plage->display_hours = true;
if ($_astreinte->getPerm(PERM_EDIT)) {
$plage->addMenuItem("edit", utf8_encode("Modifier l'astreinte"));
}
//add the event to the planning
$calendar->addEvent($plage);
}
$calendar->hour_min = "00";
$calendar->rearrange();
//smarty
示例3: purifyHTML
/**
* Purify a HTML string without deleting the embedded image
*
* @param string $html The HTML code to purify
*
* @return string
*/
public static function purifyHTML($html)
{
$matches = array();
$embedded_images = array();
/* We replace the img tags by div tags,
* because HTMLPurifier remove the img tag of the embedded images
*/
if (preg_match_all('#<img[^>]*>#i', $html, $matches)) {
foreach ($matches[0] as $_key => $_img) {
$embedded_images[$_key] = $_img;
/* We close the unclosed img tags */
if (strpos($_img, '/>') === false) {
$embedded_images[$_key] = str_replace('>', '/>', $_img);
}
$html = str_replace($_img, "<div class=\"image-{$_key}\"></div>", $html);
}
}
$html = CMbString::purifyHTML($html);
$search = array();
/* The div tags are replaced by the img tags*/
foreach ($embedded_images as $index => $img) {
$search[$index] = "<div class=\"image-{$index}\"></div>";
}
return str_replace($search, $embedded_images, $html);
}
示例4: purify
/**
* HTML input cleaner
*
* @param string $html HTML input
*
* @return string
*/
function purify($html)
{
return CMbString::purifyHTML($html);
}
示例5: updatePlainFields
/**
* @see parent::updatePlainFields()
*/
function updatePlainFields()
{
parent::updatePlainFields();
$this->translation = CMbString::purifyHTML($this->translation);
}
示例6:
$show_editor = false;
$display_as_is = true;
break;
}
case "text/ami-patient-text":
if (class_exists("CAMIDocument")) {
$includeInfosFile = CAMIDocument::toHTML($raw_content);
$show_editor = false;
$display_as_is = true;
break;
}
case "text/plain":
$includeInfosFile = "<pre>" . CMbString::htmlSpecialChars($raw_content) . "</pre>";
break;
case "text/html":
$includeInfosFile = CMbString::purifyHTML($raw_content);
$show_editor = false;
$display_as_is = true;
break;
}
}
if ($fileSel->isPDFconvertible()) {
$isConverted = true;
$fileconvert = $fileSel->loadPDFconverted();
$success = 1;
if (!$fileconvert->_id) {
$success = $fileSel->convertToPDF();
}
if ($success == 1) {
$fileconvert = $fileSel->loadPDFconverted();
$fileconvert->loadNbPages();
示例7: stepAjax
/**
* Display an AJAX step, and exit on error messages
*
* @param string $msg The internationalized message
* @param int $type [optional] Message type as a UI constant
* @param mixed $_ [optional] Any number of printf-like parameters to be applied
*
* @return void
* @todo Switch parameter order, like stepMessage()
* @todo Rename to ajaxNsg()
*/
static function stepAjax($msg, $type = UI_MSG_OK, $_ = null)
{
$args = func_get_args();
$msg = CAppUI::tr($msg, array_slice($args, 2));
$msg = CMbString::purifyHTML($msg);
$class = self::getErrorClass($type);
echo "\n<div class='{$class}'>{$msg}</div>";
if ($type == UI_MSG_ERROR) {
CApp::rip();
}
}
示例8: array
* @subpackage developpement
* @author SARL OpenXtrem <dev@openxtrem.com>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision: 20204 $
*/
CCanDo::checkAdmin();
$name_canonical = CValue::post("name_canonical");
$name_short = CValue::post("name_short");
$name_long = CValue::post("name_long");
$license = CValue::post("license");
$licenses = array("GNU GPL" => "GNU General Public License, see http://www.gnu.org/licenses/gpl.html", "OXOL" => "OXOL, see http://www.mediboard.org/public/OXOL");
$license = CValue::read($licenses, $license, $licenses["GNU GPL"]);
// Only alphanumeric caracters
$name_canonical = preg_replace("/[^\\w\\s]/", "", $name_canonical);
$name_short = CMbString::purifyHTML($name_short);
$name_long = CMbString::purifyHTML($name_long);
if (is_dir("modules/{$name_canonical}")) {
CAppui::stepAjax("Module '{$name_canonical}' existe déjà", UI_MSG_ERROR);
}
$zip_path = "dev/sample_module.zip";
$destination = "tmp/sample_module";
if (false == ($files_count = CMbPath::extract($zip_path, $destination))) {
CAppui::stepAjax("Impossible d'extraire l'archive '{$zip_path}'</div>", UI_MSG_ERROR);
}
rename("{$destination}/sample_module", "{$destination}/{$name_canonical}");
$path = "{$destination}/{$name_canonical}";
$files = array_merge(glob("{$path}/*"), glob("{$path}/classes/*"), glob("{$path}/locales/*"), glob("{$path}/templates/*"));
$translate = array('{NAME_CANONICAL}' => $name_canonical, '{NAME_SHORT}' => $name_short, '{NAME_LONG}' => $name_long, '{LICENSE}' => $license);
foreach ($files as $_file) {
if (is_dir($_file)) {
continue;
示例9: CMbConfig
$translateModule = new CMbConfig();
$translateModule->sourcePath = null;
// Ecriture du fichier
$translateModule->options = array("name" => "locales");
if ($module_name != "common") {
$translateModule->targetPath = "modules/{$module_name}/locales/{$language}.php";
} else {
$translateModule->targetPath = "locales/{$language}/common.php";
}
$translateModule->sourcePath = $translateModule->targetPath;
if (!is_file($translateModule->targetPath)) {
CMbPath::forceDir(dirname($translateModule->targetPath));
file_put_contents($translateModule->targetPath, '<?php $locales["module-' . $module_name . '-court"] = "' . $module_name . '";');
}
$translateModule->load();
foreach ($strings as $key => $valChaine) {
if ($valChaine !== "") {
$translateModule->values[$key] = CMbString::purifyHTML(stripslashes($valChaine));
} else {
unset($translateModule->values[$key]);
}
}
uksort($translateModule->values, "strnatcmp");
$error = $translateModule->update($translateModule->values, false);
SHM::remKeys("locales-{$language}-*");
if ($error instanceof PEAR_Error) {
CAppUI::setMsg("Error while saving locales file : {$error->message}", UI_MSG_ERROR);
} else {
CAppUI::setMsg("Locales file saved", UI_MSG_OK);
redirect();
}
示例10: extractFiles
extractFiles("serveurActivitePmsi_v{$version}", "schemaServeurActivitePmsi_v{$version}.zip", true);
break;
case "evt_serveurintervention":
$version = str_replace(".", "", $version);
extractFiles("serveurActivitePmsi_v{$version}", "schemaServeurActivitePmsi_v{$version}.zip", true);
break;
case "evt_patients":
$version = str_replace(".", "", $version);
extractFiles("patients", "schemaEvenementPatient_v{$version}.zip", true);
break;
case "evt_mvtStock":
$version = str_replace(".", "", $version);
extractFiles("mvtStock", "schemaEvenementMvtStock_v{$version}.zip", true);
break;
default:
echo "<div class='error'>Action '", CMbString::purifyHTML($evenement), "' inconnue</div>";
}
/**
* Extract files
*
* @param string $schemaDir Schema directory
* @param string $schemaFile Schema files
* @param bool $delOldDir Delete old directory
*
* @return void
*/
function extractFiles($schemaDir, $schemaFile, $delOldDir = false)
{
$baseDir = "modules/hprimxml/xsd";
$destinationDir = "{$baseDir}/{$schemaDir}";
$archivePath = "{$baseDir}/{$schemaFile}";
示例11:
<?php
/**
* $Id$
*
* Affiche le code xml du datatype choisi
*
* @category CDA
* @package Mediboard
* @author SARL OpenXtrem <dev@openxtrem.com>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @link http://www.mediboard.org */
$name = CValue::get("name");
echo CMbString::purifyHTML("<h1>{$name}</h1>");
echo CMbString::highlightCode("xml", CCdaTools::showNodeXSD($name, "modules/cda/resources/datatypes-base_original.xsd"));
示例12:
<?php
/* $Id $ */
/**
* @package Mediboard
* @subpackage hl7
* @version $Revision:$
* @author SARL OpenXtrem
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
*/
CCanDo::checkAdmin();
$path = CValue::get("path");
echo CMbString::purifyHTML("<h1>{$path}</h1>");
echo CMbString::highlightCode("xml", file_get_contents($path));