• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP htmLawed函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中htmLawed函数的典型用法代码示例。如果您正苦于以下问题:PHP htmLawed函数的具体用法?PHP htmLawed怎么用?PHP htmLawed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了htmLawed函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getDisplaySanitizedValue

    public function getDisplaySanitizedValue() {
		$this->load();
		if ($this->akTextareaDisplayMode == 'text') {
			return parent::getDisplaySanitizedValue();
		}
		return htmLawed(parent::getValue(), array('safe'=>1, 'deny_attribute'=>'style'));
	}
开发者ID:JeRoNZ,项目名称:concrete5-1,代码行数:7,代码来源:controller.php


示例2: run

 public static function run($html)
 {
     include_once "htmLawed.php";
     $config = array('tidy' => 1);
     $html = htmLawed($html, $config);
     return $html;
 }
开发者ID:alerque,项目名称:bibledit,代码行数:7,代码来源:html.php


示例3: processModel3d

function processModel3d($data)
{
    global $abort, $errorArray;
    $data->type = 'model3d';
    //Check name
    if (isset($data->name)) {
        $data->name = strip_tags($data->name);
    } else {
        $data->name = '3D Model';
    }
    //Check key
    if (isset($data->key)) {
        $re = "/^[a-z0-9]{10}\$/";
        //Alphanumeric, and 10 characters
        if (!preg_match($re, $data->key)) {
            $abort = true;
            $errorArray[] = "Invalid key for " . $data->name . " widget.";
        }
    }
    //Check title
    if (isset($data->title)) {
        $data->title = strip_tags($data->title);
    } else {
        $data->title = '3D model title';
    }
    //Check description
    if (isset($data->desc)) {
        $data->desc = htmLawed($data->desc, array('safe' => 1, 'elements' => 'a', 'deny_attribute' => '* -href'));
        $data->desc = str_replace(" />", ">", $data->desc);
    } else {
        $data->desc = "";
    }
    //Check if valid Sketchfab url source
    if (!empty($data->url)) {
        $pattern = "/(?:https?:)?(?:\\/\\/)?(?:www\\.)?(?:sketchfab\\.com\\/models\\/)([a-z0-9]+)(?:.+)?/";
        //Get YouTube video ID
        if (preg_match($pattern, $data->url)) {
            $data->url = preg_replace($pattern, "https://sketchfab.com/models/\$1/embed", $data->url);
        } else {
            $abort = true;
            $errorArray[] = "Sketchfab URL required for " . $data->name . " widget.";
        }
    } else {
        $data->url = "";
    }
    $data = checkAlignment($data);
    //From alignOptions.php
    //Check index is a number
    if (!empty($data->index)) {
        if (!filter_var($data->index, FILTER_VALIDATE_INT) || $data->index < 0) {
            unset($data->index);
        }
    } else {
        //Index is optional
    }
    //Remove any invalid keys
    $validKeys = (object) array('type' => '', 'name' => '', 'key' => '', 'title' => '', 'desc' => '', 'url' => '', 'align' => '', 'margin' => '', 'index' => '');
    $data = (object) array_intersect_key(get_object_vars($data), get_object_vars($validKeys));
    return $data;
}
开发者ID:komcdo,项目名称:winnow,代码行数:60,代码来源:model3d.php


