本文整理汇总了PHP中html::clean方法的典型用法代码示例。如果您正苦于以下问题:PHP html::clean方法的具体用法?PHP html::clean怎么用?PHP html::clean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html
的用法示例。
在下文中一共展示了html::clean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: thumb_info
static function thumb_info($theme, $item)
{
$results = "";
if ($item->view_count) {
$results .= "<li>";
$results .= t("Views: %view_count", array("view_count" => $item->view_count));
$results .= "</li>";
}
// rWatcher Edit: Display Tags
if (module::is_active("tag")) {
$tags = ORM::factory("tag")->join("items_tags", "tags.id", "items_tags.tag_id")->where("items_tags.item_id", "=", $item->id)->find_all();
if (count($tags) > 0) {
$results .= "<li>";
$results .= t("Tags:") . " ";
$anchors = array();
foreach ($tags as $tag) {
$anchors[] = "<a href=" . $tag->url() . ">" . html::clean($tag->name) . "</a>";
}
$results .= join(", ", $anchors) . "</li>";
}
}
// rWatcher End Edit
if ($item->owner) {
$results .= "<li>";
if ($item->owner->url) {
$results .= t("By: <a href=\"%owner_url\">%owner_name</a>", array("owner_name" => $item->owner->display_name(), "owner_url" => $item->owner->url));
} else {
$results .= t("By: %owner_name", array("owner_name" => $item->owner->display_name()));
}
$results .= "</li>";
}
return $results;
}
示例2: mark_clean_test
public function mark_clean_test()
{
$safe_string = html::mark_clean("hello <p >world</p>");
$this->assert_true($safe_string instanceof SafeString);
$safe_string_2 = html::clean($safe_string);
$this->assert_equal("hello <p >world</p>", $safe_string_2);
}
示例3: thumb_info
static function thumb_info($theme, $item)
{
$results = "";
if ($item->view_count) {
$results .= "<li>";
$results .= t("Views: %view_count", array("view_count" => $item->view_count));
$results .= "</li>";
}
if (module::is_active("tag")) {
$tagsItem = ORM::factory("tag")->join("items_tags", "tags.id", "items_tags.tag_id")->where("items_tags.item_id", $item->id)->find_all();
if (count($tagsItem) > 0) {
$results .= "<li>";
$results .= t("Tags:") . " ";
for ($counter = 0; $counter < count($tagsItem); $counter++) {
if ($counter < count($tagsItem) - 1) {
$results .= "<a href=" . url::site("tags/{$tagsItem[$counter]}") . ">" . html::clean($tagsItem[$counter]->name) . "</a>, ";
} else {
$results .= "<a href=" . url::site("tags/{$tagsItem[$counter]}") . ">" . html::clean($tagsItem[$counter]->name) . "</a>";
}
}
$results .= "</li>";
}
}
if ($item->owner) {
$results .= "<li>";
if ($item->owner->url) {
$results .= t("By: %owner_name", array("owner_name" => "<a href=\"{$item->owner->url}\">{$item->owner->full_name}</a>"));
} else {
$results .= t("By: %owner_name", array("owner_name" => "{$item->owner->full_name}"));
}
$results .= "</li>";
}
return $results;
}
示例4: autocomplete
public function autocomplete()
{
$tags = array();
$tag_parts = explode(",", Input::instance()->get("term"));
$tag_part = ltrim(end($tag_parts));
$tag_list = ORM::factory("tag")->where("name", "LIKE", Database::escape_for_like($tag_part) . "%")->order_by("name", "ASC")->limit(100)->find_all();
foreach ($tag_list as $tag) {
$tags[] = (string) html::clean($tag->name);
}
ajax::response(json_encode($tags));
}
示例5: autocomplete
public function autocomplete()
{
$directories = array();
$path_prefix = Input::instance()->get("term");
foreach (glob("{$path_prefix}*") as $file) {
if (is_dir($file) && !is_link($file)) {
$directories[] = (string) html::clean($file);
}
}
ajax::response(json_encode($directories));
}
示例6: autocomplete
public function autocomplete()
{
$directories = array();
$path_prefix = Input::instance()->get("q");
foreach (glob("{$path_prefix}*") as $file) {
if (is_dir($file) && !is_link($file)) {
$directories[] = html::clean($file);
}
}
ajax::response(implode("\n", $directories));
}
示例7: autocomplete
public function autocomplete()
{
$tags = array();
$tag_parts = explode(",", Input::instance()->get("q"));
$limit = Input::instance()->get("limit");
$tag_part = ltrim(end($tag_parts));
$tag_list = ORM::factory("tag")->where("name", "LIKE", "{$tag_part}%")->order_by("name", "ASC")->limit($limit)->find_all();
foreach ($tag_list as $tag) {
$tags[] = html::clean($tag->name);
}
ajax::response(implode("\n", $tags));
}
示例8: logout
static function logout()
{
$user = identity::active_user();
if (!$user->guest) {
try {
Session::instance()->destroy();
} catch (Exception $e) {
Kohana::log("error", $e);
}
module::event("user_logout", $user);
}
log::info("user", t("User %name logged out", array("name" => $user->name)), html::anchor("user/{$user->id}", html::clean($user->name)));
}
示例9: logout
static function logout()
{
$user = identity::active_user();
if (!$user->guest) {
try {
Session::instance()->destroy();
} catch (Exception $e) {
Kohana_Log::add("error", $e);
}
module::event("user_logout", $user);
}
log::info("user", t("User %name logged out", array("name" => $user->name)), t('<a href="%url">%user_name</a>', array("url" => user_profile::url($user->id), "user_name" => html::clean($user->name))));
}
示例10: send
public function send($id)
{
access::verify_csrf();
$user = identity::lookup_user($id);
$form = user_profile::get_contact_form($user);
if ($form->validate()) {
Sendmail::factory()->to($user->email)->subject(html::clean($form->message->subject->value))->header("Mime-Version", "1.0")->header("Content-type", "text/html; charset=iso-8859-1")->reply_to($form->message->reply_to->value)->message(html::purify($form->message->message->value))->send();
message::success(t("Sent message to %user_name", array("user_name" => $user->display_name())));
print json_encode(array("result" => "success"));
} else {
print json_encode(array("result" => "error", "form" => (string) $form));
}
}
示例11: index
public function index()
{
//access::verify_csrf();
$user = user::active();
user::logout();
log::info("user", t("User %name logged out", array("name" => $user->name)), html::anchor("user/{$user->id}", html::clean($user->name)));
if ($continue_url = $this->input->get("continue")) {
$item = url::get_item_from_uri($continue_url);
if (access::can("view", $item)) {
// Don't use url::redirect() because it'll call url::site() and munge the continue url.
header("Location: {$continue_url}");
} else {
url::redirect(item::root()->abs_url());
}
}
}
示例12: send
public function send($id)
{
access::verify_csrf();
$user = identity::lookup_user($id);
if (!$this->_can_view_profile_pages($user)) {
throw new Kohana_404_Exception();
}
$form = user_profile::get_contact_form($user);
if ($form->validate()) {
Sendmail::factory()->to($user->email)->subject(html::clean($form->message->subject->value))->header("Mime-Version", "1.0")->header("Content-type", "text/html; charset=UTF-8")->reply_to($form->message->reply_to->value)->message(html::purify($form->message->message->value))->send();
message::success(t("Sent message to %user_name", array("user_name" => $user->display_name())));
json::reply(array("result" => "success"));
} else {
json::reply(array("result" => "error", "html" => (string) $form));
}
}
示例13: html_element
protected function html_element()
{
// Import the data
$data = $this->data;
if (empty($data['checked'])) {
// Not checked
unset($data['checked']);
} else {
// Is checked
$data['checked'] = 'checked';
}
if ($label = arr::remove('label', $data)) {
// There must be one space before the text
$label = ' ' . ltrim($label);
}
return '<label>' . form::input($data) . html::clean($label) . '</label>';
}
示例14: process
public function process($do)
{
if ($do == 'ok') {
$this->status = true;
return;
}
if (empty($_POST['feed_url'])) {
return;
}
$this->feed_url = $_POST['feed_url'];
$feed = feedReader::quickParse($this->feed_url);
if ($feed === false) {
throw new Exception(__('Cannot retrieve feed URL.'));
}
if (count($feed->items) == 0) {
throw new Exception(__('No items in feed.'));
}
if ($this->core->plugins->moduleExists('metadata')) {
$meta = new dcMeta($this->core);
}
$cur = $this->core->con->openCursor($this->core->prefix . 'post');
$this->core->con->begin();
foreach ($feed->items as $item) {
$cur->clean();
$cur->user_id = $this->core->auth->userID();
$cur->post_content = $item->content ? $item->content : $item->description;
$cur->post_title = $item->title ? $item->title : text::cutString(html::clean($cur->post_content), 60);
$cur->post_format = 'xhtml';
$cur->post_status = -2;
$cur->post_dt = strftime('%Y-%m-%d %H:%M:%S', $item->TS);
try {
$post_id = $this->core->blog->addPost($cur);
} catch (Exception $e) {
$this->core->con->rollback();
throw $e;
}
if (isset($meta)) {
foreach ($item->subject as $subject) {
$meta->setPostMeta($post_id, 'tag', dcMeta::sanitizeMetaID($subject));
}
}
}
$this->core->con->commit();
http::redirect($this->getURL() . '&do=ok');
}
示例15: get
static function get($block_id, $theme)
{
switch ($block_id) {
case "aboutthisalbum":
$item = $theme->item;
if (!$item or !$theme->item->is_album()) {
return "";
}
if ($theme->item->is_album()) {
$block = new Block();
$block->css_id = "g-about-this-album";
$block->content = new View("about_this_album.html");
if ($theme->item()->id == item::root()->id) {
$block->title = t("About this Site");
$block->content->album_count = ORM::factory("item")->where("type", "=", "album")->where("id", "<>", 1)->count_all();
$block->content->photo_count = ORM::factory("item")->where("type", "=", "photo")->count_all();
$block->content->vcount = Database::instance()->query("SELECT SUM({items}.view_count) as c FROM {items} WHERE type=\"photo\"")->current()->c;
} else {
$block->title = t("About this Album");
$block->content->album_count = $item->descendants_count(array(array("type", "=", "album")));
$block->content->photo_count = $item->descendants_count(array(array("type", "=", "photo")));
// $block->content->vcount= $theme->item()->view_count;
$descds = $item->descendants();
$descds_view = 0;
foreach ($descds as $descd) {
if ($descd->is_photo()) {
$descds_view += $descd->view_count;
}
}
$block->content->vcount = $descds_view;
if ($item->description) {
$block->content->description = html::clean($item->description);
}
}
$all_tags = ORM::factory("tag")->join("items_tags", "items_tags.tag_id", "tags.id")->join("items", "items.id", "items_tags.item_id", "LEFT")->where("items.parent_id", "=", $item->id)->order_by("tags.id", "ASC")->find_all();
if (count($all_tags) > 0) {
$block->content->all_tags = $all_tags;
}
}
break;
}
return $block;
}