本文整理汇总了PHP中Text::htmldecode方法的典型用法代码示例。如果您正苦于以下问题:PHP Text::htmldecode方法的具体用法?PHP Text::htmldecode怎么用?PHP Text::htmldecode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Text
的用法示例。
在下文中一共展示了Text::htmldecode方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __setup_crawl__
/**
* Planet クロールする
**/
public static function __setup_crawl__()
{
$http_feed = new Feed();
foreach (C(PlanetSubscription)->find_all() as $subscription) {
Exceptions::clear();
Log::debug(sprintf('[crawl] feed: %d (%s)', $subscription->id(), $subscription->title()));
try {
$feed = $http_feed->do_read($subscription->rss_url());
$subscription->title($feed->title());
if ($feed->is_link()) {
$subscription->link(self::_get_link_href($feed->link()));
}
$subscription->rss_url($http_feed->url());
$subscription->save(true);
foreach ($feed->entry() as $entry) {
Exceptions::clear();
try {
$planet_entry = new PlanetEntry();
$planet_entry->subscription_id($subscription->id());
$planet_entry->title(Tag::cdata($entry->title()));
$planet_entry->description(Text::htmldecode(Tag::cdata($entry->fm_content())));
$planet_entry->link($entry->first_href());
$planet_entry->updated($entry->published());
$planet_entry->save();
} catch (Exception $e) {
Log::warn($e->getMessage());
}
}
} catch (Exception $e) {
Log::error($e);
}
}
}
示例2: diff
public function diff($path, $revA, $revB)
{
$url = sprintf("http://%s.svn.sourceforge.net/viewvc/%s/%s?r1=%d&r2=%d&diff_format=u", $this->project, $this->project, $path, $revA, $revB);
if (Tag::setof($tag, $this->do_get($url)->body(), "body")) {
$result = Text::htmldecode(preg_replace("/^\\+{3} .+\n/", "", preg_replace("/^-{3} .+\n/", "", trim($tag->f("pre.value()")))));
if ($result !== "400 Bad Request") {
return $result;
}
}
throw new Exception("undef");
}
示例3: parse_search_list
public static function parse_search_list($response)
{
$results = array();
if (Tag::setof($atom, $response, "feed")) {
foreach ($atom->in("entry") as $entry) {
$self = new self();
$self->id(preg_replace("/^.+\\:([\\d]+)\$/", "\\1", $entry->f("id.value()")));
$self->text($entry->f("title.value()"));
$self->source(Text::htmldecode($entry->f("twitter:source.value()")));
$self->created_at($atom->f("published.value()"));
$user = new TwitterUser();
$user->name(str_replace("http://twitter.com/", "", Text::htmldecode($entry->f("author.uri.value()"))));
$user->screen_name(Text::htmldecode($entry->f("author.name.value()")));
$user->profile_image_url(Text::htmldecode($entry->f("link[1].param(href)")));
$self->user($user);
$results[] = $self;
}
}
return $results;
}
示例4: diff
public function diff($path, $revA, $revB)
{
$url = sprintf("http://code.google.com/p/%s/source/diff?old=%d&r=%d&format=unidiff&path=%s", $this->project, $revA, $revB, $path);
$src = $this->do_get($url)->body();
if (Tag::setof($tag, $src, "body")) {
$lines = "";
$block = "";
$fs = $ts = $fl = $tl = 0;
$blocks = $tag->f("table[5].in(tr)");
foreach ($blocks as $tr) {
$from = $tr->f("th[0].value()");
if ($from == "...") {
if (!empty($block)) {
$lines .= sprintf("@@ -%d,%d +%d,%d @@\n%s", $fs, $fl, $ts, $tl, $block);
}
$block = "";
$fs = $ts = $fl = $tl = 0;
} else {
$to = $tr->f("th[1].value()");
if ($fs == 0 && !empty($from)) {
$fs = $from;
}
if ($ts == 0 && !empty($to)) {
$ts = $to;
}
if (!empty($from)) {
$fl++;
}
if (!empty($to)) {
$tl++;
}
$block .= Text::htmldecode(strip_tags($tr->f("th[2].value()") . $tr->f("td.value()")) . "\n");
}
}
return $lines;
}
throw new Exception("undef");
}
示例5: __in_param__
/**
* パラメータを取得
*
* @param string $name
* @param mixed $default
* @return string
*/
protected final function __in_param__($name, $default = null)
{
$name = strtolower($name);
$result = isset($this->param[$name]) ? $this->param[$name] : null;
$result = $result === null ? $default : $result[1];
return $this->cdata_value ? Text::htmldecode($result) : $result;
/***
$tag = new Tag("hoge","abc");
$tag->add("aaa","123")->add("bbb","456");
eq("123",$tag->in_param("aaa","hoge"));
eq("123",$tag->in_param("aAa","hoge"));
eq("hoge",$tag->in_param("ccc","hoge"));
*/
}
示例6: htmldecode
/**
* htmlデコードをする
* @param string $value 対象の文字列
* @return string
*/
public function htmldecode($value)
{
return Text::htmldecode(self::cdata($value));
/***
$t = new self();
eq("ほげほげ",$t->htmldecode("ほげほげ"));
eq("><ほげ& ほげ",$t->htmldecode("&gt;&lt;ほげ& ほげ"));
eq("<abc />",$t->htmldecode("<![CDATA[<abc />]]>"));
*/
}
示例7: htmldecode
/**
* htmlデコードをする
* @param string $value
* @return string
*/
public static final function htmldecode($value)
{
return Text::htmldecode(Tag::cdata($value));
}
示例8: parse_form
private function parse_form()
{
$tag = Tag::anyhow($this->body);
foreach ($tag->in("form") as $key => $formtag) {
$form = new stdClass();
$form->name = $formtag->in_param("name", $formtag->in_param("id", $key));
$form->action = File::absolute($this->url, $formtag->in_param("action", $this->url));
$form->method = strtolower($formtag->in_param("method", "get"));
$form->multiple = false;
$form->element = array();
foreach ($formtag->in("input") as $count => $input) {
$obj = new stdClass();
$obj->name = $input->in_param("name", $input->in_param("id", "input_" . $count));
$obj->type = strtolower($input->in_param("type", "text"));
$obj->value = Text::htmldecode($input->in_param("value"));
$obj->selected = "selected" === strtolower($input->in_param("checked", $input->in_attr("checked")));
$obj->multiple = false;
$form->element[] = $obj;
}
foreach ($formtag->in("textarea") as $count => $input) {
$obj = new stdClass();
$obj->name = $input->in_param("name", $input->in_param("id", "textarea_" . $count));
$obj->type = "textarea";
$obj->value = Text::htmldecode($input->value());
$obj->selected = true;
$obj->multiple = false;
$form->element[] = $obj;
}
foreach ($formtag->in("select") as $count => $input) {
$obj = new stdClass();
$obj->name = $input->in_param("name", $input->in_param("id", "select_" . $count));
$obj->type = "select";
$obj->value = array();
$obj->selected = true;
$obj->multiple = "multiple" == strtolower($input->param("multiple", $input->attr("multiple")));
foreach ($input->in("option") as $count => $option) {
$op = new stdClass();
$op->value = Text::htmldecode($option->in_param("value", $option->value()));
$op->selected = "selected" == strtolower($option->in_param("selected", $option->in_attr("selected")));
$obj->value[] = $op;
}
$form->element[] = $obj;
}
$this->form[] = $form;
}
}
示例9: setText
protected function setText($value)
{
$this->text = Text::htmldecode($value);
}