示例4: Format

 public function Format($Html)
 {
     $Attributes = C('Garden.Html.BlockedAttributes', 'on*');
     $Config = array('anti_link_spam' => array('`.`', ''), 'comment' => 1, 'cdata' => 3, 'css_expression' => 1, 'deny_attribute' => $Attributes, 'unique_ids' => 1, 'elements' => '*-applet-form-input-textarea-iframe-script-style-embed-object-select-option-button-fieldset-optgroup-legend', 'keep_bad' => 0, 'schemes' => 'classid:clsid; href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, telnet; style: nil; *:file, http, https', 'valid_xhtml' => 0, 'direct_list_nest' => 1, 'balance' => 1);
     // Turn embedded videos into simple links (legacy workaround)
     $Html = Gdn_Format::UnembedVideos($Html);
     // We check the flag within Gdn_Format to see
     // if htmLawed should place rel="nofollow" links
     // within output or not.
     // A plugin can set this flag (for example).
     // The default is to show rel="nofollow" on all links.
     if (Gdn_Format::$DisplayNoFollow) {
         // display rel="nofollow" on all links.
         $Config['anti_link_spam'] = array('`.`', '');
     } else {
         // never display rel="nofollow"
         $Config['anti_link_spam'] = array('', '');
     }
     if ($this->SafeStyles) {
         // Deny all class and style attributes.
         // A lot of damage can be done by hackers with these attributes.
         $Config['deny_attribute'] .= ',style';
         //      } else {
         //         $Config['hook_tag'] = 'HTMLawedHookTag';
     }
     // Block some IDs so you can't break Javascript
     $GLOBALS['hl_Ids'] = array('Bookmarks' => 1, 'CommentForm' => 1, 'Content' => 1, 'Definitions' => 1, 'DiscussionForm' => 1, 'Foot' => 1, 'Form_Comment' => 1, 'Form_User_Password' => 1, 'Form_User_SignIn' => 1, 'Head' => 1, 'HighlightColor' => 1, 'InformMessageStack' => 1, 'Menu' => 1, 'PagerMore' => 1, 'Panel' => 1, 'Status' => 1);
     $Spec = 'object=-classid-type, -codebase; embed=type(oneof=application/x-shockwave-flash); a=class(noneof=Hijack|Dismiss|MorePager/nomatch=%pop[in|up|down]|flyout|ajax%i)';
     $Result = htmLawed($Html, $Config, $Spec);
     return $Result;
 }
开发者ID:elpum,项目名称:TgaForumBundle,代码行数:31,代码来源:class.htmlawed.plugin.php


示例5: processVideo

function processVideo($data)
{
    global $abort, $errorArray;
    $data->type = 'video';
    //Check name
    if (isset($data->name)) {
        $data->name = strip_tags($data->name);
    } else {
        $data->name = 'Video';
    }
    //Check key
    if (isset($data->key)) {
        $re = "/^[a-z0-9]{10}\$/";
        //Alphanumeric, and 10 characters
        if (!preg_match($re, $data->key)) {
            $abort = true;
            $errorArray[] = "Invalid key for " . $data->name . " widget.";
        }
    }
    //Check title
    if (isset($data->title)) {
        $data->title = strip_tags($data->title);
    } else {
        $data->title = 'Sample title';
    }
    //Check description
    if (isset($data->desc)) {
        $data->desc = htmLawed($data->desc, array('safe' => 1, 'elements' => 'a', 'deny_attribute' => '* -href'));
        $data->desc = str_replace(" />", ">", $data->desc);
    } else {
        $data->desc = "";
    }
    //Check if valid YouTube url source
    if (!empty($data->url)) {
        $pattern = "/(?:https?:)?(?:\\/\\/)?(?:www\\.)?(?:youtube\\.com|youtu\\.be)\\/(?:embed\\/)?(?:watch\\?v=)?([a-zA-Z0-9_-]+)(?:\\?.+)?(?:&.+)?\$/";
        //Get YouTube video ID
        if (preg_match($pattern, $data->url)) {
            $data->url = preg_replace($pattern, "//www.youtube.com/embed/\$1?rel=0&amp;showinfo=0", $data->url);
        } else {
            $abort = true;
            $errorArray[] = "YouTube video URL required for " . $data->name . " widget.";
        }
    } else {
        $data->url = "";
    }
    $data = checkAlignment($data);
    //From alignOptions.php
    //Check index is a number
    if (!empty($data->index)) {
        if (!filter_var($data->index, FILTER_VALIDATE_INT) || $data->index < 0) {
            unset($data->index);
        }
    } else {
        //Index is optional
    }
    //Remove any invalid keys
    $validKeys = (object) array('type' => '', 'name' => '', 'key' => '', 'title' => '', 'desc' => '', 'url' => '', 'align' => '', 'margin' => '', 'index' => '');
    $data = (object) array_intersect_key(get_object_vars($data), get_object_vars($validKeys));
    return $data;
}
开发者ID:komcdo,项目名称:winnow,代码行数:60,代码来源:video.php


