当前位置: 首页>>代码示例>>PHP>>正文


PHP purify_html函数代码示例

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


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

示例1: encode

 /**
  * Encodes mixed params before they are sent to the database.
  *
  * @param mixed $data The unencoded object/array/string/etc
  * @return mixed The encoded version
  */
 static function encode(&$data)
 {
     if (is_object($data) || is_array($data)) {
         // skip the ilp_flexible_table
         if (!is_a($data, 'ilp_flexible_table')) {
             foreach ($data as $index => &$datum) {
                 //we will skip any index with the prefix binary
                 if (substr($index, 0, 7) != 'binary_') {
                     $datum = ilp_db::encode($datum);
                 }
             }
         }
         return $data;
     } else {
         // decode any special characters prevent malicious code slipping through
         $data = ilp_db::decode_htmlchars($data, ENT_QUOTES);
         // purify all data (e.g. validate html, remove js and other bad stuff)
         //I have had to remove the purify call as it was causing pages to timeout in 1.9
         //this should be put back in once the ilp is moodle 2.0 only
         $data = purify_html($data);
         // encode the purified string
         $data = trim(preg_replace('/\\\\/', '\', htmlentities($data, ENT_QUOTES, 'utf-8', false)));
         // convert the empty string into null as such values break nullable FK fields
         return $data == '' ? null : $data;
     }
 }
开发者ID:nathanfriend,项目名称:moodle-block_ilp,代码行数:32,代码来源:ilp_db.php

示例2: toArray

 public static function toArray($pin)
 {
     $result = array();
     $result['link'] = purify_url($pin['link']);
     $result['title'] = purify_html($pin['title']);
     $result['created_on'] = strtotime($pin['created_on']);
     return $result;
 }
开发者ID:kaz0636,项目名称:openflp,代码行数:8,代码来源:pin.php

示例3: test_our_tags

 /**
  * Tests the installation of event handlers from file
  */
 function test_our_tags()
 {
     $text = '<nolink>xxx<em>xx</em><div>xxx</div></nolink>';
     $this->assertIdentical($text, purify_html($text));
     $text = '<tex>xxxxxx</tex>';
     $this->assertIdentical($text, purify_html($text));
     $text = '<algebra>xxxxxx</algebra>';
     $this->assertIdentical($text, purify_html($text));
     $text = '<span lang="de_DU" class="multilang">asas</span>';
     $this->assertIdentical($text, purify_html($text));
     $text = '<lang lang="de_DU">xxxxxx</lang>';
     $this->assertIdentical($text, purify_html($text));
     $text = "\n\raa\rsss\nsss\r";
     $this->assertIdentical($text, purify_html($text));
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:18,代码来源:testhtmlpurifier.php

示例4: test_getfeed

    public function test_getfeed()
    {
        $feed = new moodle_simplepie($this->getExternalTestFileUrl('/rsstest.xml'), self::TIMEOUT);
        $this->assertInstanceOf('moodle_simplepie', $feed);
        $this->assertNull($feed->error(), "Failed to load the sample RSS file. Please check your proxy settings in Moodle. %s");
        $this->assertSame('Moodle News', $feed->get_title());
        $this->assertSame('http://moodle.org/mod/forum/view.php?f=1', $feed->get_link());
        $this->assertSame("General news about Moodle.\n\nMoodle is a leading open-source course management system (CMS) - a software package designed to help educators create quality online courses. Such e-learning systems are sometimes also called Learning Management Systems (LMS) or Virtual Learning Environments (VLE). One of the main advantages of Moodle over other systems is a strong grounding in social constructionist pedagogy.", $feed->get_description());
        $this->assertSame('&amp;#169; 2007 moodle', $feed->get_copyright());
        $this->assertSame('http://moodle.org/pix/i/rsssitelogo.gif', $feed->get_image_url());
        $this->assertSame('moodle', $feed->get_image_title());
        $this->assertSame('http://moodle.org/', $feed->get_image_link());
        $this->assertEquals('140', $feed->get_image_width());
        $this->assertEquals('35', $feed->get_image_height());
        $this->assertNotEmpty($items = $feed->get_items());
        $this->assertCount(15, $items);
        $this->assertNotEmpty($itemone = $feed->get_item(0));
        $this->assertSame('Google HOP contest encourages pre-University students to work on Moodle', $itemone->get_title());
        $this->assertSame('http://moodle.org/mod/forum/discuss.php?d=85629', $itemone->get_link());
        $this->assertSame('http://moodle.org/mod/forum/discuss.php?d=85629', $itemone->get_id());
        $description = <<<EOD
by Martin Dougiamas. &nbsp;<p><p><img src="http://code.google.com/opensource/ghop/2007-8/images/ghoplogosm.jpg" align="right" style="margin:10px" />After their very successful <a href="http://code.google.com/soc/2007/">Summer of Code</a> program for University students, Google just announced their new <a href="http://code.google.com/opensource/ghop/2007-8/">Highly Open Participation contest</a>, designed to encourage pre-University students to get involved with open source projects via much smaller and diverse contributions.<br />
<br />
I'm very proud that Moodle has been selected as one of only <a href="http://code.google.com/opensource/ghop/2007-8/projects.html">ten open source projects</a> to take part in the inaugural year of this new contest.<br />
<br />
We have a <a href="http://code.google.com/p/google-highly-open-participation-moodle/issues/list">long list of small tasks</a> prepared already for students, but we would definitely like to see the Moodle community come up with more - so if you have any ideas for things you want to see done, please <a href="http://code.google.com/p/google-highly-open-participation-moodle/">send them to us</a>!  Just remember they can't take more than five days.<br />
<br />
Google will pay students US\$100 for every three tasks they successfully complete, plus send a cool T-shirt.  There are also grand prizes including an all-expenses-paid trip to Google HQ in Mountain View, California.  If you are (or know) a young student with an interest in Moodle then give it a go! <br />
<br />
You can find out all the details on the <a href="http://code.google.com/p/google-highly-open-participation-moodle/">Moodle/GHOP contest site</a>.</p></p>
EOD;
        $description = purify_html($description);
        $this->assertSame($description, $itemone->get_description());
        // TODO fix this so it uses $CFG by default.
        $this->assertSame(1196412453, $itemone->get_date('U'));
        // Last item.
        $this->assertNotEmpty($feed->get_item(14));
        // Past last item.
        $this->assertEmpty($feed->get_item(15));
    }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:40,代码来源:rsslib_test.php

示例5: getArrayInfo

	static function getArrayInfo($raw_data, $full = false){
		if(config_option("wysiwyg_tasks")){
			if($raw_data['type_content'] == "text"){
				$desc = nl2br(htmlspecialchars($raw_data['text']));
			}else{
				$desc = purify_html(nl2br($raw_data['text']));
			}
		}else{
			if($raw_data['type_content'] == "text"){
				$desc = htmlspecialchars($raw_data['text']);
			}else{
				$desc = html_to_text(html_entity_decode(nl2br($raw_data['text']), null, "UTF-8"));
			}
		}

		$member_ids = ObjectMembers::instance()->getCachedObjectMembers($raw_data['id']);
		$tmp_task = new ProjectTask();
		$tmp_task->setObjectId($raw_data['id']);
		$tmp_task->setId($raw_data['id']);
		$tmp_task->setAssignedToContactId($raw_data['assigned_to_contact_id']);
		
		$result = array(
			'id' => $raw_data['id'],
			't' => $raw_data['name'],
			'desc' => $desc,
			'members' => $member_ids,
			'c' => strtotime($raw_data['created_on']),
			'cid' => (int)$raw_data['created_by_id'],
			'otype' => $raw_data['object_subtype'],
			'pc' => (int)$raw_data['percent_completed'],
			'memPath' => str_replace('"',"'", str_replace("'", "\'", json_encode($tmp_task->getMembersToDisplayPath($member_ids))))
		);

		if ($full) {
			$result['description'] = $raw_data['text'];
		}

		$result['mas'] = (int)array_var($raw_data, 'multi_assignment');
			
		if ($raw_data['completed_by_id'] > 0) {
			$result['s'] = 1;
		}
			
		if ($raw_data['parent_id'] > 0) {
			$result['pid'] = (int)$raw_data['parent_id'];
		}
		//if ($this->getPriority() != 200)
		$result['pr'] = (int)$raw_data['priority'];

		if ($raw_data['milestone_id'] > 0) {
			$result['mid'] = (int)$raw_data['milestone_id'];
		}
			
		if ($raw_data['assigned_to_contact_id'] > 0) {
			$result['atid'] = (int)$raw_data['assigned_to_contact_id'];
		}
		$result['atName'] = $tmp_task->getAssignedToName();

		if ($raw_data['completed_by_id'] > 0) {
			$result['cbid'] = (int)$raw_data['completed_by_id'];
			$result['con'] = strtotime($raw_data['completed_on']);;
		}
			
		if ($raw_data['due_date'] != EMPTY_DATETIME) {
			$result['dd'] = strtotime($raw_data['due_date']) + logged_user()->getTimezone() * 3600;
			$result['udt'] = $raw_data['use_due_time'] ? 1 : 0;
		}
		if ($raw_data['start_date'] != EMPTY_DATETIME) {
			$result['sd'] = strtotime($raw_data['start_date']) + logged_user()->getTimezone() * 3600;
			$result['ust'] = $raw_data['use_start_time'] ? 1 : 0;
		}

		$time_estimate = $raw_data['time_estimate'];
		$result['te'] = $raw_data['time_estimate'];
		if ($time_estimate > 0) $result['et'] = DateTimeValue::FormatTimeDiff(new DateTimeValue(0), new DateTimeValue($time_estimate * 60), 'hm', 60) ;


		$result['tz'] = logged_user()->getTimezone() * 3600;

		$ot = $tmp_task->getOpenTimeslots();

		if ($ot){
			$users = array();
			$time = array();
			$paused = array();
			foreach ($ot as $t){
				if (!$t instanceof Timeslot) continue;
				$time[] = $t->getSeconds();
				$users[] = $t->getContactId();
				$paused[] = $t->isPaused()?1:0;
				if ($t->isPaused() && $t->getContactId() == logged_user()->getId()) {
					$result['wpt'] = $t->getPausedOn()->getTimestamp();
				}
			}
			$result['wt'] = $time;
			$result['wid'] = $users;
			$result['wp'] = $paused;
		}

		if ($raw_data['repeat_forever'] > 0 || $raw_data['repeat_num'] > 0 || $raw_data['repeat_end'] != EMPTY_DATETIME) {
//.........这里部分代码省略.........
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:ProjectTasks.class.php

示例6: render_object_link_form

			}
			echo render_object_link_form($task, $pre_linked_objects)
		
		?>
	</fieldset>	
	</div>
	<?php } // if ?>
		
   	
	<div>
                <?php 
                    if(config_option("wysiwyg_tasks")){
                        if(array_var($task_data, 'type_content') == "text"){
                            $ckEditorContent = purify_html(nl2br(array_var($task_data, 'text')));
                        }else{
                            $ckEditorContent = purify_html(nl2br(array_var($task_data, 'text')));
                        }                        
                ?>
		<?php echo label_tag(lang('description'), $genid . 'taskListFormDescription') ?>
                <div id="<?php echo $genid ?>ckcontainer" style="height: 100%">
                    <textarea cols="80" id="<?php echo $genid ?>ckeditor" name="task[text]" rows="10"><?php echo clean($ckEditorContent) ?></textarea>
                </div>
                <script>
                    var h = document.getElementById("<?php echo $genid ?>ckcontainer").offsetHeight;
                    if (h > 300) {
                        h = 280;
                        $("#<?php echo $genid ?>ckcontainer").css('height', (h+20)+'px'); 
                    }
                    var editor = CKEDITOR.replace('<?php echo $genid ?>ckeditor', {
                        height: h,
                        enterMode: CKEDITOR.ENTER_DIV,
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:add_task.php

示例7: get_atom_elements


//.........这里部分代码省略.........
    }
    $apps = $item->get_item_tags(NAMESPACE_STATUSNET, 'notice_info');
    if ($apps && $apps[0]['attribs']['']['source']) {
        $res['app'] = strip_tags(unxmlify($apps[0]['attribs']['']['source']));
    }
    /*
     * If there's a copy of the body content which is guaranteed to have survived mangling in transit, use it.
     */
    $have_real_body = false;
    $rawenv = $item->get_item_tags(NAMESPACE_DFRN, 'env');
    if ($rawenv) {
        $have_real_body = true;
        $res['body'] = $rawenv[0]['data'];
        $res['body'] = str_replace(array(' ', "\t", "\r", "\n"), array('', '', '', ''), $res['body']);
        // make sure nobody is trying to sneak some html tags by us
        $res['body'] = notags(base64url_decode($res['body']));
        // We could probably turn these old Friendica bbcode bookmarks into bookmark tags but we'd have to
        // create a term table item for them. For now just make sure they stay as links.
        $res['body'] = preg_replace('/\\[bookmark(.*?)\\](.*?)\\[\\/bookmark\\]/', '[url$1]$2[/url]', $res['body']);
    }
    $res['body'] = limit_body_size($res['body']);
    // It isn't certain at this point whether our content is plaintext or html and we'd be foolish to trust
    // the content type. Our own network only emits text normally, though it might have been converted to
    // html if we used a pubsubhubbub transport. But if we see even one html tag in our text, we will
    // have to assume it is all html and needs to be purified.
    // It doesn't matter all that much security wise - because before this content is used anywhere, we are
    // going to escape any tags we find regardless, but this lets us import a limited subset of html from
    // the wild, by sanitising it and converting supported tags to bbcode before we rip out any remaining
    // html.
    if (strpos($res['body'], '<') !== false && strpos($res['body'], '>') !== false) {
        $res['body'] = reltoabs($res['body'], $base_url);
        $res['body'] = html2bb_video($res['body']);
        $res['body'] = oembed_html2bbcode($res['body']);
        $res['body'] = purify_html($res['body']);
        $res['body'] = @html2bbcode($res['body']);
    } elseif (!$have_real_body) {
        // it's not one of our messages and it has no tags
        // so it's probably just text. We'll escape it just to be safe.
        $res['body'] = escape_tags($res['body']);
    }
    if ($res['plink'] && $res['title']) {
        $res['body'] = '#^[url=' . $res['plink'] . ']' . $res['title'] . '[/url]' . "\n\n" . $res['body'];
        $terms = array();
        $terms[] = array('otype' => TERM_OBJ_POST, 'type' => TERM_BOOKMARK, 'url' => $res['plink'], 'term' => $res['title']);
    } elseif ($res['plink']) {
        $res['body'] = '#^[url]' . $res['plink'] . '[/url]' . "\n\n" . $res['body'];
        $terms = array();
        $terms[] = array('otype' => TERM_OBJ_POST, 'type' => TERM_BOOKMARK, 'url' => $res['plink'], 'term' => $res['plink']);
    }
    $private = $item->get_item_tags(NAMESPACE_DFRN, 'private');
    if ($private && intval($private[0]['data']) > 0) {
        $res['item_private'] = intval($private[0]['data']) ? 1 : 0;
    } else {
        $res['item_private'] = 0;
    }
    $rawlocation = $item->get_item_tags(NAMESPACE_DFRN, 'location');
    if ($rawlocation) {
        $res['location'] = unxmlify($rawlocation[0]['data']);
    }
    $rawcreated = $item->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'published');
    if ($rawcreated) {
        $res['created'] = unxmlify($rawcreated[0]['data']);
    }
    $rawedited = $item->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated');
    if ($rawedited) {
        $res['edited'] = unxmlify($rawedited[0]['data']);
开发者ID:einervonvielen,项目名称:redmatrix,代码行数:67,代码来源:items.php

示例8: DateTimeValue

            } else {
                $real_start = $event_start;
            }
            if ($event->getDueDate() instanceof DateTimeValue) {
                $real_duration = new DateTimeValue($event->getDueDate()->getTimestamp() + 3600 * logged_user()->getTimezone());
            } else {
                $real_duration = $event_duration;
            }
        }
    }
    $pre_tf = $real_start->getDay() == $real_duration->getDay() ? '' : 'D j, ';
    $ev_hour_text = format_date($real_start, $pre_tf . $timeformat, 0) . " - " . format_date($real_duration, $pre_tf . $timeformat, 0);
    $assigned = "";
    if ($event instanceof ProjectTask && $event->getAssignedToContactId() > 0) {
        $assigned = "<br>" . lang('assigned to') . ': ' . $event->getAssignedToName();
        $tipBody = purify_html($event->getText());
    } else {
        $tipBody = $ev_hour_text . $assigned . (trim(clean($event->getDescription())) != '' ? '<br><br>' . clean($event->getDescription()) : '');
        $tipBody = str_replace(array("\r", "\n"), array(' ', '<br>'), $tipBody);
    }
    if (strlen_utf($tipBody) > 200) {
        $tipBody = substr_utf($tipBody, 0, strpos($tipBody, ' ', 200)) . ' ...';
    }
    ?>
												<script>
													if (<?php 
    echo $top;
    ?>
 < scroll_to || scroll_to == -1) {
														scroll_to = <?php 
    echo $top;
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:31,代码来源:viewdate.php

示例9: clean

<div class="print-view-message">

<div class="header">
<h1><?php echo clean($message->getObjectName()); ?></h1>
<b><?php echo lang('from') ?>:</b> <?php echo clean($message->getCreatedByDisplayName()) ?><br />
<b><?php echo lang('date') ?>:</b> <?php echo format_datetime($message->getUpdatedOn(), null, logged_user()->getTimezone()) ?><br />
<b><?php /*FIXME echo lang('workspace') ?>:</b> <?php echo clean($message->getWorkspacesNamesCSV()) */?><br />
</div>

<div class="body">
<?php 
    if($message->getTypeContent() == "text"){
        echo escape_html_whitespace(convert_to_links(clean($message->getText())));
    }else{
        echo purify_html(nl2br($message->getText()));
    }
?>
</div>

<?php
$i = 0;
$comments = $message->getComments();
if (count($comments) > 0) {
?>
<div class="comments">
<h2><?php echo lang("comments") ?></h2>
<?php foreach ($comments as $comment) {
	$i++;
?>
	<div class="comment">
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:30,代码来源:print_view.php

示例10: clean_text

/**
 * Given raw text (eg typed in by a user), this function cleans it up
 * and removes any nasty tags that could mess up Moodle pages.
 *
 * @uses FORMAT_MOODLE
 * @uses FORMAT_PLAIN
 * @uses ALLOWED_TAGS
 * @param string $text The text to be cleaned
 * @param int $format Identifier of the text format to be used
 *            (FORMAT_MOODLE, FORMAT_HTML, FORMAT_PLAIN, FORMAT_WIKI, FORMAT_MARKDOWN)
 * @return string The cleaned up text
 */
function clean_text($text, $format = FORMAT_MOODLE)
{
    global $ALLOWED_TAGS, $CFG;
    if (empty($text) or is_numeric($text)) {
        return (string) $text;
    }
    switch ($format) {
        case FORMAT_PLAIN:
        case FORMAT_MARKDOWN:
            return $text;
        default:
            if (!empty($CFG->enablehtmlpurifier)) {
                $text = purify_html($text);
            } else {
                /// Fix non standard entity notations
                $text = preg_replace('/(&#[0-9]+)(;?)/', "\\1;", $text);
                $text = preg_replace('/(&#x[0-9a-fA-F]+)(;?)/', "\\1;", $text);
                /// Remove tags that are not allowed
                $text = strip_tags($text, $ALLOWED_TAGS);
                /// Clean up embedded scripts and , using kses
                $text = cleanAttributes($text);
                /// Again remove tags that are not allowed
                $text = strip_tags($text, $ALLOWED_TAGS);
            }
            /// Remove potential script events - some extra protection for undiscovered bugs in our code
            $text = eregi_replace("([^a-z])language([[:space:]]*)=", "\\1Xlanguage=", $text);
            $text = eregi_replace("([^a-z])on([a-z]+)([[:space:]]*)=", "\\1Xon\\2=", $text);
            return $text;
    }
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:42,代码来源:weblib.php

示例11: lang

	<fieldset>
		<legend><?php echo lang('linked objects') ?></legend>
		<?php echo render_object_link_form($object) ?>
	</fieldset>	
	</div>
	<?php } // if ?>
	
	<?php
		if(config_option("wysiwyg_messages")){
			if($message->isNew()) {
				$ckEditorContent = '';
			} else {
				if(array_var($message_data, 'type_content') == "text"){
					$ckEditorContent = nl2br(htmlspecialchars(array_var($message_data, 'text')));
				}else{
					$ckEditorContent = purify_html(nl2br(array_var($message_data, 'text')));
				}
			}
		?>
        <div>
            <?php echo label_tag(lang('text'), $genid . 'messageFormText', false) ?>
            <div id="<?php echo $genid ?>ckcontainer" style="height: 350px">
                <textarea cols="80" id="<?php echo $genid ?>ckeditor" name="message[text]" rows="10"><?php echo clean($ckEditorContent) ?></textarea>
            </div>
        </div>
        
        <script>
            var h = document.getElementById("<?php echo $genid ?>ckcontainer").offsetHeight;
            var editor = CKEDITOR.replace('<?php echo $genid ?>ckeditor', {
            	height: (h-60) + 'px',
            	enterMode: CKEDITOR.ENTER_DIV,
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:add_message.php

示例12: display_content

	function display_content() {
		
		$file = ProjectFiles::findById(get_id());
		if (!$file instanceof ProjectFile) {
			die(lang("file dnx"));
		}
		if (!$file->canView(logged_user())) {
			die(lang("no access permissions"));
		}
		
		if (defined('SANDBOX_URL')) {
			$html_content = $file->getFileContentWithRealUrls();
		} else {
			$html_content = purify_html($file->getFileContentWithRealUrls());
		}
		$charset = "";
		if ($file->getTypeString() == "text/html") {
			$encoding = detect_encoding($html_content, array('UTF-8', 'ISO-8859-1', 'WINDOWS-1252'));
			$charset = ";charset=".$encoding;
		}
		
		if ($file->getTypeString() == 'text/html') {
			// Include stylesheet from FCK Editor
			$css = '<style type="text/css">';
			$css .= file_get_contents(ROOT.'/public/assets/javascript/ckeditor/contents.css');
			$css .= '</style>';
			$html_content = $css.$html_content;
		}
		
		header("Expires: " . gmdate("D, d M Y H:i:s", mktime(date("H") + 2, date("i"), date("s"), date("m"), date("d"), date("Y"))) . " GMT");
		header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
		header("Content-Type: " . $file->getTypeString() . $charset);
		header("Content-Length: " . (string) strlen($html_content));

		print($html_content);
		die();
	}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:37,代码来源:FilesController.class.php

示例13: test_allowed_schemes

 public function test_allowed_schemes()
 {
     // First standard schemas.
     $text = '<a href="http://www.example.com/course/view.php?id=5">link</a>';
     $this->assertSame($text, purify_html($text));
     $text = '<a href="https://www.example.com/course/view.php?id=5">link</a>';
     $this->assertSame($text, purify_html($text));
     $text = '<a href="ftp://user@ftp.example.com/some/file.txt">link</a>';
     $this->assertSame($text, purify_html($text));
     $text = '<a href="nntp://example.com/group/123">link</a>';
     $this->assertSame($text, purify_html($text));
     $text = '<a href="news:groupname">link</a>';
     $this->assertSame($text, purify_html($text));
     $text = '<a href="mailto:user@example.com">link</a>';
     $this->assertSame($text, purify_html($text));
     // Extra schemes allowed in moodle.
     $text = '<a href="irc://irc.example.com/3213?pass">link</a>';
     $this->assertSame($text, purify_html($text));
     $text = '<a href="rtsp://www.example.com/movie.mov">link</a>';
     $this->assertSame($text, purify_html($text));
     $text = '<a href="rtmp://www.example.com/video.f4v">link</a>';
     $this->assertSame($text, purify_html($text));
     $text = '<a href="teamspeak://speak.example.com/?par=val?par2=val2">link</a>';
     $this->assertSame($text, purify_html($text));
     $text = '<a href="gopher://gopher.example.com/resource">link</a>';
     $this->assertSame($text, purify_html($text));
     $text = '<a href="mms://www.example.com/movie.mms">link</a>';
     $this->assertSame($text, purify_html($text));
     // Now some borked or dangerous schemes.
     $text = '<a href="javascript://www.example.com">link</a>';
     $this->assertSame('<a>link</a>', purify_html($text));
     $text = '<a href="hmmm://www.example.com">link</a>';
     $this->assertSame('<a>link</a>', purify_html($text));
 }
开发者ID:rushi963,项目名称:moodle,代码行数:34,代码来源:htmlpurifier_test.php

示例14: image_url

                                    $img_url = image_url('/16x16/task_end.png');
                                    $tip_pre = 'end_';
                                } else {
                                    $tip_title = lang('start of task');
                                    $img_url = image_url('/16x16/task_start.png');
                                    $tip_pre = 'st_';
                                }
                            }
                            $tip_pre .= gen_id() . "_";
                            $count++;
                            if ($count <= $max_events_to_show) {
                                $color = 'B1BFAC';
                                $subject = clean($task->getObjectName()) . '- <span class="italic">' . lang('task') . '</span>';
                                $cal_text = clean($task->getObjectName());
                                $tip_text = str_replace("\r", '', lang('assigned to') . ': ' . clean($task->getAssignedToName()) . (trim($task->getText()) == '' ? '' : '<br><br>' . html_to_text($task->getText())));
                                $tip_text = purify_html(str_replace("\n", '<br>', $tip_text));
                                if (strlen_utf($tip_text) > 200) {
                                    $tip_text = substr_utf($tip_text, 0, strpos($tip_text, ' ', 200)) . ' ...';
                                }
                                ?>
													<div id="m_ta_div_<?php 
                                echo $tip_pre . $task->getId();
                                ?>
" class="<?php 
                                echo "og-wsname-color-{$ws_color}";
                                ?>
" style="height:20px;margin: 1px;padding-left:1px;padding-bottom:0px;border-radius:4px;border: 1px solid;border-color:<?php 
                                echo $border_color;
                                ?>
;<?php 
                                echo $extra_style;
开发者ID:abhinay100,项目名称:feng_app,代码行数:31,代码来源:calendar.php

示例15: test_purify_html_ruby

 public function test_purify_html_ruby()
 {
     $this->resetAfterTest();
     $ruby = "<p><ruby><rb>京都</rb><rp>(</rp><rt>きょうと</rt><rp>)</rp></ruby>は" . "<ruby><rb>日本</rb><rp>(</rp><rt>にほん</rt><rp>)</rp></ruby>の" . "<ruby><rb>都</rb><rp>(</rp><rt>みやこ</rt><rp>)</rp></ruby>です。</p>";
     $illegal = '<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>';
     $cleaned = purify_html($ruby . $illegal);
     $this->assertEquals($ruby, $cleaned);
 }
开发者ID:sirromas,项目名称:lms,代码行数:8,代码来源:weblib_test.php


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