本文整理汇总了PHP中strip_tags函数的典型用法代码示例。如果您正苦于以下问题:PHP strip_tags函数的具体用法?PHP strip_tags怎么用?PHP strip_tags使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strip_tags函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formatField
function formatField($input)
{
$input = strip_tags($input);
$input = str_replace(";", ":", $input);
$input = mysql_real_escape_string($input);
return trim($input);
}
示例2: show_list
/**
*
*/
function show_list()
{
global $_GET;
if ($_GET['phrase']) {
$where .= sprintf('AND proverb LIKE \'%%%1$s%%\' ', $this->db->quote($_GET['phrase'], null, false));
}
$cols = 'proverb, meaning';
$from = 'FROM proverb WHERE prv_type = 1 ' . $where . 'ORDER BY proverb ASC';
$rows = $this->db->get_rows_paged($cols, $from);
if ($this->db->num_rows > 0) {
$ret .= '<p>' . $this->db->get_page_nav() . '</p>' . LF;
$ret .= '<dl>';
foreach ($rows as $row) {
$ret .= '<dt>' . $row['proverb'] . '</dt>' . LF;
$ret .= '<dd>' . LF;
$ret .= nl2br(strip_tags($row['meaning'])) . LF;
$ret .= '</dd>' . LF;
}
$ret .= '</dl>' . LF;
$ret .= '<p>' . $this->db->get_page_nav() . '</p>' . LF;
} else {
$ret .= '<p>' . $this->msg['na'] . '</p>' . LF;
}
return $ret;
}
示例3: get_formated_content
public static function get_formated_content()
{
$post = get_post();
$content = get_the_content();
//Apply "the_content" filter : formats shortcodes etc... :
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
$allowed_tags = '<br/><br><p><div><h1><h2><h3><h4><h5><h6><a><span><sup><sub><img><i><em><strong><b><ul><ol><li><blockquote><pre>';
/**
* Filter allowed HTML tags for a given post.
*
* @param string $allowed_tags A string containing the concatenated list of default allowed HTML tags.
* @param WP_Post $post The post object.
*/
$allowed_tags = apply_filters('wpak_post_content_allowed_tags', $allowed_tags, $post);
$content = strip_tags($content, $allowed_tags);
/**
* Filter a single post content.
*
* To override (replace) this default formatting completely, use
* "wpak_posts_list_post_content" and "wpak_page_content" filters.
*
* @param string $content The post content.
* @param WP_Post $post The post object.
*/
$content = apply_filters('wpak_post_content_format', $content, $post);
return $content;
}
示例4: register
/**
* Register user.
* @param array $data User details provided during the registration process.
*/
public function register($data)
{
$user = $data['userData'];
//validate provided data
$errors = $this->validateUser($data);
if (count($errors) == 0) {
//no validation errors
//generate email confirmation key
$key = $this->_generateKey();
MAIL_CONFIRMATION_REQUIRED === true ? $confirmed = 'N' : ($confirmed = 'Y');
//insert new user to database
$this->db->insert('as_users', array("email" => $user['email'], "username" => strip_tags($user['username']), "password" => $this->hashPassword($user['password']), "confirmed" => $confirmed, "confirmation_key" => $key, "register_date" => date("Y-m-d")));
$userId = $this->db->lastInsertId();
$this->db->insert('as_user_details', array('user_id' => $userId));
//send confirmation email if needed
if (MAIL_CONFIRMATION_REQUIRED) {
$this->mailer->confirmationEmail($user['email'], $key);
$msg = Lang::get('success_registration_with_confirm');
} else {
$msg = Lang::get('success_registration_no_confirm');
}
//prepare and output success message
$result = array("status" => "success", "msg" => $msg);
echo json_encode($result);
} else {
//there are validation errors
//prepare result
$result = array("status" => "error", "errors" => $errors);
//output result
echo json_encode($result);
}
}
示例5: update
/**
* The update callback for the widget control options. This method is used to sanitize and/or
* validate the options before saving them into the database.
*
* @since 0.6.0
* @access public
* @param array $new_instance
* @param array $old_instance
* @return array
*/
function update($new_instance, $old_instance)
{
/* Strip tags. */
$instance['title'] = strip_tags($new_instance['title']);
/* Return sanitized options. */
return $instance;
}
示例6: __construct
public function __construct($text)
{
$this->text = $text;
$text = (string) $text;
// преобразуем в строковое значение
$text = strip_tags($text);
// убираем HTML-теги
$text = str_replace(array("\n", "\r"), " ", $text);
// убираем перевод каретки
$text = preg_replace("/\\s+/", ' ', $text);
// удаляем повторяющие пробелы
$text = trim($text);
// убираем пробелы в начале и конце строки
$text = mb_strtolower($text, 'utf-8');
// переводим строку в нижний регистр
$text = strtr($text, array('а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd', 'е' => 'e', 'ё' => 'e', 'ж' => 'j', 'з' => 'z', 'и' => 'y', 'і' => 'i', 'ї' => 'і', 'й' => 'y', 'к' => 'k', 'л' => 'l', 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r', 'с' => 's', 'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'h', 'ц' => 'c', 'ч' => 'ch', 'ш' => 'sh', 'щ' => 'shch', 'ы' => 'y', 'э' => 'e', 'ю' => 'yu', 'я' => 'ya', 'ъ' => '', 'ь' => ''));
// в данном случае язык
//будет укр.(изначально скрипт для русского яз.) поэтому некоторые буквы заменены или удалены, а именно ('и'=>'i')
$text = preg_replace("/[^0-9a-z-_ ]/i", "", $text);
// очищаем строку от недопустимых символов
$text = str_replace(" ", "_", $text);
// заменяем пробелы нижним подчеркиванием
$text = str_replace("-", "_", $text);
//заменяет минус на нижнее подчеркивание
$this->translit = $text;
}
示例7: StripTags
function StripTags($out)
{
$out = strip_tags($out);
$out = trim(preg_replace("~[\\s]+~", " ", $out));
$out = str_ireplace("…", "", $out);
return $out;
}
示例8: pdt
public function pdt($txn)
{
$params = array('at' => $this->atPaypal, 'tx' => $txn, 'cmd' => '_notify-synch');
$content = '';
foreach ($params as $key => $val) {
$content .= '&' . $key . '=' . urlencode($val);
}
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $this->paypalEndpoint);
curl_setopt($c, CURLOPT_VERBOSE, TRUE);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_POST, 1);
curl_setopt($c, CURLOPT_POSTFIELDS, $content);
$response = curl_exec($c);
if (!$response) {
echo "FAILED: " . curl_error($c) . "(" . curl_errno($c) . ")";
curl_close($c);
return false;
} else {
$str = urldecode($response);
$res = explode("\n", strip_tags($str));
$result = array();
foreach ($res as $val) {
$r = explode("=", $val);
if (count($r) > 1) {
$result[$r[0]] = $r[1];
}
}
curl_close($c);
return $result;
}
}
示例9: sanitizeString
function sanitizeString($_db, $str)
{
$str = strip_tags($str);
$str = htmlentities($str);
$str = stripslashes($str);
return mysqli_real_escape_string($_db, $str);
}
示例10: getRecordDataById
public static function getRecordDataById($type, $id)
{
$sql = 'SELECT c.id, c.name, c.ctime, c.description, cv.view AS viewid, c.owner
FROM {collectio}n c
LEFT OUTER JOIN {collection_view} cv ON cv.collection = c.id
WHERE id = ? ORDER BY cv.displayorder asc LIMIT 1;';
$record = get_record_sql($sql, array($id));
if (!$record) {
return false;
}
$record->name = str_replace(array("\r\n", "\n", "\r"), ' ', strip_tags($record->name));
$record->description = str_replace(array("\r\n", "\n", "\r"), ' ', strip_tags($record->description));
// Created by
if (intval($record->owner) > 0) {
$record->createdby = get_record('usr', 'id', $record->owner);
$record->createdbyname = display_name($record->createdby);
}
// Get all views included in that collection
$sql = 'SELECT v.id, v.title
FROM {view} v
LEFT OUTER JOIN {collection_view} cv ON cv.view = v.id
WHERE cv.collection = ?';
$views = recordset_to_array(get_recordset_sql($sql, array($id)));
if ($views) {
$record_views = array();
foreach ($views as $view) {
if (isset($view->id)) {
$record_views[$view->id] = $view->title;
}
}
$record->views = $record_views;
}
return $record;
}
示例11: init
function init(&$DIALOG)
{
global $WPRO_SESS, $EDITOR;
$DIALOG->headContent->add('<link rel="stylesheet" href="core/plugins/wproCore_spellchecker/dialog.css" type="text/css" />');
$DIALOG->headContent->add('<script type="text/javascript" src="core/plugins/wproCore_spellchecker/dialog_src.js"></script>');
$DIALOG->headContent->add('<script type="text/javascript" src="core/js/wproCookies.js"></script>');
$DIALOG->title = str_replace('...', '', $DIALOG->langEngine->get('editor', 'spelling'));
$DIALOG->bodyInclude = WPRO_DIR . 'core/plugins/wproCore_spellchecker/dialog.tpl.php';
require_once WPRO_DIR . 'conf/spellchecker.inc.php';
require_once WPRO_DIR . 'core/plugins/wproCore_spellchecker/config.inc.php';
// language
if (!empty($EDITOR->htmlLang)) {
$dictionary = $DIALOG->EDITOR->htmlLang;
} else {
$dictionary = $DIALOG->EDITOR->lang;
}
$DIALOG->template->assign('dictionary', $dictionary);
//$DIALOG->template->assign('SPELLCHECKER_API', $SPELLCHECKER_API);
$sid = $WPRO_SESS->sessionId;
$wpsname = $WPRO_SESS->sessionName;
$DIALOG->template->assign('sid', $WPRO_SESS->sessionId);
$DIALOG->template->assign('wpsname', $WPRO_SESS->sessionName);
//if ($SPELLCHECKER_API=='http') {
//$authstring = '<input type="hidden" name="wpsid" value="'.base64_encode($EDITOR->_sessionId).'" />';
//$DIALOG->template->assign('authenticationstring', $DIALOG->EDITOR->_jsEncode($authstring));
// $DIALOG->template->assign('spellcheckerURL', WPRO_CENTRAL_SPELLCHECKER_URL);
//} else {
$DIALOG->template->assign('spellcheckerURL', $EDITOR->editorLink('core/plugins/wproCore_spellchecker/checkSpelling.php?' . $wpsname . '=' . $sid . ($EDITOR->appendToQueryStrings ? '&' . $EDITOR->appendToQueryStrings : '') . ($EDITOR->appendSid ? strip_tags(defined('SID') ? '&' . SID : '') : '')));
//}
$DIALOG->options = array(array('onclick' => 'dialog.doFormSubmit()', 'type' => 'button', 'name' => 'ok', 'disabled' => 'disabled', 'value' => $DIALOG->langEngine->get('core', 'apply')), array('onclick' => 'dialog.close()', 'type' => 'button', 'name' => 'cancel', 'value' => $DIALOG->langEngine->get('core', 'cancel')));
}
示例12: update
/**
* Sanitize widget form values as they are saved.
*
* @see WP_Widget::update()
*
* @since 1.0
*
* @param array $new_instance Values just sent to be saved.
* @param array $old_instance Previously saved values from database.
*
* @return array Updated safe values to be saved.
*/
public function update($new_instance, $old_instance)
{
$instance = array();
$new_instance = (array) $new_instance;
if (!empty($new_instance['title'])) {
$instance['title'] = strip_tags($new_instance['title']);
}
foreach (array('share', 'show_faces') as $bool_option) {
if (isset($new_instance[$bool_option])) {
$new_instance[$bool_option] = true;
} else {
$new_instance[$bool_option] = false;
}
}
if (!class_exists('Facebook_Like_Button')) {
require_once dirname(dirname(__FILE__)) . '/class-facebook-like-button.php';
}
$like_button = Facebook_Like_Button::fromArray($new_instance);
if ($like_button) {
if (!class_exists('Facebook_Like_Button_Settings')) {
require_once dirname(dirname(dirname(__FILE__))) . '/admin/settings-like-button.php';
}
return array_merge($instance, Facebook_Like_Button_Settings::html_data_to_options($like_button->toHTMLDataArray()));
}
return $instance;
}
示例13: __construct
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($keywords)
{
$this->username = \Request::server('PHP_AUTH_USER', 'sampleuser');
$keywords = strip_tags(str_replace("'", " ", $keywords));
$keywords = strtolower($keywords);
$this->keywords = $keywords;
}
示例14: clear_string
function clear_string($cl_str)
{
$cl_str = strip_tags($cl_str);
$cl_str = mysql_real_escape_string($cl_str);
$cl_str = trim($cl_str);
return $cl_str;
}
示例15: getKeywords
public function getKeywords($generateIfEmpty = true, $data = null)
{
$keywords = parent::getKeywords();
if (!$generateIfEmpty) {
return $keywords;
}
if ($keywords == null && $data != null) {
$preg = '/<h[123456].*?>(.*?)<\\/h[123456]>/i';
$content = str_replace("\n", "", str_replace("\r", "", $data));
$pregCount = preg_match_all($preg, $content, $headers);
$keywords = '';
for ($i = 0; $i < $pregCount; $i++) {
if ($keywords != '') {
$keywords .= ', ';
}
$item = trim(strip_tags($headers[0][$i]));
if ($item == '') {
continue;
}
$keywords .= $item;
if (mb_strlen($keywords) > 200) {
break;
}
}
}
if ($keywords == null && isset(Yii::app()->domain)) {
$keywords = Yii::app()->domain->model->keywords;
}
return str_replace('@', '[at]', $keywords);
}