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


PHP XMLWriter::endComment方法代码示例

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


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

示例1: file_get_contents

<?php

/* $Id$ */
$doc_dest = '001.xml';
$xw = new XMLWriter();
$xw->openUri($doc_dest);
$xw->startDocument('1.0', 'UTF-8');
$xw->startElement("tag1");
$xw->startComment();
$xw->text('comment');
$xw->endComment();
$xw->writeComment("comment #2");
$xw->endDocument();
// Force to write and empty the buffer
$output_bytes = $xw->flush(true);
echo file_get_contents($doc_dest);
unset($xw);
unlink('001.xml');
?>
===DONE===
开发者ID:gleamingthecube,项目名称:php,代码行数:20,代码来源:ext_xmlwriter_tests_OO_005.php

示例2: executeTask

 /**
  * @see interface_admin_systemtask::executeTask()
  * @throws class_exception
  * @return string
  */
 public function executeTask()
 {
     if (!class_module_system_module::getModuleByName("pages")->rightEdit()) {
         return $this->getLang("commons_error_permissions");
     }
     //load the page itself
     $objPage = class_module_pages_page::getPageByName($this->getParam("pageExport"));
     if ($objPage !== null) {
         $objSystem = class_module_system_module::getModuleByName("system");
         $objXmlWriter = new XMLWriter();
         $strExportFolder = $this->getParam("exportFolder");
         $strExportPrefix = $this->getParam("exportPrefix");
         if ($strExportFolder == "") {
             $strExportFolder = _realpath_ . _projectpath_ . "/temp";
         } else {
             $strExportFolder = _realpath_ . "/" . $strExportFolder;
         }
         if ($strExportPrefix != "") {
             $strExportPrefix = "_" . $strExportPrefix;
         }
         if (is_dir($strExportFolder)) {
             if (!$objXmlWriter->openUri($strExportFolder . "/" . $strExportPrefix . $objPage->getSystemid() . ".xml")) {
                 throw new class_exception("failed to open export file ", class_exception::$level_ERROR);
             }
             //$objXmlWriter->openMemory();
             $objXmlWriter->setIndent(true);
             $objXmlWriter->startDocument("1.0", "UTF-8");
             $objXmlWriter->startComment();
             $strComment = "\n   Kajona XML export\n";
             $strComment .= "   (c) Kajona, www.kajona.de\n";
             $strComment .= "   Kernel version:  " . $objSystem->getStrVersion() . "\n";
             $strComment .= "   Schema version:  1.0\n";
             $strComment .= "   Export Date:     " . dateToString(new class_date()) . "\n";
             $objXmlWriter->text($strComment);
             $objXmlWriter->endComment();
             $objXmlWriter->startElement("pages");
             $objXmlWriter->startElement("page");
             $objXmlWriter->startElement("metadata");
             $objXmlWriter->startElement("kernelVersion");
             $objXmlWriter->text($objSystem->getStrVersion());
             $objXmlWriter->endElement();
             $objXmlWriter->startElement("systemid");
             $objXmlWriter->text($objPage->getSystemid());
             $objXmlWriter->endElement();
             $objXmlWriter->startElement("previd");
             $objXmlWriter->text($objPage->getPrevId());
             $objXmlWriter->endElement();
             $objXmlWriter->startElement("pagename");
             $objXmlWriter->text($objPage->getStrName());
             $objXmlWriter->endElement();
             //try to load the parent page-name
             $strParentName = "";
             if (validateSystemid($objPage->getPrevId())) {
                 $objParentPage = new class_module_pages_page($objPage->getPrevId());
                 $strParentName = $objParentPage->getStrName();
             }
             $objXmlWriter->startElement("prevname");
             $objXmlWriter->text($strParentName);
             $objXmlWriter->endElement();
             $objXmlWriter->startElement("pageproperties");
             $this->createPageMetadata($objPage->getSystemid(), $objXmlWriter);
             $objXmlWriter->endElement();
             //metadata
             $objXmlWriter->endElement();
             $objXmlWriter->startElement("elements");
             $this->createElementData($objPage->getSystemid(), $objXmlWriter);
             $objXmlWriter->endElement();
             //page
             $objXmlWriter->endElement();
             //pages
             $objXmlWriter->endElement();
             $objXmlWriter->flush();
             //return $objXmlWriter->outputMemory(true);
             return $this->getLang("systemtask_pageexport_success") . $strExportFolder . "/" . $strExportPrefix . $objPage->getSystemid() . ".xml" . "";
         } else {
             throw new class_exception("writing XML: Folder " . $strExportFolder . " does not exist! ", class_exception::$level_ERROR);
         }
     }
     return $this->getLang("systemtask_pageexport_error");
 }
