本文整理汇总了PHP中strip_html函数的典型用法代码示例。如果您正苦于以下问题:PHP strip_html函数的具体用法?PHP strip_html怎么用?PHP strip_html使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strip_html函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: strip
/**
* Remove all HTML
*
* @param string $text HTML text
* @return string Plain text
**/
function strip( $text ) {
$text = preg_replace( preg_encoding( '/<script(.*?)<\/script>/s' ), '', $text );
$text = preg_replace( preg_encoding( '/<!--(.*?)-->/s' ), '', $text );
$text = str_replace( '>', '> ', $text ); // Makes the strip function look better
$text = wp_filter_nohtml_kses( $text );
$text = stripslashes( $text );
$text = preg_replace( preg_encoding( '/<!--(.*?)-->/s' ), '', $text );
$text = strip_html( $text ); // Remove all HTML
return $text;
}
示例2: testStripHtml
public function testStripHtml()
{
$s = 'hello ' . '<style>.box h1 {text-align:left;}</style>' . '<style type="text/css">.xxx</style>' . '<script>strip me</script>' . '<script language="text/javascript">strip me</script>' . 'world';
$this->assertEquals(strip_html($s), 'hello world');
$this->assertEquals(strip_html('hi<!--comment--> bye'), 'hi bye');
$s = '<!--[if gte mso 9]><x>val</x><![endif]--> res <br/>';
$this->assertEquals(strip_html($s), ' res ');
$s = '<!--[if gte mso 9]><w>0</w><![endif]
-->';
$this->assertEquals(strip_html($s), '');
$s = '<!-- c1 -->SHOULD_SHOW<!-- c2 -->ALWAYS_SHOWS';
$this->assertEquals(strip_html($s), 'SHOULD_SHOWALWAYS_SHOWS');
}
示例3: strip_html
function strip_html(&$data)
{
if (!is_array($data)) {
$data = strip_tags($data);
} else {
foreach ($data as &$v) {
if (is_array($v)) {
strip_html($v);
} else {
$v = strip_tags($v);
}
}
}
}
示例4: strip_html
break;
case "edit":
//editing
if (isset($id)) {
$id = (int) $id;
$edit_cl = CovingLetter::find_by_id_username($id, $user_id);
$edit_title = $edit_cl->cl_title;
$smarty->assign('cl_title', $edit_title);
$edit_text = $edit_cl->cl_text;
$smarty->assign('cl_text', $edit_text);
}
//edit buttn
if (isset($_POST['bt_cl_edit'])) {
//$id = $_POST['id'];
$covingletter->id = (int) $id;
$covingletter->cl_title = strip_html($_POST['txt_name']);
$covingletter->cl_text = strip_tags($_POST['txt_letter'], "\n\t");
$covingletter->fk_employer_id = $user_id;
if ($covingletter && $covingletter->save()) {
$session->message("<div class='success'>" . format_lang('success', 'cl_update_success') . "</div>");
redirect_to(BASE_URL . "covering_letter/");
} else {
$message = "<div class='error'> \r\n\t\t\t\t\t\t\t\t" . get_lang('following_errors') . "\r\n\t\t\t\t\t\t\t<ul> <li />";
$message .= join(" <li /> ", $covingletter->errors);
$message .= " </ul> \r\n\t\t\t\t\t\t\t</div>";
}
}
$html_title = SITE_NAME . " - " . ucfirst(format_lang('edit')) . $edit_title;
$smarty->assign('message', $message);
$smarty->assign('rendered_page', $smarty->fetch('edit_cover_letter.tpl'));
break;
示例5: return_url
<?php
$req = return_url();
$var_name = $req[1];
$jobs = new Job();
$job = $jobs->find_by_var_name($var_name);
$smarty->assign('job', $job);
$job_id = (int) $job->id;
if ($job && !empty($job)) {
$smarty->assign('job_title', safe_output(strip_html($job->job_title)));
$smarty->assign('job_description', subtrack_string(strip_html($job->job_description), 500));
$smarty->assign('created_at', safe_output(strftime(DATE_FORMAT, strtotime($job->created_at))));
$city = City::find_by_code($job->country, $job->state_province, $job->county, $job->city);
$city_name = empty($city) ? $job->city : $city->name;
$smarty->assign('location', $city_name);
}
if (isset($_POST['bt_send'])) {
$error = array();
/** SNED to email address and check for vaildation on entered emails */
$_SESSION['share']['send_to'] = $send_to = safe_output($_POST['txt_send_to1']);
if ($send_to == "") {
$error[] = format_lang('errormsg', 38);
}
if ($send_to != "") {
$send = split(",", $send_to);
for ($i = 0; $i < sizeof($send); $i++) {
$ch = check_email($send[$i]);
if ($ch == "") {
$error[] = format_lang('error', 'incorrect_format_email') . " - " . $send[$i];
}
}
示例6: get_terms
function get_terms($name, $source, $page, $removenumbers, $removequotations)
{
$page = convert_pdf($page);
print "{$source} document from " . htmlspecialchars($name) . " (" . strlen($page) . " characters";
$page_text = strip_html($page, $removenumbers, $removequotations);
// print ("page_text: $page_text\n");
$result = preg_split('/\\s+/', $page_text);
print ", " . count($result) . " words)<br/>";
return $result;
}
示例7: unset
$render .= $features[4] . "^";
//FEATURE5
$render .= $features[5] . "^";
//FEATURE6
$render .= $features[6] . "^";
//FEATURE7
$render .= $features[7] . "^";
//FEATURE8
$render .= $features[8] . "^";
//FEATURE9
$render .= $features[9] . "^";
//FEATURE10
unset($features);
$length = 300 - strlen($row['dea_strapline']);
// 300 is allowed, but i add (cont) so we use 294
$desc = strip_html($row['dea_description']);
$trimmed = preg_replace("/[\r\n]+[\\s\t]*[\r\n]+/", "", $desc);
$trimmed = str_replace("&#039;", "'", $trimmed);
$trimmed = str_replace("&amp;#039;", "'", $trimmed);
$trimmed = str_replace("&eacute;", "�", $trimmed);
$trimmed = substr($trimmed, 0, $length);
$render .= $row['dea_strapline'] . ": " . $trimmed . "^";
//SUMMARY
$longDescription = $row['dea_description'];
if ($row['total_area']) {
$longDescription .= "<p>Approximate Gross Internal Area: " . $row['total_area'] . " square metres</p>";
}
$longDescription .= "<p>For further information or to arrange a viewing, please contact our <b>" . $row['bra_title'] . " Branch</b> on <b>" . $row['bra_tel'] . ".</b></p>";
$longDescription .= "<p>Visit <b>www.woosterstock.co.uk</b> for full details, colour photos, maps and floor plans.</p>";
$longDescription .= "<p>We endeavour to make all our property particulars, descriptions, floor-plans, marketing and local information accurate and reliable but we make no guarantees as to the accuracy of this information. All measurements and dimensions are for guidance only and should not be considered accurate. If there is any point which is of particular importance to you we advise that you contact us to confirm the details; particularly if you are contemplating travelling some distance to view the property. Please note that we have not tested any services or appliances mentioned in property sales details.</p>";
$render .= preg_replace("/[\r\n]+[\\s\t]*[\r\n]+/", "", $longDescription) . "^";
示例8: update_order_details
function update_order_details(&$tpl, &$sql, $user_id, $order_id)
{
$domain = strtolower($_POST['domain']);
$domain = get_punny($domain);
$customer_id = strip_html($_POST['customer_id']);
$fname = strip_html($_POST['fname']);
$lname = strip_html($_POST['lname']);
$firm = strip_html($_POST['firm']);
$zip = strip_html($_POST['zip']);
$city = strip_html($_POST['city']);
$country = strip_html($_POST['country']);
$street1 = strip_html($_POST['street1']);
$street2 = strip_html($_POST['street2']);
$email = strip_html($_POST['email']);
$phone = strip_html($_POST['phone']);
$fax = strip_html($_POST['fax']);
$query = <<<SQL_QUERY
update
orders
set
domain_name=?,
\t\t\t\tcustomer_id=?,
fname=?,
lname=?,
firm=?,
zip=?,
city=?,
country=?,
email=?,
phone=?,
fax=?,
street1=?,
street2=?
where
id=?
\t\t\tand
\t\t\t\tuser_id=?
SQL_QUERY;
exec_query($sql, $query, array($domain, $customer_id, $fname, $lname, $firm, $zip, $city, $country, $email, $phone, $fax, $street1, $street2, $order_id, $user_id));
}
示例9: return_url
<?php
$req = return_url();
$var_name = $req[1];
$page = strip_html($var_name);
$sql = "Select * FROM " . TBL_PAGE . " WHERE pagekey='" . $page . "' ";
$result = $database->query($sql);
$page_ = $database->fetch_object($result);
if (!$page_ && !is_array($page_)) {
redirect_to(BASE_URL . 'page-unavailable/');
exit;
}
$smarty->assign('page', $page_);
$title = strip_html($page_->title);
$smarty->assign('title', $title);
$key = $page_->pagekey;
$pagetext = stripslashes($page_->pagetext);
$smarty->assign('pagetext', $pagetext);
$html_title = SITE_NAME . " - " . $title;
$smarty->assign('message', $message);
$smarty->assign('rendered_page', $smarty->fetch('page.tpl'));
示例10: cleanWebString
function cleanWebString($theMixed, $theLength = 0, $theSpacer = '')
{
$theResult = '';
$theMixed = (array) $theMixed;
foreach ($theMixed as $theString) {
$theString = (string) $theString;
if ($theString != '') {
$theString = strip_html($theString);
$theString = preg_replace('/' . WS . '' . WS . '+/', ' ', $theString);
$theString = preg_replace('/\\"/', '"', $theString);
$theString = preg_replace('/\'/', ''', $theString);
$theString = preg_replace('/\\>/', '>', $theString);
$theString = preg_replace('/\\</', '<', $theString);
$theString = trim($theString);
if ($theLength > 0) {
$add = '';
if ($theLength < strlen($theString)) {
$add = '...';
}
$theString = substr($theString, 0, $theLength) . $add;
}
if ($theString != '') {
if ($theResult != '') {
$theResult .= '. ';
}
$theString = makeSafeEntities($theString);
//
// $theString = str_ireplace('<','<',$theString);
// $theString = str_ireplace('>','>',$theString);
//
$theResult .= $theString;
}
}
}
return $theResult;
}
示例11: strftime
$apps[$i]['created_at'] = strftime(DATE_FORMAT, strtotime($job->created_at));
$apps[$i]['job_url'] = "job/" . $job->var_name . "/";
}
$apps[$i]['date_apply'] = strftime(DATE_FORMAT, strtotime($app->date_apply));
$apps[$i]['cover_letter'] = $app->cover_letter;
$apps[$i]['cv_name'] = $app->cv_name;
$apps[$i]['id'] = $app->id;
$i++;
}
$smarty->assign('application', $apps);
} else {
//$message = "<div class='error'>No application(s) found</div>";
}
if (isset($_GET['delete'])) {
if (isset($_GET['delete']) && isset($_GET['job_id']) && $_GET['delete'] == true) {
$jobhistory = new JobHistory();
$jobhistory->fk_employee_id = $user_id;
$jobhistory->fk_job_id = (int) $_GET['job_id'];
$jobhistory->id = (int) $_GET['id'];
if ($jobhistory->delete_job()) {
$session->message("<div class='success'>" . format_lang('success', 'app_delete_success') . "</div>");
redirect_to(BASE_URL . "applications/");
} else {
$message = "<div class='error'>" . format_lang('errormsg', 06) . "</div>";
}
}
}
$html_title = SITE_NAME . " - " . format_lang('page_title', 'my_app') . " " . strip_html($employee->full_name());
$smarty->assign('lang', $lang);
$smarty->assign('message', $message);
$smarty->assign('rendered_page', $smarty->fetch('application.tpl'));
示例12: edit_ticket
function edit_ticket($id)
{
/* post changes */
global $addrs, $NOTIFY_TICKET;
$post_frm_meridiem_problemstart = empty($_POST) || !empty($_POST) && empty($_POST['frm_meridiem_problemstart']) ? "" : $_POST['frm_meridiem_problemstart'];
$post_frm_meridiem_booked_date = empty($_POST) || !empty($_POST) && empty($_POST['frm_meridiem_booked_date']) ? "" : $_POST['frm_meridiem_booked_date'];
//10/1/09
$post_frm_affected = empty($_POST) || !empty($_POST) && empty($_POST['frm_affected']) ? "" : $_POST['frm_affected'];
$_POST['frm_description'] = strip_html($_POST['frm_description']);
//clean up HTML tags
$post_frm_affected = strip_html($post_frm_affected);
$_POST['frm_scope'] = strip_html($_POST['frm_scope']);
/* if (get_variable('reporting')) { // if any change do automatic action reporting
// if ($_POST[frm_affected] != $_POST[frm_affected_default]) report_action($GLOBALS[ACTION_AFFECTED],$_POST[frm_affected],0,$id);
if ($_POST[frm_severity] != $_POST[frm_severity_default]) report_action($GLOBALS[ACTION_SEVERITY],get_severity($_POST[frm_severity_default]),get_severity($_POST[frm_severity]),$id);
if ($_POST[frm_scope] != $_POST[frm_scope_default]) report_action($GLOBALS[ACTION_SCOPE],$_POST[frm_scope_default],0,$id);
}
*/
if (!get_variable('military_time')) {
//put together date from the dropdown box and textbox values
if ($post_frm_meridiem_problemstart == 'pm') {
$post_frm_meridiem_problemstart = ($post_frm_meridiem_problemstart + 12) % 24;
}
if (isset($_POST['frm_meridiem_booked_date'])) {
//10/1/09
if ($_POST['frm_meridiem_booked_date'] == 'pm') {
$_POST['frm_hour_booked_date'] = ($_POST['frm_hour_booked_date'] + 12) % 24;
}
}
// if ($_POST['frm_meridiem_problemend'] == 'pm') $_POST['frm_hour_problemend'] = ($_POST['frm_hour_problemend'] + 12) % 24;
}
if (empty($post_frm_owner)) {
$post_frm_owner = 0;
}
// $frm_problemstart = $_POST['frm_year_problemstart']-$_POST['frm_month_problemstart']-$_POST['frm_day_problemstart'] $_POST['frm_hour_problemstart']:$_POST['frm_minute_problemstart']:00";
$frm_problemstart = "{$_POST['frm_year_problemstart']}-{$_POST['frm_month_problemstart']}-{$_POST['frm_day_problemstart']} {$_POST['frm_hour_problemstart']}:{$_POST['frm_minute_problemstart']}:00{$post_frm_meridiem_problemstart}";
$curr_groups = $_POST['frm_exist_groups'];
// 6/10/11
$groups = "," . implode(',', $_POST['frm_group']) . ",";
// 6/10/11
// dump($_POST); // 6/10/11
if (!get_variable('military_time')) {
//put together date from the dropdown box and textbox values
if ($post_frm_meridiem_problemstart == 'pm') {
$_POST['frm_hour_problemstart'] = ($_POST['frm_hour_problemstart'] + 12) % 24;
}
if (isset($_POST['frm_meridiem_problemend'])) {
if ($_POST['frm_meridiem_problemend'] == 'pm') {
$_POST['frm_hour_problemend'] = ($_POST['frm_hour_problemend'] + 12) % 24;
}
}
if (isset($_POST['frm_meridiem_booked_date'])) {
//10/1/09
if ($_POST['frm_meridiem_booked_date'] == 'pm') {
$_POST['frm_hour_booked_date'] = ($_POST['frm_hour_booked_date'] + 12) % 24;
}
}
}
$frm_problemend = isset($_POST['frm_year_problemend']) ? quote_smart("{$_POST['frm_year_problemend']}-{$_POST['frm_month_problemend']}-{$_POST['frm_day_problemend']} {$_POST['frm_hour_problemend']}:{$_POST['frm_minute_problemend']}:00") : "NULL";
$frm_booked_date = isset($_POST['frm_year_booked_date']) ? quote_smart("{$_POST['frm_year_booked_date']}-{$_POST['frm_month_booked_date']}-{$_POST['frm_day_booked_date']} {$_POST['frm_hour_booked_date']}:{$_POST['frm_minute_booked_date']}:00") : "NULL";
//10/1/09
if ($_POST['frm_status'] != 1) {
$frm_problemend = "NULL";
}
// perform db update
$now = mysql_format_date(time() - get_variable('delta_mins') * 60);
$by = $_SESSION['user_id'];
// 12/7/10
if (empty($post_frm_owner)) {
$post_frm_owner = 0;
}
// 8/23/08, 9/20/08, 9/22/09 (Facility), 10/1/09 (receiving facility), 6/26/10 (911), 6/10/11
$query = "UPDATE `{$GLOBALS['mysql_prefix']}ticket` SET \n\t\t\t`contact`= " . quote_smart(trim($_POST['frm_contact'])) . ",\n\t\t\t`street`= " . quote_smart(trim($_POST['frm_street'])) . ",\n\t\t\t`city`= " . quote_smart(trim($_POST['frm_city'])) . ",\n\t\t\t`state`= " . quote_smart(trim($_POST['frm_state'])) . ",\n\t\t\t`phone`= " . quote_smart(trim($_POST['frm_phone'])) . ",\n\t\t\t`facility`= " . quote_smart(trim($_POST['frm_facility_id'])) . ",\n\t\t\t`rec_facility`= " . quote_smart(trim($_POST['frm_rec_facility_id'])) . ",\n\t\t\t`lat`= " . quote_smart(trim($_POST['frm_lat'])) . ",\n\t\t\t`lng`= " . quote_smart(trim($_POST['frm_lng'])) . ",\n\t\t\t`scope`= " . quote_smart(trim($_POST['frm_scope'])) . ",\n\t\t\t`owner`= " . quote_smart(trim($post_frm_owner)) . ",\n\t\t\t`severity`= " . quote_smart(trim($_POST['frm_severity'])) . ",\n\t\t\t`in_types_id`= " . quote_smart(trim($_POST['frm_in_types_id'])) . ",\n\t\t\t`status`=" . quote_smart(trim($_POST['frm_status'])) . ",\n\t\t\t`problemstart`=" . quote_smart(trim($frm_problemstart)) . ",\n\t\t\t`problemend`=" . $frm_problemend . ",\n\t\t\t`description`= " . quote_smart(trim($_POST['frm_description'])) . ",\n\t\t\t`comments`= " . quote_smart(trim($_POST['frm_comments'])) . ",\n\t\t\t`nine_one_one`= " . quote_smart(trim($_POST['frm_nine_one_one'])) . ",\n\t\t\t`booked_date`= \t\t{$frm_booked_date},\n\t\t\t`_by` = \t\t\t{$by}, \n\t\t\t`updated`='{$now}'\n\t\t\tWHERE ID='{$id}'";
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), __FILE__, __LINE__);
$list = $_POST['frm_exist_groups'];
// 6/10/11
$ex_grps = explode(',', $list);
// 6/10/11
if ($curr_groups != $groups) {
// 6/10/11
foreach ($_POST['frm_group'] as $posted_grp) {
// 6/10/11
if (!in_array($posted_grp, $ex_grps)) {
$tick_stat = $_POST['frm_status'];
$query = "INSERT INTO `{$GLOBALS['mysql_prefix']}allocates` (`group` , `type`, `al_as_of` , `al_status` , `resource_id` , `sys_comments` , `user_id`) VALUES \n\t\t\t\t\t\t\t({$posted_grp}, 1, '{$now}', {$tick_stat}, {$id}, 'Allocated to Group' , {$by})";
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
}
}
foreach ($ex_grps as $existing_grp) {
// 6/10/11
print $existing_grp;
if (in_array($existing_grp, get_allocates(4, $id))) {
if (!in_array($existing_grp, $_POST['frm_group'])) {
$query = "DELETE FROM `{$GLOBALS['mysql_prefix']}allocates` WHERE `type` = 1 AND `group` = '{$existing_grp}' AND `resource_id` = {$id}";
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
}
}
}
}
//.........这里部分代码省略.........
示例13: strip_html
$job_description = strip_html($jobs->job_description);
$job_description = subtrack_string($job_description, 800);
$city = City::find_by_code($jobs->country, $jobs->state_province, $jobs->county, $jobs->city);
$city_name = $city ? $city->name : $jobs->city;
$smarty->assign('jobs', $jobs);
$var_name = $jobs->var_name;
$smarty->assign('var_name', $jobs->var_name);
$smarty->assign('job_ref', strip_html($jobs->job_ref));
$smarty->assign('job_title', strip_html($jobs->job_title));
$smarty->assign('job_description', $job_description);
$smarty->assign('location', $city_name);
$smarty->assign('company_name', $company_name);
$smarty->assign('contact_name', $jobs->contact_name);
$smarty->assign('start_date', !empty($jobs->start_date) ? strftime(DATE_FORMAT, strtotime($jobs->start_date)) : '');
$smarty->assign('created_at', strftime(DATE_FORMAT, strtotime($jobs->created_at)));
$html_title = SITE_NAME . " - " . format_lang('page_title', 'apply') . " " . strip_html($jobs->job_title);
$meta_description = seo_words(subtrack_string($jobs->job_description, 150));
$meta_keywords = seo_words(subtrack_string($jobs->job_description, 150));
//end of job details //
///setting fields
$working_status_select_bx = format_lang('select', "working_status");
$smarty->assign('working_status', $working_status_select_bx);
$notice_select_bx = format_lang('select', "notice");
$smarty->assign('notice', $notice_select_bx);
$salary_select_bx = format_lang('select', "salary");
$smarty->assign('salary', $salary_select_bx);
$willing_to_travel_bx = format_lang('select', "far_travel_work");
$smarty->assign('willing_to_travel', $willing_to_travel_bx);
//when button is press
if (isset($_POST['submit'])) {
$_SESSION['apply']['email'] = $email = safe_output($_POST['txt_email1']);
示例14: PluginConfig
<?php
require_once "../initialise_files.php";
include_once "sessioninc.php";
$plugin_arr = new PluginConfig();
$id = !isset($_REQUEST['id']) ? 0 : $_REQUEST['id'];
$smarty->assign('id', $id);
$k = false;
if (isset($_POST['add'])) {
foreach ($_POST['plugin'] as $key => $data) {
$plugin_arr->id = strip_html($key);
$plugin_arr->plugin_value = strip_html($data);
if ($plugin_arr->update_plugin()) {
$k = true;
}
}
if (isset($k) && $k == true) {
$session->message("<div class='success'> Plugin has been updated successfully. </div>");
redirect_to($_SERVER['PHP_SELF'] . "?id=" . $id);
die;
} else {
redirect_to($_SERVER['PHP_SELF'] . "?id=" . $id);
die;
}
}
$plugin_arr->plugin_id = (int) $id;
$plugin_ = $plugin_arr->get_pluginconfig_by_plugin_id();
$manage_lists = array();
if ($plugin_ && is_array($plugin_)) {
$i = 1;
foreach ($plugin_ as $list) {
示例15: format_lang
$save_search->id = $id;
if ($save_search->delete_saveSearch()) {
$message = "<div class='success'>" . format_lang('success', 'delete_success') . "</div>";
} else {
$message = "<div class='error'>" . format_lang('errormsg', 64) . "</div>";
}
} else {
redirect_to(BASE_URL . "save_search/");
die;
}
$session->message($message);
redirect_to(BASE_URL . "save_search/");
}
$save_search_arr = SaveSearch::find_by_user_id($user_id);
if (!empty($save_search_arr)) {
$search = array();
$i = 1;
foreach ($save_search_arr as $save_search) {
$search[$i]['id'] = $save_search->id;
$search[$i]['reference_name'] = $save_search->reference_name;
$search[$i]['reference'] = urldecode($save_search->reference);
$search[$i]['is_deleted'] = $save_search->is_deleted;
$search[$i]['created_at'] = strftime(DATE_FORMAT, strtotime($save_search->date_save));
$i++;
}
$smarty->assign('save_search', $search);
}
$html_title = SITE_NAME . " - " . format_lang('page_title', 'save_search') . chr(10) . strip_html($employee->full_name());
$smarty->assign('lang', $lang);
$smarty->assign('message', $message);
$smarty->assign('rendered_page', $smarty->fetch('save_search.tpl'));