本文整理汇总了PHP中strip_tags函数的典型用法代码示例。如果您正苦于以下问题:PHP strip_tags函数的具体用法?PHP strip_tags怎么用?PHP strip_tags使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strip_tags函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: formatField
function formatField($input)
{
$input = strip_tags($input);
$input = str_replace(";", ":", $input);
$input = mysql_real_escape_string($input);
return trim($input);
}
开发者ID:nicefirework,项目名称:Joke-Site-Script-Free,代码行数:7,代码来源:config.inc.php
示例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;
}
开发者ID:ajisantoso,项目名称:kateglo,代码行数:28,代码来源:class_proverb.php
示例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;
}
开发者ID:hiddenpearls,项目名称:wp-appkit,代码行数:28,代码来源:components-utils.php
示例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);
}
}
开发者ID:neork,项目名称:myPHPscripts,代码行数:36,代码来源:register.php
示例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;
}
开发者ID:pjsinco,项目名称:doctorsthatdo-wp-content,代码行数:17,代码来源:widget-search.php
示例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;
}
开发者ID:artemkuchma,项目名称:php_academy_site2,代码行数:26,代码来源:Translit.php
示例7: StripTags
function StripTags($out)
{
$out = strip_tags($out);
$out = trim(preg_replace("~[\\s]+~", " ", $out));
$out = str_ireplace("…", "", $out);
return $out;
}
开发者ID:superego546,项目名称:SMSGyan,代码行数:7,代码来源:KE_gossip.php
示例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;
}
}
开发者ID:somidex,项目名称:tnf1002016,代码行数:33,代码来源:Paypal.php
示例9: sanitizeString
function sanitizeString($_db, $str)
{
$str = strip_tags($str);
$str = htmlentities($str);
$str = stripslashes($str);
return mysqli_real_escape_string($_db, $str);
}
开发者ID:NickGamarra,项目名称:GameChangers,代码行数:7,代码来源:functions.php
示例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;
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:34,代码来源:ElasticsearchType_collection.php
示例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')));
}
开发者ID:ioanok,项目名称:symfoxid,代码行数:31,代码来源:dialog.php
示例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;
}
开发者ID:sb-xs,项目名称:que-pour-elle,代码行数:38,代码来源:like-button.php
示例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;
}
开发者ID:kirtromero,项目名称:cw_members,代码行数:12,代码来源:UpdateSearchKeywords.php
示例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;
}
开发者ID:peterzubkoff,项目名称:yprst,代码行数:7,代码来源:escaping.php
示例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);
}
开发者ID:Cranky4,项目名称:npfs,代码行数:30,代码来源:DaFrontendController.php
示例16: clean_text
/**
*
* @param string $string
* @param int $word_limit
* @param string $ending
* @return string
*/
function clean_text($string, $word_limit = 0, $ending = ' ...')
{
//remove wp shortcodes
$string = \strip_shortcodes($string);
//adds a space before every tag open so we don't get heading/paragraphs glued together when we strip tags
$string = str_replace('<', ' <', $string);
//strip tags
$string = strip_tags($string);
//convert space entities to normal spaces to help out some users
$string = str_replace(' ', ' ', $string);
//convert to html entities
$string = htmlspecialchars($string);
//convert space entities to regular spaces so we can remove double spaces - all other hmtl entities should be fine
$string = str_replace(' ', ' ', $string);
//removes double spaces, tabs or line breaks, and trim the result
$string = trim(mb_ereg_replace('\\s+', ' ', $string));
//limit
if ($word_limit) {
$words = explode(' ', $string);
if (count($words) > $word_limit) {
array_splice($words, $word_limit);
$string = implode(' ', $words) . $ending;
}
}
return $string;
}
开发者ID:andrefelipe,项目名称:bond,代码行数:33,代码来源:utils-string.php
示例17: contactform
/**
* Mail form contact site admin
* @param senderName string senderName
* @param senderEmail string senderEmail
* @param senderSubject string senderSubject
* @param senderMessage string senderMessage
* @param email string config Email address
* @param subject string header subject
* @return bool
**/
public function contactform($senderName, $senderEmail, $senderSubject, $senderMessage)
{
$this->debug->append("STA " . __METHOD__, 4);
if (preg_match('/[^a-z_\\.\\!\\?\\-0-9\\s ]/i', $senderName)) {
$this->setErrorMessage($this->getErrorMsg('E0024'));
return false;
}
if (empty($senderEmail) || !filter_var($senderEmail, FILTER_VALIDATE_EMAIL)) {
$this->setErrorMessage($this->getErrorMsg('E0023'));
return false;
}
if (preg_match('/[^a-z_\\.\\!\\?\\-0-9\\s ]/i', $senderSubject)) {
$this->setErrorMessage($this->getErrorMsg('E0034'));
return false;
}
if (strlen(strip_tags($senderMessage)) < strlen($senderMessage)) {
$this->setErrorMessage($this->getErrorMsg('E0024'));
return false;
}
$aData['senderName'] = $senderName;
$aData['senderEmail'] = $senderEmail;
$aData['senderSubject'] = $senderSubject;
$aData['senderMessage'] = $senderMessage;
$aData['email'] = $this->setting->getValue('website_email', '[email protected]');
$aData['subject'] = 'Contact Form';
if ($this->sendMail('contactform/body', $aData)) {
return true;
} else {
$this->setErrorMessage('Unable to send email');
return false;
}
return false;
}
开发者ID:noncepool,项目名称:php-mpos,代码行数:43,代码来源:mail.class.php
示例18: _genericReplacements
private function _genericReplacements()
{
$this->_doc_content = strip_tags($this->_doc_content);
$this->_doc_content = ltrim(rtrim($this->_doc_content));
$this->_doc_content = mb_strtolower($this->_doc_content, $this->_charset);
// Remove dots between chars (for things like urls)
$this->_doc_content = $this->_my_preg_replace("/([a-z]{1})[\\.]+([a-z]{1})/", "\$1\$2", $this->_doc_content);
// ? Remove all html entities
// $this->_doc_content = $this->_my_preg_replace("/&[#|a-z|0-9]+;/", " ", $this->_doc_content);
// Decode all html entities
$this->_doc_content = html_entity_decode($this->_doc_content, ENT_COMPAT, $this->_charset);
// Replace multiple spaces chars with just one space
$this->_doc_content = $this->_my_preg_replace("/[\\s|\t|\n|\r]+/", " ", $this->_doc_content);
// Remove dots, dashes and spaces between digits
$this->_doc_content = $this->_my_preg_replace("/([0-9]{1})[\\.|\\s|\\-]+([0-9]{1})/", "\$1\$2", $this->_doc_content);
// Remove spaces after sentences and replace multiple dots with just one dot
$this->_doc_content = $this->_my_preg_replace("/[\\.]+ /", ".", $this->_doc_content);
// The same for sentences ending with question marks
$this->_doc_content = $this->_my_preg_replace("/[\\?]+ /", ".", $this->_doc_content);
// The same for "!"
$this->_doc_content = $this->_my_preg_replace("/[\\!]+ /", ".", $this->_doc_content);
// Remove all non-alphanumeric characters except for spaces and dots
// $this->_doc_content = $this->_my_preg_replace("/[^a-z|а-я|^\.|^\d|^\s|^@]+/i", "", $this->_doc_content);
return $this;
}
开发者ID:mihailshumilov,项目名称:documenthash,代码行数:25,代码来源:DocumentHash.php
示例19: smarty_modifier_stripTags
/**
* Smarty strip_tags modifier plugin
*
* Type: modifier
* Name: strip_tags
* Purpose: strip html tags from text
* @link http://www.smarty.net/manual/en/language.modifier.strip.tags.php
* strip_tags (Smarty online manual)
*
* @author Monte Ohrt <monte at="" ohrt="" dot="" com="">
* @author Jordon Mears <jordoncm at="" gmail="" dot="" com="">
*
* @version 2.0
*
* @param string
* @param boolean optional
* @param string optional
* @return string
*/
function smarty_modifier_stripTags($string)
{
switch (func_num_args()) {
case 1:
$replace_with_space = true;
break;
case 2:
$arg = func_get_arg(1);
if ($arg === 1 || $arg === true || $arg === '1' || $arg === 'true') {
// for full legacy support || $arg === 'false' should be included
$replace_with_space = true;
$allowable_tags = '';
} elseif ($arg === 0 || $arg === false || $arg === '0' || $arg === 'false') {
// for full legacy support || $arg === 'false' should be removed
$replace_with_space = false;
$allowable_tags = '';
} else {
$replace_with_space = true;
$allowable_tags = $arg;
}
break;
case 3:
$replace_with_space = func_get_arg(1);
$allowable_tags = func_get_arg(2);
break;
}
if ($replace_with_space) {
$string = preg_replace('!(<[^>]*?>)!', '$1 ', $string);
}
$string = strip_tags($string, $allowable_tags);
if ($replace_with_space) {
$string = preg_replace('!(<[^>]*?>) !', '$1', $string);
}
return $string;
}
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:54,代码来源:modifier.stripTags.php
示例20: viewthread_modoption
public function viewthread_modoption()
{
global $_G;
if (!$_G['adminid']) {
return false;
}
$usergroupsfeedlist = unserialize($_G['setting']['qqgroup_usergroup_feed_list']);
if (empty($usergroupsfeedlist) || !in_array($_G['groupid'], $usergroupsfeedlist)) {
if (self::$util->isfounder($_G['member']) == false) {
return false;
}
}
$tid = $_G['tid'];
$title = urlencode(trim($_G['forum_thread']['subject']));
$post = C::t('forum_post')->fetch_all_by_tid_position($_G['fotum_thread']['posttableid'], $_G['tid'], 1);
include_once libfile('function/discuzcode');
$content = preg_replace("/\\[audio(=1)*\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/audio\\]/ies", '', trim($post[0]['message']));
$content = preg_replace("/\\[flash(=(\\d+),(\\d+))?\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/flash\\]/ies", '', $content);
$content = preg_replace("/\\[media=([\\w,]+)\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/media\\]/ies", '', $content);
$content = preg_replace("/\\[hide[=]?(d\\d+)?[,]?(\\d+)?\\]\\s*(.*?)\\s*\\[\\/hide\\]/is", '', $content);
$content = strip_tags(discuzcode($content, 0, 0, 0));
$content = preg_replace('%\\[attach\\].*\\[/attach\\]%im', '', $content);
$content = str_replace(' ', ' ', $content);
$content = urlencode(cutstr($content, 50, ''));
include template('qqgroup:push');
return trim($return);
}
开发者ID:tianyunchong,项目名称:php,代码行数:27,代码来源:qqgroup.class.php
注:本文中的strip_tags函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论