示例6: Format

 public function Format($Html)
 {
     $Config = array('anti_link_spam' => array('`.`', ''), 'comment' => 1, 'cdata' => 3, 'css_expression' => 1, 'deny_attribute' => 'on*', 'elements' => '*-applet-form-input-textarea-iframe-script-style', 'keep_bad' => 0, 'schemes' => 'classid:clsid; href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, telnet; style: nil; *:file, http, https', 'valid_xhtml' => 0, 'direct_list_nest' => 1, 'balance' => 1);
     // We check the flag within Gdn_Format to see
     // if htmLawed should place rel="nofollow" links
     // within output or not.
     // A plugin can set this flag (for example).
     // The default is to show rel="nofollow" on all links.
     if (Gdn_Format::$DisplayNoFollow) {
         // display rel="nofollow" on all links.
         $Config['anti_link_spam'] = array('`.`', '');
     } else {
         // never display rel="nofollow"
         $Config['anti_link_spam'] = array('', '');
     }
     if ($this->SafeStyles) {
         // Deny all class and style attributes.
         // A lot of damage can be done by hackers with these attributes.
         $Config['deny_attribute'] .= ',style';
         //      } else {
         //         $Config['hook_tag'] = 'HTMLawedHookTag';
     }
     $Spec = 'object=-classid-type, -codebase; embed=type(oneof=application/x-shockwave-flash)';
     $Result = htmLawed($Html, $Config, $Spec);
     return $Result;
 }
开发者ID:rnovino,项目名称:Garden,代码行数:26,代码来源:class.htmlawed.plugin.php


示例7: processImageWidget

function processImageWidget($data)
{
    global $abort, $errorArray;
    $data->type = 'imagewidget';
    //Check name
    if (isset($data->name)) {
        $data->name = strip_tags($data->name);
    } else {
        $data->name = 'Image';
    }
    //Check key
    if (isset($data->key)) {
        $re = "/^[a-z0-9]{10}\$/";
        //Alphanumeric, and 10 characters
        if (!preg_match($re, $data->key)) {
            $abort = true;
            $errorArray[] = "Invalid key for " . $data->name . " widget.";
        }
    }
    //Check title
    if (isset($data->title)) {
        $data->title = strip_tags($data->title);
    } else {
        $data->title = 'Sample title';
    }
    //Check description
    if (isset($data->desc)) {
        $data->desc = htmLawed($data->desc, array('safe' => 1, 'elements' => 'a', 'deny_attribute' => '* -href'));
        $data->desc = str_replace(" />", ">", $data->desc);
    } else {
        $data->desc = "";
    }
    //Check image source
    if (!empty($data->imgSrc)) {
        if (!file_exists(ROOT_PATH . ltrim($data->imgSrc, '/')) && !file_exists($data->imgSrc)) {
            $abort = true;
            $errorArray[] = $data->name . " image source not found.";
        }
    } else {
        $abort = true;
        $errorArray[] = "Image source required for " . $data->name . " widget.";
    }
    $data = checkAlignment($data);
    //From alignOptions.php
    //Check index is a number
    if (!empty($data->index)) {
        if (!filter_var($data->index, FILTER_VALIDATE_INT) || $data->index < 0) {
            unset($data->index);
        }
    } else {
        //Index is optional
    }
    //Remove any invalid keys
    $validKeys = (object) array('type' => '', 'name' => '', 'key' => '', 'title' => '', 'desc' => '', 'imgSrc' => '', 'align' => '', 'margin' => '', 'index' => '');
    $data = (object) array_intersect_key(get_object_vars($data), get_object_vars($validKeys));
    return $data;
}
开发者ID:komcdo,项目名称:winnow,代码行数:57,代码来源:image.php


示例8: xssClean

 public static function xssClean($value)
 {
     if (!is_array($value)) {
         return htmLawed($value, array('safe' => 1, 'balanced' => 0));
     }
     foreach ($value as $k => $v) {
         $value[$k] = $this->xss_clean($v);
     }
     return $value;
 }
