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


PHP DomDocument::createComment方法代码示例

本文整理汇总了PHP中DomDocument::createComment方法的典型用法代码示例。如果您正苦于以下问题:PHP DomDocument::createComment方法的具体用法?PHP DomDocument::createComment怎么用?PHP DomDocument::createComment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DomDocument的用法示例。


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

示例1: _toHtml

 public function _toHtml()
 {
     $this->_checkRequired();
     $info = $this->getInfo();
     $certain = $info['certain'];
     $dom = new DomDocument();
     $dom->preserveWhitespace = false;
     $block = $dom->createElement('block');
     $attr = $dom->createAttribute('type');
     $attr->value = $this->getAlias();
     $block->appendChild($attr);
     $dom->appendChild($block);
     $output = simplexml_load_string('<block />');
     foreach ($certain as $method) {
         $block->appendChild($dom->createComment("\n     " . $this->_getDocumentation($method) . "\n  "));
         $dom_action = $dom->createElement('action');
         $block->appendChild($dom_action);
         $dom_attr = $dom->createAttribute('method');
         $dom_attr->value = $method->getName();
         $dom_action->appendChild($dom_attr);
         $this->addParamsToDomActionNodeFromReflectionMethod($dom, $dom_action, $method);
         //$action = $this->addParamsToActionNodeFromReflectionMethod($action, $method);
     }
     $dom->formatOutput = true;
     return $this->_extraXmlFormatting($dom->saveXml());
 }
开发者ID:itmyprofession,项目名称:Pulsestorm,代码行数:26,代码来源:Action.php

示例2: addIeCss

 /**
  * add ie css.
  * add a style file to the document
  *
  * @param string $file
  * @param string $ieCondition
  * @access public
  * @return bool
  */
 public function addIeCss($file, $ieCondition)
 {
     if (!empty($file) && !empty($ieCondition)) {
         $comment = $this->document->createComment(sprintf('[if %s]><link href="%s" rel="stylesheet" type="text/css" /><![endif]', $ieCondition, BASEPATH . '/' . $file));
         $this->head->appendChild($comment);
         return true;
     } else {
         return false;
     }
 }
开发者ID:BlackIkeEagle,项目名称:hersteldienst-devolder,代码行数:19,代码来源:XHtml.php

