本文整理汇总了PHP中General::validateUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP General::validateUrl方法的具体用法?PHP General::validateUrl怎么用?PHP General::validateUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类General
的用法示例。
在下文中一共展示了General::validateUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insertComment
function insertComment($comment, $isSpam = false)
{
$comment['author_id'] = NULL;
$author_id = $this->_parent->isLoggedIn();
if ($author_id !== false) {
$comment['author_id'] = $author_id;
}
$comment['author_ip'] = $_SERVER['REMOTE_ADDR'];
####
# Delegate: CommentPreProcess
# Description: Just before the comment is processed and saved. Good place to manipulate the data.
$this->_parent->_CampfireManager->notifyMembers('CommentPreProcess', '/frontend/', array('isSpam' => &$isSpam, 'comment' => &$comment));
$this->isLastCommentSpam = $isSpam;
unset($comment['remember']);
$section = $this->_db->fetchRow(0, "SELECT * FROM tbl_sections WHERE `handle` = '" . $comment['section'] . "' LIMIT 1");
if (!is_array($section) || empty($section)) {
$this->_notices[] = 'Invalid section specified.';
return false;
}
unset($comment['section']);
if (isset($comment['entry_handle'])) {
include_once TOOLKIT . "/class.entrymanager.php";
$entryManager = new EntryManager($this->_parent);
$entry_id = $entryManager->fetchEntryIDFromPrimaryFieldHandle($section['id'], $comment['entry_handle']);
$comment['entry_id'] = $entry_id[0];
unset($comment['entry_handle']);
}
if (!($entry = $entryManager->fetchEntriesByID($comment['entry_id'], false, true))) {
$this->_notices[] = 'Invalid entry handle specified.';
return false;
}
if ($section['commenting'] == 'off') {
return false;
}
$this->_notices = array();
$valid = $this->__validateComment($comment);
if (!isset($this->_options['override-automatic-spam-detection']) || $this->_options['override-automatic-spam-detection'] == false) {
$spam = $this->__isSpam($comment) || $this->__isBlackListed($comment['author_ip']);
} else {
$spam = $isSpam || $this->__isBlackListed($comment['author_ip']) ? true : false;
}
$comment = array_map(array($this, "__doBanWords"), $comment);
$options = $this->_options;
require_once LIBRARY . "/core/class.textformattermanager.php";
$TFM = new TextformatterManager(array('parent' => &$this->_parent));
if ($options['formatting-type'] != NULL && ($formatter = $TFM->create($options['formatting-type']))) {
$comment['body'] = $formatter->run($comment['body']);
} else {
$comment['body'] = strip_tags($comment['body']);
}
$comment['author_url'] = General::validateUrl($comment['author_url']);
$comment['spam'] = $spam ? "yes" : "no";
##Check the comment body for well-formedness
$xml_errors = array();
General::validateXML($comment['body'], $xml_errors, false);
if (!empty($xml_errors)) {
$xml_errors = array();
$comment['body'] = str_replace(array('<', '>', '&'), array('<', '>', '&'), $comment['body']);
General::validateXML($comment['body'], $xml_errors, false, new XsltProcess());
if (!empty($xml_errors)) {
$this->_notices[] = "Comment contains invalid text or markup.";
return false;
}
}
##
##Check the comment name field for well-formedness
$xml_errors = array();
General::validateXML($comment['author_name'], $xml_errors, false);
if (!empty($xml_errors)) {
$this->_notices[] = "Author name contains invalid text or markup.";
}
##
$dupe = $options['allow-duplicates'] == "on" ? false : $this->__isDuplicateComment($comment);
$nuke_comment = !empty($xml_errors) || $spam && $options['nuke-spam'] == 'on';
####
# Delegate: CommentPreSave
# Description: Just before the comment is inserted into the database. Also, final checks
# of its validity have been performed. Good place to manipulate the data and check values
$this->_parent->_CampfireManager->notifyMembers('CommentPreSave', '/frontend/', array('nuke' => &$nuke_comment, 'dupe' => &$dupe, 'comment' => &$comment));
if (!$nuke_comment && $valid && !$dupe) {
if ($spam) {
$this->isLastCommentSpam = true;
}
unset($comment['author_ip']);
if ($this->_db->insert($comment, "tbl_comments")) {
$comment_id = $this->_db->getInsertID();
$this->_parent->updateMetadata("comment", $comment_id);
####
# Delegate: CommentPostSave
# Description: After inserting comment into database. Comment ID is provided
$this->_parent->_CampfireManager->notifyMembers('CommentPostSave', '/frontend/', array('id' => $comment_id));
if ($options['email-notify'] == 'on' && !$spam) {
$this->__emailEntryAuthor($comment, $entry);
}
return true;
} else {
$this->_notices[] = 'Comment not successfully saved. An unknown error has occurred.';
}
} else {
if (!$valid || $nuke_comment) {
//.........这里部分代码省略.........
示例2: empty
print $comment_id;
?>
"<?php
print $comment_body_short != $comment_body ? ' title="' . $comment_body . '"' : "";
?>
">
<?php
print $comment_body_short;
?>
</a></td>
<td><?php
print $date->get(true, true, $comment_creation_timestamp_gmt);
?>
</td>
<td><?php
print empty($comment_author_url) ? $comment_author_name : "<a href=\"" . General::validateUrl($comment_author_url) . "\" title=\"{$comment_author_name}'s website\">{$comment_author_name}</a>";
?>
<input name="items[<?php
print $comment_id;
?>
]" type="checkbox" /></td>
</tr>
<?php
$bEven = !$bEven;
}
}
?>
</tbody>
</table>