开发者ID:Hannes1,项目名称:WorstFrameworkEver,代码行数:10,代码来源:WFESecurity.php


示例9: xss_clean

 public static function xss_clean($value, array $options = array())
 {
     if (!is_array($value)) {
         if (!function_exists('htmLawed')) {
             require_once dirname(dirname(__FILE__)) . '/vendor/htmlawed.php';
         }
         return htmLawed($value, array_merge(array('safe' => 1, 'balanced' => 0), $options));
     }
     foreach ($value as $k => $v) {
         $value[$k] = static::xss_clean($v);
     }
     return $value;
 }
开发者ID:karimo255,项目名称:krimo,代码行数:13,代码来源:security.php


示例10: fetchContent

 /**
  * Fetch content from the given url and return a readable content.
  *
  * @param string $url
  *
  * @return array With keys html, title, url & summary
  */
 public function fetchContent($url)
 {
     $infos = $this->doFetchContent($url);
     $html = $infos['html'];
     // filter xss?
     if ($this->config['xss_filter']) {
         $this->logger->log('debug', 'Filtering HTML to remove XSS');
         $html = htmLawed($html, array('safe' => 1, 'deny_attribute' => 'style', 'comment' => 1, 'cdata' => 1));
     }
     // generate summary
     $infos['summary'] = $this->getExcerpt($html);
     return $infos;
 }
开发者ID:harikt,项目名称:graby,代码行数:20,代码来源:Graby.php