示例3: comment

 /**
  * Add a comment
  *
  * @param   string  $content
  * @return  object  $this
  */
 public function comment($content)
 {
     $this->current->appendChild($this->dom->createComment(htmlentities($content, ENT_QUOTES | ENT_XML1)));
     return $this;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:11,代码来源:element.php

示例4: pugpig_get_opds_container

function pugpig_get_opds_container($edition_ids, $internal = false, $atom_mode = false, $newsstand_mode = false, $extra_comments = array())
{
    $d = new DomDocument('1.0', 'UTF-8');
    $feed = $d->createElement('feed');
    $feed->setAttribute('xmlns', 'http://www.w3.org/2005/Atom');
    if ($newsstand_mode) {
        $feed->setAttribute('xmlns:news', 'http://itunes.apple.com/2011/Newsstand');
    } else {
        $feed->setAttribute('xmlns:dcterms', 'http://purl.org/dc/terms/');
        $feed->setAttribute('xmlns:opds', 'http://opds-spec.org/2010/catalog');
        $feed->setAttribute('xmlns:app', 'http://www.w3.org/2007/app');
        $feed->setAttribute('xmlns:at', 'http://purl.org/atompub/tombstones/1.0');
        $feed->setAttribute('xmlns:pp', 'http://pugpig.com/2014/atom/');
    }
    $comment = $atom_mode ? "Atom" : "Package";
    if ($internal) {
        $comment .= ' Internal Feed';
    } else {
        $comment .= ' External Feed';
    }
    if ($newsstand_mode) {
        $comment .= " for Newsstand";
    }
    $feed->appendChild($d->createComment(' ' . $comment . " - Generated: " . date(DATE_RFC822) . ' '));
    foreach ($extra_comments as $extra_comment) {
        $feed->appendChild($d->createComment(' ' . $extra_comment . ' '));
    }
    $feed->appendChild(newElement($d, 'id', pugpig_get_atom_tag('opds')));
    _pugpig_create_xml_link($d, $feed, array('rel' => 'self', 'type' => 'application/atom+xml;profile=opds-catalog;kind=acquisition', 'href' => pugpig_self_link()));
    if (function_exists('pugpig_get_opds_extras')) {
        $extras = pugpig_get_opds_extras();
        if (isset($extras['links'])) {
            foreach ($extras['links'] as $link) {
                _pugpig_create_xml_link($d, $feed, $link);
            }
        }
        if (!empty($extras['auth_endpoints'])) {
            $authorisation = $d->createElement('pp:authorisation', '');
            $feed->appendChild($authorisation);
            foreach ($extras['auth_endpoints'] as $auth) {
                $authorisation = pugpig_get_authorisationprovider($d, $auth, $authorisation);
            }
        }
        if (isset($extras['custom_categories'])) {
            foreach ($extras['custom_categories'] as $scheme => $values) {
                _pugpig_create_atom_category($d, $feed, $scheme, $values);
            }
        }
    }
    $author = $d->createElement('author');
    $author->appendChild($d->createElement('name', 'Pugpig'));
    $feed->appendChild($author);
    $feed->appendChild($d->createElement('title', 'All Issues'));
    $feed->appendChild($d->createElement('subtitle', $comment));
    $editions = array();
    $updated = 1;
    // 1 second into UNIX epoch (0 == current time?)
    foreach ($edition_ids as $key => $edition_id) {
        $editions[] = $edition_id;
        $edition_updated_atom = pugpig_get_edition_update_date(pugpig_get_edition($edition_id, true, !$atom_mode), true);
        $edition_updated_package = pugpig_get_edition_update_date(pugpig_get_edition($edition_id, true, !$atom_mode), false);
        $edition_updated = max($edition_updated_atom, $edition_updated_package);
        if ($edition_updated > $updated) {
            $updated = $edition_updated;
        }
    }
    $feed->appendChild(newElement($d, 'updated', pugpig_date3339($updated)));
    foreach ($editions as $edition) {
        $edition = pugpig_get_edition($edition, true, !$atom_mode);
        if (!$atom_mode && array_key_exists('zip', $edition) && $edition['zip'] == '' && !$edition['is_pdf']) {
            $feed->appendChild($d->createComment(' ' . ucfirst($edition['status']) . ' ' . pugpig_get_atom_tag($edition['key']) . ' does not have an up to date package '));
        } else {
            $feed->appendChild(pugpig_get_opds_entry($d, $edition, $internal, $atom_mode, $newsstand_mode));
        }
    }
    $d->appendChild($feed);
    return $d;
}
开发者ID:shortlist-digital,项目名称:agreable-pugpig-plugin,代码行数:78,代码来源:pugpig_manifests.php

示例5: _package_edition_package_list_xml

function _package_edition_package_list_xml($base, $edition_tag, $url_root = '', $cdn = '', $output = 'string', $timestamp = '*', $content_xml_url = "content.xml")
{
    $url_root = pugpig_strip_domain($url_root);
    $contents = _package_edition_package_contents($base, $edition_tag, $timestamp);
    if (!file_exists($contents['html_archive'])) {
        return NULL;
    }
    $total_size = 0;
    //$content_xml = "content.xml";
    $d = new DomDocument('1.0', 'UTF-8');
    $d->formatOutput = TRUE;
    $package = $d->createElement('package');
    $package->setAttribute('root', $content_xml_url);
    $comment = "Generated: " . date(DATE_RFC822);
    $package->appendChild($d->createComment($comment));
    $part = $d->createElement('part');
    $part->setAttribute('name', 'html');
    $part->setAttribute('src', $url_root . $contents['html_url']);
    $part->setAttribute('size', $contents['html_size']);
    $total_size += $contents['html_size'];
    $part->setAttribute('modified', gmdate(DATE_ATOM, $contents['html_timestamp']));
    $package->appendChild($part);
    if (is_numeric($contents['assets_size']) && $contents['assets_size'] > 0) {
        $part = $d->createElement('part');
        $part->setAttribute('name', 'assets');
        $part->setAttribute('src', $cdn . $url_root . $contents['assets_url']);
        $part->setAttribute('size', $contents['assets_size']);
        $total_size += $contents['assets_size'];
        $part->setAttribute('modified', gmdate(DATE_ATOM, $contents['assets_timestamp']));
        $package->appendChild($part);
    }
    $package->setAttribute('size', $total_size);
    $d->appendChild($package);
    if ($output == 'string') {
        return $d->saveXML();
    } else {
        $d->save($output);
        return $output;
    }
}
开发者ID:johnedelatorre,项目名称:fusion,代码行数:40,代码来源:pugpig_packager.php

示例6: DomDocument

<?php

//Negative offset
$dom = new DomDocument();
$comment = $dom->createComment('test-comment');
try {
    $comment->replaceData(-1, 4, '-inserted');
} catch (DOMException $e) {
    if ($e->getMessage() == 'Index Size Error') {
        echo "Throws DOMException for -ve offest\n";
    }
}
开发者ID:badlamer,项目名称:hhvm,代码行数:12,代码来源:DOMComment_replaceData_error1.php

示例7: pugpig_get_opds_container

function pugpig_get_opds_container($edition_ids, $internal = FALSE, $atom_mode = FALSE, $newsstand_mode = FALSE, $extra_comments = array())
{
    $d = new DomDocument('1.0', 'UTF-8');
    $feed = $d->createElement('feed');
    $feed->setAttribute('xmlns', 'http://www.w3.org/2005/Atom');
    if ($newsstand_mode) {
        $feed->setAttribute('xmlns:news', 'http://itunes.apple.com/2011/Newsstand');
    } else {
        $feed->setAttribute('xmlns:dcterms', 'http://purl.org/dc/terms/');
        $feed->setAttribute('xmlns:opds', 'http://opds-spec.org/2010/catalog');
        $feed->setAttribute('xmlns:app', 'http://www.w3.org/2007/app');
        $feed->setAttribute('xmlns:at', 'http://purl.org/atompub/tombstones/1.0');
    }
    $comment = $atom_mode ? "Atom" : "Package";
    if ($internal) {
        $comment .= ' Internal Feed';
    } else {
        $comment .= ' External Feed';
    }
    if ($newsstand_mode) {
        $comment .= " for Newsstand";
    }
    $feed->appendChild($d->createComment(' ' . $comment . " - Generated: " . date(DATE_RFC822) . ' '));
    foreach ($extra_comments as $extra_comment) {
        $feed->appendChild($d->createComment(' ' . $extra_comment . ' '));
    }
    $feed->appendChild(newElement($d, 'id', pugpig_get_atom_tag('opds')));
    $link = $d->createElement('link');
    $link->setAttribute('rel', 'self');
    $link->setAttribute('type', 'application/atom+xml;profile=opds-catalog;kind=acquisition');
    $link->setAttribute('href', pugpig_self_link());
    $feed->appendChild($link);
    $author = $d->createElement('author');
    $author->appendChild($d->createElement('name', 'Pugpig'));
    $feed->appendChild($author);
    $feed->appendChild($d->createElement('title', 'All Issues'));
    $feed->appendChild($d->createElement('subtitle', $comment));
    $editions = array();
    $updated = 1;
    // 1 second into UNIX epoch (0 == current time?)
    foreach ($edition_ids as $key => $edition_id) {
        $editions[] = $edition_id;
        $edition_updated = pugpig_get_edition_update_date(pugpig_get_edition($edition_id, TRUE, !$atom_mode), $atom_mode);
        if ($edition_updated > $updated) {
            $updated = $edition_updated;
        }
    }
    $feed->appendChild(newElement($d, 'updated', pugpig_date3339($updated)));
    foreach ($editions as $edition) {
        $edition = pugpig_get_edition($edition, TRUE, !$atom_mode);
        if (!$atom_mode && array_key_exists('zip', $edition) && $edition['zip'] == '') {
            $feed->appendChild($d->createComment(' ' . ucfirst($edition['status']) . ' ' . pugpig_get_atom_tag($edition['key']) . ' does not have an up to date package '));
        } else {
            $feed->appendChild(pugpig_get_opds_entry($d, $edition, $internal, $atom_mode, $newsstand_mode));
        }
    }
    $d->appendChild($feed);
    return $d;
}
开发者ID:johnedelatorre,项目名称:fusion,代码行数:59,代码来源:pugpig_manifests.php

示例8: _package_edition_package_list_xml_core

function _package_edition_package_list_xml_core($base, $edition_tag, $bucket_infos, $url_root = '', $cdn = '', $output_type = 'string', $timestamp = '*', $content_xml_url = "content.xml")
{
    $d = new DomDocument('1.0', 'UTF-8');
    $d->formatOutput = true;
    $package = $d->createElement('package');
    $package->setAttribute('root', $content_xml_url);
    $package->appendChild($d->createComment("Generated: " . date(DATE_RFC822)));
    $url_root_without_domain = pugpig_strip_domain($url_root);
    $total_size = 0;
    foreach ($bucket_infos as $bucket_name => $bucket_info) {
        $bucket_cdn = $bucket_info['is_cdn'] ? $cdn : '';
        $total_size += _package_edition_package_list_xml_part($package, $d, $url_root_without_domain, $bucket_info['zips'], $bucket_name, $bucket_cdn, $base);
    }
    $package->setAttribute('size', $total_size);
    $d->appendChild($package);
    $out = null;
    if ($output_type === 'string') {
        $out = $d->saveXML();
    } else {
        $d->save($output_type);
        $out = 'string';
    }
    return $out;
}
开发者ID:shortlist-digital,项目名称:agreable-pugpig-plugin,代码行数:24,代码来源:pugpig_packager.php

示例9: DomDocument

<?php

$x = new DomDocument();
$x->createComment();
?>
===DONE===
开发者ID:badlamer,项目名称:hhvm,代码行数:6,代码来源:domdocument_createcomment_error_001.php


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