本文整理汇总了PHP中Tag::setof方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::setof方法的具体用法?PHP Tag::setof怎么用?PHP Tag::setof使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tag
的用法示例。
在下文中一共展示了Tag::setof方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: revision
public function revision($from, $to)
{
$src = Command::out(sprintf("%s log %s --xml --verbose %s", $this->cmd, sprintf("-r %d:%d ", $from, $to), $this->url));
$result = array();
if (Tag::setof($tag, $src, "log")) {
foreach ($tag->in("logentry") as $log) {
$revision = $log->inParam("revision");
$result[$revision] = new SvnRevision($revision, $log->f("author.value()"), $log->f("msg.value()"), $log->f("date.value()"));
foreach ($log->in("paths") as $paths) {
foreach ($paths->in("path") as $path) {
$result[$revision]->path($path->inParam("action"), $path->value());
}
}
}
}
if ($to - $from != sizeof($result) - 1) {
$last = $this->_lastShell();
if ($to > $last) {
$to = $last;
}
for ($i = $from; $i <= $to; $i++) {
if (!isset($result[$i])) {
$result[$i] = new SvnRevision($i, null, null, null);
}
}
}
return $result;
}
示例2: parse
public static function parse($response)
{
if (!is_array($response)) {
Tag::setof($response, $response, "hash");
}
$obj = new self();
return $obj->cp($response);
}
示例3: do_read
/**
* URLからフィードを取得
*
* @param string $url
* @return Atom
*/
public function do_read($url)
{
$urls = func_get_args();
$feed = null;
if (!self::$CACHE || File::isExpiry($urls, self::$CACHE_TIME)) {
foreach ($urls as $url) {
if (is_string($url) && ($url = trim($url)) && !empty($url)) {
if (!self::$CACHE || File::isExpiry($url, self::$CACHE_TIME)) {
$src = Tag::xhtmlnize($this->do_get($url)->body(), "link");
if (Tag::setof($tag, $src, "head")) {
foreach ($tag->in("link") as $link) {
if ("alternate" == strtolower($link->inParam("rel")) && strpos(strtolower($link->inParam("type")), "application") === 0 && $url != ($link = File::absolute($url, $link->inParam("href")))) {
$src = $this->do_get($link)->body();
break;
}
}
}
$tmp = self::parse($src);
if (self::$CACHE) {
File::cwrite($url, $tmp);
}
} else {
$tmp = File::cread($url);
}
if ($feed === null) {
if ($this->title !== null) {
$tmp->title($this->title());
}
if ($this->subtitle !== null) {
$tmp->subtitle($this->subtitle());
}
if ($this->id !== null) {
$tmp->id($this->id());
}
if ($this->generator !== null) {
$tmp->generator($this->generator());
}
if ($this->updated !== null) {
$tmp->updated($this->updated());
}
$feed = $tmp;
} else {
$feed->add($tmp);
}
}
}
if (!$feed instanceof Atom) {
$feed = new Atom();
}
$feed->sort();
if (self::$CACHE) {
File::cwrite($urls, $feed);
}
} else {
$feed = File::cread($urls);
}
return $feed;
}
示例4: __after_exec__
protected function __after_exec__(&$ret)
{
if (Tag::setof($tag, $ret->stdout(), 'info')) {
foreach ($tag->in('entry') as $entry) {
$ret = $entry->hash();
return;
}
}
throw new SubversionInfoException();
}
示例5: updates
public function updates()
{
$results = array();
if (Tag::setof($feed, $this->do_get("http://mixi.jp/atom/updates/r=1/member_id=" . $this->member_id)->body(), "feed")) {
foreach ($feed->in("entry") as $entry) {
$results[] = MixiContent::parse($entry);
}
}
return $results;
}
示例6: m_not_mobile
private function m_not_mobile(&$src, Template $template)
{
while (Tag::setof($tag, $src, 'm:not_mobile')) {
if (!Mobile::is_mobile()) {
$src = str_replace($tag->plain(), $tag->value(), $src);
} else {
$src = str_replace($tag->plain(), '', $src);
}
}
$src = $template->parse_vars($src);
}
示例7: before_template
/**
* Templateのモジュール
* @param string $src
* @param Tempalte $template
*/
public function before_template(&$src, Template $template)
{
if (Tag::setof($tag, $src, "body")) {
foreach ($tag->in("form") as $f) {
if (strtolower($f->in_param("method")) == "post") {
$f->value("<input type=\"hidden\" name=\"_onetimeticket\" value=\"{\$_onetimeticket}\" />" . $f->value());
$src = str_replace($f->plain(), $f->get(), $src);
}
}
}
}
示例8: parse
public static function parse($response)
{
if (Tag::setof($tag, $response, "err")) {
throw new Exception($tag->inParam("msg"));
}
if (Tag::setof($tag, $response, "rsp")) {
$obj = new self();
return $obj->cp($tag->hash());
}
throw new InvalidArgumentException();
}
示例9: 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");
}
示例10: __exec__
protected function __exec__()
{
$this->options('xml');
if (Tag::setof($tag, parent::__exec__()->stdout(), 'list')) {
$result = array();
foreach ($tag->in('entry') as $t) {
$result[] = $t->hash();
}
return $result;
}
throw new SubversionListException();
}
示例11: read_server
private static function read_server($http, $server, $uri, $tgz, $package_path)
{
if ($http->do_get($server . "__repository__.php" . "/state/" . $uri)->status() === 200) {
if (Tag::setof($tag, $http->body(), "rest") && $tag->f("status.value()") == "success") {
$http->do_download($server . "__repository__.php" . "/download/" . $uri, $tgz);
File::untgz($tgz, getcwd());
File::rm($tgz);
return true;
}
}
return false;
}
示例12: parse
public static function parse($response)
{
if (!is_array($response)) {
if (Tag::setof($tag, $response, "error")) {
throw new Exception($tag->value());
}
Tag::setof($tag, $response, "user");
$response = $tag->hash();
}
$obj = new self();
return $obj->cp($response);
}
示例13: parse
public static function parse(&$src)
{
$result = null;
if (Tag::setof($tag, $src, "summary")) {
$result = new self();
$result->type($tag->inParam("type", "text"));
$result->lang($tag->inParam("xml:lang"));
$result->value($tag->value());
$src = str_replace($tag->plain(), "", $src);
}
return $result;
}
示例14: parse
public function parse(&$src, &$result)
{
if (Tag::setof($tag, $src, "media:group")) {
$media = new self();
$media->keyword($tag->f("media:keywords.value()"));
$media->duration($tag->f("yt:duration.param(seconds)"));
$media->player($tag->f("media:player.value()"));
$media->category($tag->f("media:category.value()"));
$media->thumbnail($tag->f("media:thumbnail.param(url)"));
$result = $media;
}
}
示例15: parse_list
public static function parse_list($response)
{
$result = array();
if (Tag::setof($tag, $response, "info")) {
foreach ($tag->in("photo") as $photo) {
$obj = new self();
$result[] = $obj->cp($photo->hash());
}
} else {
throw new Exception("Invalid data");
}
return $result;
}