开发者ID:jinshana,项目名称:kajonacms,代码行数:85,代码来源:class_systemtask_pageexport.php

示例3: queryAndStreamXML

function queryAndStreamXML($conditions, $randomize = false, $limit = null)
{
    $beginTime = microtime(true);
    $mysql = connectToMySQL();
    $conditions[] = '`isactive` = 1';
    $query = 'SELECT `edittype`,
				`editid`,
				`comment`,
				`user`,
				`user_edit_count`,
				`user_distinct_pages`,
				`user_warns`,
				`prev_user`,
				UNIX_TIMESTAMP( `user_reg_time` ) AS `user_reg_time_unix`,
				UNIX_TIMESTAMP( `common_page_made_time` ) AS `common_page_made_time_unix`,
				`common_title`,
				`common_namespace`,
				`common_creator`,
				`common_num_recent_edits`,
				`common_num_recent_reversions`,
				`current_minor`,
				UNIX_TIMESTAMP( `current_timestamp` ) AS `current_timestamp_unix`,
				`current_text`,
				UNIX_TIMESTAMP( `previous_timestamp` ) AS `previous_timestamp_unix`,
				`previous_text`,
				`isvandalism`,
				`isactive`,
				`source`,
				UNIX_TIMESTAMP( `updated` ) AS `updated_unix`,
				`reviewers`,
				`reviewers_agreeing` FROM `editset` WHERE ';
    $query .= implode(' AND ', $conditions);
    if ($randomize) {
        $query .= ' ORDER BY RAND()';
    } else {
        if ($randomize === false and ($limit !== null and strpos(',', $limit) === false or $limit === null)) {
            $row = mysql_fetch_assoc(mysql_query('SELECT COUNT(*) as `count` FROM `editset` WHERE ' . implode(' AND ', $conditions)));
            $start = rand(0, $row['count'] - ($limit === null ? 0 : $limit));
            if ($limit !== null and strpos(',', $limit) === false) {
                $limit = $start . ',' . $limit;
            } else {
                $limit = $start . ',18446744073709551615';
            }
        }
    }
    if ($limit !== null) {
        $query .= ' LIMIT ' . $limit;
    }
    $xml = new XMLWriter();
    $xml->openURI('php://output');
    $xml->setIndent(true);
    $xml->startDocument('1.0', 'UTF-8');
    $xml->startElement('WPEditSet');
    $xml->startComment();
    $xml->startElement('EditDB');
    $xml->writeElement('query', $query);
    $xml->writeElement('time', time());
    if (function_exists('posix_uname')) {
        $uname = posix_uname();
        $xml->startElement('uname');
        foreach ($uname as $key => $value) {
            $xml->writeElement($key, $value);
        }
        $xml->endElement();
    }
    if (function_exists('posix_getlogin')) {
        $xml->writeElement('username', posix_getlogin());
    }
    $xml->endElement();
    $xml->endComment();
    $result = mysql_unbuffered_query($query);
    if (!$result) {
        error('MySQL Query Error: ' . mysql_error() . "\n" . 'Query: ' . $query);
    }
    $count = 0;
    while ($row = mysql_fetch_assoc($result)) {
        $xml->startElement('WPEdit');
        $xml->startElement('EditDB');
        $xml->writeElement('isActive', $row['isactive'] ? 'true' : 'false');
        $xml->writeElement('source', $row['source']);
        $xml->writeElement('lastUpdated', $row['updated_unix']);
        $xml->endElement();
        $xml->writeElement('EditType', $row['edittype']);
        $xml->writeElement('EditID', $row['editid']);
        $xml->writeElement('comment', $row['comment']);
        $xml->writeElement('user', $row['user']);
        $xml->writeElement('user_edit_count', $row['user_edit_count']);
        $xml->writeElement('user_distinct_pages', $row['user_distinct_pages']);
        $xml->writeElement('user_warns', $row['user_warns']);
        $xml->writeElement('prev_user', $row['prev_user']);
        $xml->writeElement('user_reg_time', $row['user_reg_time_unix']);
        $xml->startElement('common');
        $xml->writeElement('page_made_time', $row['common_page_made_time_unix']);
        $xml->writeElement('title', $row['common_title']);
        $xml->writeElement('namespace', $row['common_namespace']);
        $xml->writeElement('creator', $row['common_creator']);
        $xml->writeElement('num_recent_edits', $row['common_num_recent_edits']);
        $xml->writeElement('num_recent_reversions', $row['common_num_recent_reversions']);
        $xml->endElement();
        $xml->startElement('current');
//.........这里部分代码省略.........
开发者ID:Riamse,项目名称:cluebotng,代码行数:101,代码来源:editdbFunctions.php


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