示例11: repairHtml

 public static function repairHtml($html, $config = array())
 {
     if (class_exists('tidy')) {
         $config = array_merge(array('indent' => true, 'output-xhtml' => true, 'clean' => false, 'wrap' => '86', 'doctype' => 'omit', 'drop-proprietary-attributes' => true, 'drop-font-tags' => false, 'word-2000' => true, 'show-body-only' => true, 'bare' => true, 'enclose-block-text' => true, 'enclose-text' => true, 'join-styles' => false, 'join-classes' => false, 'logical-emphasis' => true, 'lower-literals' => true, 'literal-attributes' => false, 'indent-spaces' => 2, 'quote-nbsp' => true, 'output-bom' => false, 'char-encoding' => 'utf8', 'newline' => 'LF', 'uppercase-tags' => false), $config);
         $tidy = new tidy();
         $tidy->parseString($html, $config, 'utf8');
         $tidy->cleanRepair();
         $ret = $tidy->value;
     } else {
         require_once VENDOR_PATH . '/koala-framework/library-htmlawed/htmLawed.php';
         $ret = htmLawed($html);
     }
     return $ret;
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:14,代码来源:Tidy.php


示例12: filter

 /**
  * Filters a string of html with the htmLawed library.
  *
  * @param string $html The text to filter.
  * @param array|null $config Config settings for the array.
  * @param string|array|null $spec A specification to further limit the allowed attribute values in the html.
  * @return string Returns the filtered html.
  * @see http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/htmLawed_README.htm
  */
 public static function filter($html, array $config = null, $spec = null)
 {
     require_once __DIR__ . '/htmLawed/htmLawed.php';
     if ($config === null) {
         $config = self::$defaultConfig;
     }
     if (isset($config['spec']) && !$spec) {
         $spec = $config['spec'];
     }
     if ($spec === null) {
         $spec = static::$defaultSpec;
     }
     return htmLawed($html, $config, $spec);
 }
开发者ID:vanilla,项目名称:htmlawed,代码行数:23,代码来源:Htmlawed.php


示例13: Format

 public function Format($Html)
 {
     $Config = array('anti_link_spam' => array('`.`', ''), 'comment' => 1, 'cdata' => 3, 'css_expression' => 1, 'deny_attribute' => 'on*', 'elements' => '*-applet-form-input-textarea-iframe-script-style', 'keep_bad' => 0, 'schemes' => 'classid:clsid; href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, telnet; style: nil; *:file, http, https', 'valid_xml' => 2);
     if ($this->SafeStyles) {
         // Deny all class and style attributes.
         // A lot of damage can be done by hackers with these attributes.
         $Config['deny_attribute'] .= ',style';
     } else {
         $Config['hook_tag'] = 'HTMLawedHookTag';
     }
     $Spec = 'object=-classid-type, -codebase; embed=type(oneof=application/x-shockwave-flash)';
     $Result = htmLawed($Html, $Config, $Spec);
     return $Result;
 }
开发者ID:tautomers,项目名称:knoopvszombies,代码行数:14,代码来源:class.htmlawed.plugin.php


示例14: Format

 public function Format($String)
 {
     $String = str_replace(array('&quot;', '&#39;', '&#58;', 'Â'), array('"', "'", ':', ''), $String);
     $String = str_replace('<#EMO_DIR#>', 'default', $String);
     $String = str_replace('<{POST_SNAPBACK}>', '<span class="SnapBack">»</span>', $String);
     // There is an issue with using uppercase code blocks, so they're forced to lowercase here
     $String = str_replace(array('[CODE]', '[/CODE]'), array('[code]', '[/code]'), $String);
     /**
      * IPB inserts line break markup tags at line breaks.  They need to be removed in code blocks.
      * The original newline/line break should be left intact, so whitespace will be preserved in the pre tag.
      */
     $String = preg_replace_callback('/\\[code\\].*?\\[\\/code\\]/is', function ($CodeBlocks) {
         return str_replace(array('<br />'), array(''), $CodeBlocks[0]);
     }, $String);
     /**
      * IPB formats some quotes as HTML.  They're converted here for the sake of uniformity in presentation.
      * Attribute order seems to be standard.  Spacing between the opening of the tag and the first attribute is variable.
      */
     $String = preg_replace_callback('#<blockquote\\s+class="ipsBlockquote" data-author="([^"]+)" data-cid="(\\d+)" data-time="(\\d+)">(.*?)</blockquote>#is', function ($BlockQuotes) {
         $Author = $BlockQuotes[1];
         $Cid = $BlockQuotes[2];
         $Time = $BlockQuotes[3];
         $QuoteContent = $BlockQuotes[4];
         // $Time will over as a timestamp. Convert it to a date string.
         $Date = date('F j Y, g:i A', $Time);
         return "[quote name=\"{$Author}\" url=\"{$Cid}\" date=\"{$Date}\"]{$QuoteContent}[/quote]";
     }, $String);
     // If there is a really long string, it could cause a stack overflow in the bbcode parser.
     // Not much we can do except try and chop the data down a touch.
     // 1. Remove html comments.
     $String = preg_replace('/<!--(.*)-->/Uis', '', $String);
     // 2. Split the string up into chunks.
     $Strings = (array) $String;
     $Result = '';
     foreach ($Strings as $String) {
         $Result .= $this->NBBC()->Parse($String);
     }
     // Linkify URLs in content
     $Result = Gdn_Format::links($Result);
     // Parsing mentions
     $Result = Gdn_Format::mentions($Result);
     // Handling emoji
     $Result = Emoji::instance()->translateToHtml($Result);
     // Make sure to clean filter the html in the end.
     $Config = array('anti_link_spam' => array('`.`', ''), 'comment' => 1, 'cdata' => 3, 'css_expression' => 1, 'deny_attribute' => 'on*', 'elements' => '*-applet-form-input-textarea-iframe-script-style', 'keep_bad' => 0, 'schemes' => 'classid:clsid; href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, telnet; style: nil; *:file, http, https', 'valid_xml' => 2);
     $Spec = 'object=-classid-type, -codebase; embed=type(oneof=application/x-shockwave-flash)';
     $Result = htmLawed($Result, $Config, $Spec);
     return $Result;
 }
开发者ID:nilsen,项目名称:addons,代码行数:49,代码来源:class.ipbformatter.plugin.php


示例15: clean

 /**
  * Clean display value deleting html tags
  *
  * @param $value string: string value
  * @param $striptags bool: strip all html tags
  * @param $keep_bad int:
  *          1 : neutralize tag anb content,
  *          2 : remove tag and neutralize content
  * @return clean value
  **/
 static function clean($value, $striptags = true, $keep_bad = 2)
 {
     include_once GLPI_HTMLAWED;
     $value = Html::entity_decode_deep($value);
     // Clean MS office tags
     $value = str_replace(array("<![if !supportLists]>", "<![endif]>"), '', $value);
     if ($striptags) {
         $specialfilter = array('@<div[^>]*?tooltip_picture[^>]*?>.*?</div[^>]*?>@si');
         // Strip ToolTips
         $value = preg_replace($specialfilter, '', $value);
         $specialfilter = array('@<div[^>]*?tooltip_text[^>]*?>.*?</div[^>]*?>@si');
         // Strip ToolTips
         $value = preg_replace($specialfilter, '', $value);
         $specialfilter = array('@<div[^>]*?tooltip_picture_border[^>]*?>.*?</div[^>]*?>@si');
         // Strip ToolTips
         $value = preg_replace($specialfilter, '', $value);
         $specialfilter = array('@<div[^>]*?invisible[^>]*?>.*?</div[^>]*?>@si');
         // Strip ToolTips
         $value = preg_replace($specialfilter, '', $value);
         $value = preg_replace("/<(p|br|div)( [^>]*)?" . ">/i", "\n", $value);
         $value = preg_replace("/(&nbsp;| )+/", " ", $value);
         $search = array('@<script[^>]*?>.*?</script[^>]*?>@si', '@<style[^>]*?>.*?</style[^>]*?>@si', '@<!DOCTYPE[^>]*?>@si');
         $value = preg_replace($search, '', $value);
     }
     $value = htmLawed($value, array('elements' => $striptags ? 'none' : '', 'keep_bad' => $keep_bad, 'comment' => 1, 'cdata' => 1));
     $value = str_replace(array('&lt;', '&gt;'), array('&amp;lt;', '&amp;gt;'), $value);
     /*
           $specialfilter = array('@<span[^>]*?x-hidden[^>]*?>.*?</span[^>]*?>@si'); // Strip ToolTips
           $value         = preg_replace($specialfilter, ' ', $value);
     
           $search        = array('@<script[^>]*?>.*?</script[^>]*?>@si', // Strip out javascript
                                  '@<style[^>]*?>.*?</style[^>]*?>@si',   // Strip style tags properly
                                  '@<[\/\!]*?[^<>]*?>@si',                // Strip out HTML tags
                                  '@<![\s\S]*?--[ \t\n\r]*>@');           // Strip multi-line comments including CDATA
     
           $value = preg_replace($search, ' ', $value);
     
           // nettoyer l'apostrophe curly qui pose probleme a certains rss-readers, lecteurs de mail...
           $value = str_replace("&#8217;", "'", $value);
     */
     // Problem with this regex : may crash
     //   $value = preg_replace("/ +/u", " ", $value);
     // Revert back htmlawed &amp; -> &
     //$value = str_replace("&amp;", "&", $value);
     $value = str_replace(array("\r\n", "\r"), "\n", $value);
     $value = preg_replace("/(\n[ ]*){2,}/", "\n\n", $value, -1);
     return trim($value);
 }
开发者ID:korial29,项目名称:glpi,代码行数:58,代码来源:html.class.php


示例16: sanitizeHtml

 /**
  * Sanitize HTML
  *
  * @param string $html the html to sanitize
  * @param int $trusted -1, 0, or 1
  * @return string sanitized html
  */
 static function sanitizeHtml($html, $trusted = -1)
 {
     if ($trusted > 0) {
         // Allow all (*) except -script and -iframe
         $config = array('elements' => '*-script-iframe');
     } elseif ($trusted < 0) {
         // Paranoid mode, i.e. only allow a small subset of elements to pass
         // Transform strike and u to span for better XHTML 1-strict compliance
         $config = array('safe' => 1, 'elements' => 'a,em,strike,strong,u,p,br,img,li,ol,ul', 'make_tag_strict' => 1);
     } else {
         // Safe
         $config = array('safe' => 1, 'deny_attribute' => 'style,class', 'comment' => 1);
     }
     require_once dirname(__FILE__) . '/symbionts/htmLawed/htmLawed.php';
     return htmLawed($html, $config);
 }
开发者ID:hashimmm,项目名称:sux0r,代码行数:23,代码来源:suxFunct.php


示例17: SaveAlertContent

function SaveAlertContent($id, $content)
{
    global $connection;
    //filter HTML content with htmLawed
    $content = urldecode($content);
    include "../core/libs/htmLawed.php";
    $content = htmLawed($content, array('safe' => 1));
    //temporary htmLawed settings, move to configuration.php
    $content = $connection->real_escape_string($content);
    $request = "UPDATE alerts_content SET content='{$content}' WHERE id='{$id}'";
    $connection->query($request);
    if ($connection->error) {
        die("failed");
    } else {
        echo "success";
    }
}
开发者ID:borisper1,项目名称:vesi-cms,代码行数:17,代码来源:alerts.php


示例18: importActivityStream

function importActivityStream($user, $doc)
{
    $feed = $doc->documentElement;
    $entries = $feed->getElementsByTagNameNS(Activity::ATOM, 'entry');
    for ($i = $entries->length - 1; $i >= 0; $i--) {
        $entry = $entries->item($i);
        $activity = new Activity($entry, $feed);
        $object = $activity->objects[0];
        if (!have_option('q', 'quiet')) {
            print $activity->content . "\n";
        }
        $html = getTweetHtml($object->link);
        $config = array('safe' => 1, 'deny_attribute' => 'class,rel,id,style,on*');
        $html = htmLawed($html, $config);
        $content = html_entity_decode(strip_tags($html), ENT_QUOTES, 'UTF-8');
        $notice = Notice::saveNew($user->id, $content, 'importtwitter', array('uri' => $object->id, 'url' => $object->link, 'rendered' => $html, 'created' => common_sql_date($activity->time), 'replies' => array(), 'groups' => array()));
    }
}
开发者ID:microcosmx,项目名称:experiments,代码行数:18,代码来源:importtwitteratom.php


示例19: htmlawed_filter_tags

/**
 * htmLawed filtering of tags, called on a plugin hook
 *
 * @param mixed $var Variable to filter
 * @return mixed
 */
function htmlawed_filter_tags($hook, $entity_type, $returnvalue, $params)
{
    $return = $returnvalue;
    $var = $returnvalue;
    if (include_once dirname(__FILE__) . "/vendors/htmLawed/htmLawed.php") {
        global $CONFIG;
        $htmlawed_config = $CONFIG->htmlawed_config;
        if (!is_array($var)) {
            $return = "";
            $return = htmLawed($var, $htmlawed_config);
        } else {
            $return = array();
            foreach ($var as $key => $el) {
                $return[$key] = htmLawed($el, $htmlawed_config);
            }
        }
    }
    return $return;
}
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:25,代码来源:start.php


示例20: parse

 public static function parse($str)
 {
     $state = ['newline'];
     $result = '';
     # Normalize newlines.
     $str = trim($str);
     $str = preg_replace(['/(\\r\\n?)/', '/\\n{3,}/', '/ *\\n */'], ["\n", "\n\n", "\n"], $str);
     $str = htmlentities($str);
     # Keep newline, use carriage return for split.
     $str = str_replace("\n", "\n\r", $str);
     $data = explode("\r", $str);
     # Parse header and list first, line by line.
     foreach ($data as $d) {
         $result .= self::parseline($d, $state);
     }
     # Parse inline tags as a whole.
     $result = self::parseinline($result);
     # htmLawed ensures valid html output.
     require_once Rails::root() . '/vendor/htmLawed/htmLawed.php';
     return htmLawed($result);
 }
开发者ID:JCQS04,项目名称:myimouto,代码行数:21,代码来源:DText.php



注:本文中的htmLawed函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP html函数代码示例发布时间:2022-05-15
下一篇:
PHP ht函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap