• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP SimpleXMLExtended类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Index

 public function Index($rows)
 {
     $xml = new SimpleXMLExtended('<?xml version="1.0" encoding="GBK"?><DOCUMENT/>');
     foreach ($rows as $keys => $values) {
         foreach ($values as $key => $value) {
             $i = -8;
             $num_item = $xml->addchild($key);
             $num_key = $num_item->addchild('key');
             $num_display = $num_item->addchild('display');
             $n = 1;
             foreach ($value as $k => $val) {
                 $n++;
                 if ($n < 3) {
                     $num_key->addCData($val);
                 } else {
                     $i++;
                     if ($i < 14) {
                         $num_display->{$k} = NULL;
                         $num_display->{$k}->addCData($val);
                         continue;
                     } elseif ($i == 14) {
                         $num_moremore = $num_display->addchild('moremore');
                         $num_moremore->{$k} = NULL;
                         $num_moremore->{$k}->addCData($val);
                     }
                     $num_moremore->{$k} = NULL;
                     $num_moremore->{$k}->addCData($val);
                 }
             }
         }
     }
     echo $xml->asXml();
 }
开发者ID:ahinap,项目名称:wordpress,代码行数:33,代码来源:MysqlToXmlController.php


示例2: items_customfields_header

function items_customfields_header()
{
    if (!file_exists(GSDATAOTHERPATH . 'plugincustomfields.xml')) {
        $xml = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><channel></channel>');
        $xml->asXML(GSDATAOTHERPATH . 'plugincustomfields.xml');
        return true;
    }
    ?>
  <style type="text/css">
    form #metadata_window table.formtable td .cke_editor td:first-child { padding: 0; }
    form #metadata_window table.formtable .cke_editor td.cke_top { border-bottom: 1px solid #AAAAAA; }
    form #metadata_window table.formtable .cke_editor td.cke_contents { border: 1px solid #AAAAAA; }
    #customfieldsForm .hidden { display:none; }
    .shorts {
      width:250px !important;
    }
    .checkp {
      margin-top:17px;
    }
     .user_sub_tr {
      border:0px;border-bottom:0px !important; border-bottom-width:0px !important;border-top:0px;border-top-width:0px !important;
   }
    .user_sub_tr td{
      border:0px;border-bottom:0px !important;border-bottom-width:0px !important;padding-top:6px !important; border-top: 0px !important;
   }
      .resize_img {
    max-height:150px;
  }
    

  </style>
<?php 
}
开发者ID:nelsonr,项目名称:Items-Manager,代码行数:33,代码来源:plugins_customfields.php


示例3: _xmlbody

 /**
  * build the xml structure where the content can be inserted
  *
  * @return void
  */
 private function _xmlbody()
 {
     $dom = new DOMDocument('1.0', 'UTF-8');
     $root = $dom->createElement("tns:phpsysinfo");
     $root->setAttribute('xmlns:tns', 'http://phpsysinfo.sourceforge.net/');
     $root->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     $root->setAttribute('xsi:schemaLocation', 'http://phpsysinfo.sourceforge.net/phpsysinfo3.xsd');
     $dom->appendChild($root);
     $this->_xml = new SimpleXMLExtended(simplexml_import_dom($dom), $this->_sysinfo->getEncoding());
     $generation = $this->_xml->addChild('Generation');
     $generation->addAttribute('version', CommonFunctions::PSI_VERSION);
     $generation->addAttribute('timestamp', time());
     $options = $this->_xml->addChild('Options');
     $options->addAttribute('tempFormat', defined('PSI_TEMP_FORMAT') ? PSI_TEMP_FORMAT : 'c');
     $options->addAttribute('byteFormat', defined('PSI_BYTE_FORMAT') ? PSI_BYTE_FORMAT : 'auto_binary');
     $options->addAttribute('refresh', defined('PSI_REFRESH') ? PSI_REFRESH : 0);
     $options->addAttribute('showPickListTemplate', defined('PSI_SHOW_PICKLIST_TEMPLATE') ? PSI_SHOW_PICKLIST_TEMPLATE ? 'true' : 'false' : 'false');
     $options->addAttribute('showPickListLang', defined('PSI_SHOW_PICKLIST_LANG') ? PSI_SHOW_PICKLIST_LANG ? 'true' : 'false' : 'false');
     $plug = $this->_xml->addChild('UsedPlugins');
     if ($this->_complete_request && count($this->_plugins) > 0) {
         foreach ($this->_plugins as $plugin) {
             $plug->addChild('Plugin')->addAttribute('name', $plugin);
         }
     } elseif ($this->_plugin_request && count($this->_plugins) > 0) {
         $plug->addChild('Plugin')->addAttribute('name', $this->_plugin);
     }
 }
开发者ID:sorrowchen,项目名称:openfiler-cn,代码行数:32,代码来源:class.XML.inc.php


示例4: node

 /**
 * 增加节点值
 * @param array $data
 * @param SimpleXMLElement $xml
 * 
 * @return void
 */
 public static function node($data, SimpleXMLExtended &$xml)
 {
     foreach ($data as $k => $v) {
         if (is_array($v)) {
             is_numeric($k) && ($k = substr($xml->getName(), 0, -1));
             $subroot = $xml->addChild($k);
             self::node($v, $subroot);
         } else {
             if (is_numeric($v)) {
                 $xml->addChild($k, $v);
             } else {
                 $xml->addChild($k)->addCData($v);
             }
         }
     }
 }
开发者ID:enozoom,项目名称:es,代码行数:23,代码来源:Arr2xmlStatic.php


示例5: export_category

 public function export_category()
 {
     $id = $this->session->userdata('admin_id');
     $cates = $this->catenews_model->list_all_byuser($id);
     $xml = new SimpleXMLExtended("<root></root>");
     foreach ($cates as $cate) {
         $xml_post = $xml->addChild('category');
         $xml_post->addChild('cat_id', $cate->id);
         $content = $xml_post->addChild('cat_name');
         $content->addCData($cate->catenewsname);
     }
     $dom = new DOMDocument("1.0");
     $dom->preserveWhiteSpace = false;
     $dom->formatOutput = true;
     $dom->loadXML($xml->asXML());
     $xml->asXML('export/' . $id . '/category.xml');
 }
开发者ID:phamios,项目名称:vietgit,代码行数:17,代码来源:news.php


示例6: bm_cache_to_xml

function bm_cache_to_xml($books)
{
    $xml = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><channel></channel>');
    foreach ($books as $book) {
        $item = $xml->addChild('item');
        $elem = $item->addChild('slug');
        $elem->addCData($book['slug']);
        $elem = $item->addChild('title');
        $elem->addCData($book['title']);
        $elem = $item->addChild('date');
        $elem->addCData($book['date']);
        $elem = $item->addChild('tags');
        $elem->addCData($book['tags']);
        $elem = $item->addChild('private');
        $elem->addCData($book['private']);
    }
    return @XMLsave($xml, BMBOOKCACHE);
}
开发者ID:abdelaithadji,项目名称:books_manager,代码行数:18,代码来源:cache.php


示例7: _xmlbody

 /**
  * build the xml structure where the content can be inserted
  *
  * @return void
  */
 private function _xmlbody()
 {
     $dom = new DOMDocument('1.0', 'UTF-8');
     $root = $dom->createElement("tns:phpsysinfo");
     $root->setAttribute('xmlns:tns', 'http://phpsysinfo.sourceforge.net/');
     $root->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     $root->setAttribute('xsi:schemaLocation', 'http://phpsysinfo.sourceforge.net/ phpsysinfo3.xsd');
     $dom->appendChild($root);
     $this->_xml = new SimpleXMLExtended(simplexml_import_dom($dom), $this->_sysinfo->getEncoding());
     $generation = $this->_xml->addChild('Generation');
     $generation->addAttribute('version', PSI_VERSION_STRING);
     $generation->addAttribute('timestamp', time());
     $options = $this->_xml->addChild('Options');
     $options->addAttribute('tempFormat', defined('PSI_TEMP_FORMAT') ? strtolower(PSI_TEMP_FORMAT) : 'c');
     $options->addAttribute('byteFormat', defined('PSI_BYTE_FORMAT') ? strtolower(PSI_BYTE_FORMAT) : 'auto_binary');
     if (defined('PSI_REFRESH')) {
         if (PSI_REFRESH === false) {
             $options->addAttribute('refresh', 0);
         } elseif (PSI_REFRESH === true) {
             $options->addAttribute('refresh', 1);
         } else {
             $options->addAttribute('refresh', PSI_REFRESH);
         }
     } else {
         $options->addAttribute('refresh', 60000);
     }
     if (defined('PSI_FS_USAGE_THRESHOLD')) {
         if (PSI_FS_USAGE_THRESHOLD === true) {
             $options->addAttribute('threshold', 1);
         } elseif (PSI_FS_USAGE_THRESHOLD !== false && PSI_FS_USAGE_THRESHOLD >= 1 && PSI_FS_USAGE_THRESHOLD <= 99) {
             $options->addAttribute('threshold', PSI_FS_USAGE_THRESHOLD);
         }
     } else {
         $options->addAttribute('threshold', 90);
     }
     $options->addAttribute('showPickListTemplate', defined('PSI_SHOW_PICKLIST_TEMPLATE') ? PSI_SHOW_PICKLIST_TEMPLATE ? 'true' : 'false' : 'false');
     $options->addAttribute('showPickListLang', defined('PSI_SHOW_PICKLIST_LANG') ? PSI_SHOW_PICKLIST_LANG ? 'true' : 'false' : 'false');
     $options->addAttribute('showCPUListExpanded', defined('PSI_SHOW_CPULIST_EXPANDED') ? PSI_SHOW_CPULIST_EXPANDED ? 'true' : 'false' : 'true');
     $options->addAttribute('showCPUInfoExpanded', defined('PSI_SHOW_CPUINFO_EXPANDED') ? PSI_SHOW_CPUINFO_EXPANDED ? 'true' : 'false' : 'false');
     if (count($this->_plugins) > 0) {
         if ($this->_plugin_request) {
             $plug = $this->_xml->addChild('UsedPlugins');
             $plug->addChild('Plugin')->addAttribute('name', $this->_plugin);
         } elseif ($this->_complete_request) {
             $plug = $this->_xml->addChild('UsedPlugins');
             foreach ($this->_plugins as $plugin) {
                 $plug->addChild('Plugin')->addAttribute('name', $plugin);
             }
         } else {
             $plug = $this->_xml->addChild('UnusedPlugins');
             foreach ($this->_plugins as $plugin) {
                 $plug->addChild('Plugin')->addAttribute('name', $plugin);
             }
         }
     }
 }
开发者ID:JordaoS,项目名称:phpsysinfo,代码行数:61,代码来源:class.XML.inc.php


示例8: saveTemplate

 function saveTemplate($data)
 {
     My_Logger::log("in Ajax_TemplateEditorProcessor saveTemplate()");
     $expected = array('filename', 'type', 'time', 'concepts', 'instructions', 'problem');
     $filename = $this->get($data['filename']);
     if (empty($filename)) {
         throw new Exception('Missing Filename');
     }
     My_Logger::log("filename is " . $filename);
     foreach ($expected as $field) {
         $toCheck = $this->get($data[$field]);
         if (empty($toCheck)) {
             //if (empty($this->get($data[$field]))){
             throw new Exception('Missing field: ' . $field);
         }
     }
     //build xml
     $xml = new SimpleXMLExtended('<question/>');
     $xml->addAttribute('type', $this->get($data['type']));
     $xml->addChild('estimated_time', $this->get($data['time']));
     $concepts = $xml->addChild('concepts');
     $concepts->addChild('concept', $this->get($data['concepts']));
     $xml->addChild('difficulty', $this->get($data['difficulty']));
     $xml->addChild('instructions', $this->get($data['instructions']));
     //$xml->problem = null;
     //$xml->problem->addCData($this->get($data['problem']));
     $xml->addCData('problem', $this->get($data['problem']));
     $sc = $xml->addChild('substitutions');
     $subs = $this->get($data['s']);
     if ($subs) {
         foreach ($subs as $sd) {
             if (empty($sd['name']) || empty($sd['value'])) {
                 continue;
             }
             $s = $sc->addCData('substitution', $sd['value']);
             $s->addAttribute('val', $sd['name']);
         }
     }
     $config = new Zend_Config_Ini(APPLICATION_PATH . "/configs/application.ini", APPLICATION_ENV);
     $path = $config->xml->import_path;
     $full_filename = $path . DIRECTORY_SEPARATOR . $filename;
     My_Logger::log("Saving to {$full_filename}");
     $xml->saveXML($full_filename);
     chmod($full_filename, 0666);
     return array('result' => 'success', 'msg' => "File '{$filename}' saved correctly");
 }
开发者ID:sutantyo,项目名称:itec810,代码行数:46,代码来源:TemplateEditorProcessor.php


示例9: toXml

 /**
  * Function for converting to an XML document.
  * Pass in a multi dimensional array or object and this recrusively loops through and builds up an XML document.
  *
  * @param array $data
  * @param string $rootNodeName - what you want the root node to be - defaultsto data.
  * @param SimpleXMLElement $xml - should only be used recursively
  * @return string XML
  */
 public static function toXml($data, $rootNodeName = 'root', $xml = null, $encoding = 'utf-8', $cdata = false)
 {
     // turn off compatibility mode as simple xml throws a wobbly if you don't.
     if (ini_get('zend.ze1_compatibility_mode') == 1) {
         ini_set('zend.ze1_compatibility_mode', 0);
     }
     if ($xml == null) {
         $xml = new SimpleXMLExtended("<?xml version='1.0' encoding='" . $encoding . "'?><{$rootNodeName} />");
     }
     // loop through the data passed in.
     foreach ($data as $key => $value) {
         // no numeric keys in our xml please!
         if (is_numeric($key)) {
             // make string key...
             //return;
             $key = "row";
         }
         // if there is another array or object found recrusively call this function
         if (is_array($value) || is_object($value)) {
             $node = $xml->addChild($key);
             // recrusive call.
             self::toXml($value, $rootNodeName, $node, $encoding, $cdata);
         } else {
             // add single node.
             $value = is_bool($value) ? $value ? 'true' : 'false' : $value;
             $value = htmlspecialchars($value);
             if ($cdata === true) {
                 $node = $xml->addChild($key);
                 $node->addCData($value);
             } else {
                 $xml->addChild($key, $value);
             }
         }
     }
     // pass back as string. or simple xml object if you want!
     return $xml->asXML();
 }
开发者ID:Russell-IO,项目名称:php-syslog-ng,代码行数:46,代码来源:jqUtils.php


示例10: bm_save_book

function bm_save_book()
{
    # create a backup if necessary
    if (isset($_POST['current-slug'])) {
        $file = $_POST['current-slug'] . '.xml';
        @rename(BMBOOKPATH . $file, BMBACKUPPATH . $file);
    }
    # empty titles are not allowed
    if (empty($_POST['book-title'])) {
        $_POST['book-title'] = '[No Title]';
    }
    # set initial slug and filename
    if (!empty($_POST['book-slug'])) {
        $slug = bm_create_slug($_POST['book-slug']);
    } else {
        $slug = bm_create_slug($_POST['book-title']);
    }
    $file = BMBOOKPATH . "{$slug}.xml";
    # do not overwrite other books
    if (file_exists($file)) {
        $count = 1;
        $file = BMBOOKPATH . "{$slug}-{$count}.xml";
        while (file_exists($file)) {
            $file = BMBOOKPATH . "{$slug}-" . ++$count . '.xml';
        }
        $slug = basename($file, '.xml');
    }
    # create undo target if there's a backup available
    if (isset($_POST['current-slug'])) {
        $backup = $slug . ':' . $_POST['current-slug'];
    }
    # collect $_POST data
    $title = safe_slash_html($_POST['book-title']);
    $timestamp = strtotime($_POST['book-date'] . ' ' . $_POST['book-time']);
    $date = $timestamp ? date('r', $timestamp) : date('r');
    $tags = str_replace(array(' ', ',,'), array('', ','), safe_slash_html($_POST['book-tags']));
    $private = isset($_POST['book-private']) ? 'Y' : '';
    $content = safe_slash_html($_POST['book-content']);
    # create xml object
    $xml = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><item></item>');
    $obj = $xml->addChild('title');
    $obj->addCData($title);
    $obj = $xml->addChild('date');
    $obj->addCData($date);
    $obj = $xml->addChild('tags');
    $obj->addCData($tags);
    $obj = $xml->addChild('private');
    $obj->addCData($private);
    $obj = $xml->addChild('content');
    $obj->addCData($content);
    # write data to file
    if (@XMLsave($xml, $file) && bm_update_cache()) {
        bm_display_message(i18n_r('books_manager/SUCCESS_SAVE'), false, @$backup);
    } else {
        bm_display_message(i18n_r('books_manager/SUCCESS_SAVE'), false, @$backup);
    }
}
开发者ID:abdelaithadji,项目名称:books_manager,代码行数:57,代码来源:books.php


示例11: nm_cache_to_xml

function nm_cache_to_xml($posts)
{
    $xml = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><channel></channel>');
    foreach ($posts as $post) {
        $item = $xml->addChild('item');
        $elem = $item->addChild('slug');
        $elem->addCData($post['slug']);
        $elem = $item->addChild('title');
        $elem->addCData($post['title']);
        $elem = $item->addChild('date');
        $elem->addCData($post['date']);
        $elem = $item->addChild('tags');
        $elem->addCData($post['tags']);
        $elem = $item->addChild('private');
        $elem->addCData($post['private']);
        $elem = $item->addChild('image');
        $elem->addCData($post['image']);
        if (!empty($post['author'])) {
            $elem = $item->addChild('author');
            $elem->addCData($post['author']);
        }
    }
    return @XMLsave($xml, NMPOSTCACHE);
}
开发者ID:hatasu,项目名称:appdroid,代码行数:24,代码来源:cache.php


示例12: printXML

 /**
  * @author Panagiotis Vagenas <[email protected]>
  * @since 150213
  */
 public function printXML()
 {
     if (headers_sent()) {
         return;
     }
     if (!$this->simpleXML instanceof SimpleXMLExtended) {
         $fileLocation = $this->getFileLocation();
         if (!$this->existsAndReadable($fileLocation)) {
             die('EW:X:P');
         }
         $this->simpleXML = simplexml_load_file($fileLocation);
     }
     header("Content-Type:text/xml");
     echo $this->simpleXML->asXML();
     exit(0);
 }
开发者ID:panvagenas,项目名称:prestashop-skroutz-xml-feed,代码行数:20,代码来源:XML.php


示例13: nm_save_post

function nm_save_post()
{
    # create a backup if necessary
    if (isset($_POST['current-slug'])) {
        $file = $_POST['current-slug'] . '.xml';
        if (dirname(realpath(NMPOSTPATH . $file)) != realpath(NMPOSTPATH)) {
            die('');
        }
        // path traversal
        @nm_rename_file(NMPOSTPATH . $file, NMBACKUPPATH . $file);
    }
    # empty titles are not allowed
    if (empty($_POST['post-title']) || trim($_POST['post-title']) == '') {
        $_POST['post-title'] = '[No Title]';
    }
    # set initial slug and filename
    if (!empty($_POST['post-slug'])) {
        $slug = nm_create_slug($_POST['post-slug']);
    } else {
        $slug = nm_create_slug($_POST['post-title']);
        if ($slug == '') {
            $slug = 'post';
        }
    }
    $file = NMPOSTPATH . $slug . '.xml';
    # do not overwrite other posts
    if (file_exists($file)) {
        $count = 1;
        $file = NMPOSTPATH . $slug . '-' . $count . '.xml';
        while (file_exists($file)) {
            $file = NMPOSTPATH . $slug . '-' . ++$count . '.xml';
        }
        $slug = basename($file, '.xml');
    }
    # create undo target if there's a backup available
    if (isset($_POST['current-slug'])) {
        $backup = $slug . ':' . $_POST['current-slug'];
    }
    # collect $_POST data
    $title = safe_slash_html($_POST['post-title']);
    $timestamp = strtotime($_POST['post-date'] . ' ' . $_POST['post-time']);
    $date = $timestamp ? date('r', $timestamp) : date('r');
    $tags = nm_lowercase_tags(trim(preg_replace(array('/\\s+/', '/\\s*,\\s*/', '/,+/'), array(' ', ',', ','), safe_slash_html(trim($_POST['post-tags']))), ','));
    $private = isset($_POST['post-private']) ? 'Y' : '';
    $image = safe_slash_html($_POST['post-image']);
    $content = safe_slash_html($_POST['post-content']);
    if (defined('NMSAVEAUTHOR') && NMSAVEAUTHOR) {
        if (isset($_POST['author'])) {
            $author = safe_slash_html($_POST['author']);
        } else {
            global $USR;
            $author = $USR ? $USR : '';
        }
    }
    # create xml object
    $xml = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><item></item>');
    $obj = $xml->addChild('title');
    $obj->addCData($title);
    $obj = $xml->addChild('date');
    $obj->addCData($date);
    $obj = $xml->addChild('tags');
    $obj->addCData($tags);
    $obj = $xml->addChild('private');
    $obj->addCData($private);
    $obj = $xml->addChild('image');
    $obj->addCData($image);
    $obj = $xml->addChild('content');
    $obj->addCData($content);
    if (isset($author)) {
        $obj = $xml->addChild('author');
        $obj->addCData($author);
    }
    # write data to file
    if (@XMLsave($xml, $file) && nm_update_cache()) {
        nm_generate_sitemap();
        nm_display_message(i18n_r('news_manager/SUCCESS_SAVE'), false, @$backup);
    } else {
        nm_display_message(i18n_r('news_manager/ERROR_SAVE'), true);
    }
}
开发者ID:hatasu,项目名称:appdroid,代码行数:80,代码来源:posts.php


示例14: i18n_r

        $sel = '';
        $count++;
    }
    $langs .= '</select><br />';
} else {
    $langs = '<b>' . i18n_r('LANGUAGE') . '</b>: &nbsp;<code style="color:red;">' . i18n_r('NONE') . '</code> &nbsp;&nbsp;';
}
# salt value generation
$api_file = GSDATAOTHERPATH . GSAUTHFILE;
if (!file_exists($api_file)) {
    if (getDef('GSUSECUSTOMSALT')) {
        $saltval = sha1(GSUSECUSTOMSALT);
    } else {
        $saltval = generate_salt();
    }
    $xml = new SimpleXMLExtended('<item></item>');
    $note = $xml->addChild('apikey');
    $note->addCData($saltval);
    if (!XMLsave($xml, $api_file)) {
        $kill = i18n_r('CHMOD_ERROR');
    }
}
# get salt value
$data = getXML($api_file);
$APIKEY = $data->apikey;
if (empty($APIKEY)) {
    $kill = i18n_r('CHMOD_ERROR');
}
$pagetitle = $site_full_name . ' &middot; ' . i18n_r('INSTALLATION');
get_template('header');
?>
开发者ID:kix23,项目名称:GetSimpleCMS,代码行数:31,代码来源:install.php


示例15: delete_in_category

function delete_in_category($file)
{
    $data = getXML($file);
    $section = $data->parent;
    $id = $data->url;
    $files = CATEGORIESPATH . '' . $section . '.xml';
    if (file_exists($files)) {
        $p = 0;
        $data = getXML($files);
        $array = array();
        foreach ($data->children() as $child) {
            if (sprintf("%s", $child) != $id) {
                $array[$p] = sprintf("%s", $child);
                $p++;
            }
        }
        //$array=array_reverse($array);
        $xml = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><item></item>');
        $xml->addChild('pubDate', date('r'));
        for ($i = 1; $i < $p; $i++) {
            $note = $xml->addChild('f' . $i);
            $note->addCData($array[$i]);
        }
        XMLsave($xml, $files);
    }
}
开发者ID:Emmett-Brown,项目名称:linea,代码行数:26,代码来源:template_functions.php


示例16: urlencode

        return urlencode($text);
    }
}
// -----------------------------------------------------
// start XML generation
$xml = <<<XML
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0"
    xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:wp="http://wordpress.org/export/1.2/"
></rss>
XML;
$rss = new SimpleXMLExtended($xml);
$namespaces = $rss->getDocNamespaces(true);
// load the Newblur exported JSON file
$file = file_get_contents("starred_stories.json");
$json = json_decode($file, true);
// Wordpress will choke if our post names aren't unique, so we track
// them separately
$post_names = array();
$channel = $rss->addChild("channel");
$channel->addChild("generator", basename(__FILE__));
$channel->addChild("wxr_version", "1.2", $namespaces["wp"]);
// base_site_url is MUST. WordPress Importer warns if this does not exist
$channel->addChild("base_site_url", "http://asiajin.com/blog", $namespaces["wp"]);
foreach ($json["stories"] as $item) {
    $rssItem = $channel->addChild("item");
    $content = null;
开发者ID:akky,项目名称:newsblur2wordpress,代码行数:31,代码来源:newsblur2wordpress.php


示例17: _addchild

 /**
  * recursive function to allow appending child processes to a parent process
  *
  * @param Array             $child      part of the array which should be appended to the XML
  * @param SimpleXMLExtended $xml        XML-Object to which the array content is appended
  * @param Array             &$positions array with parent positions in xml structure
  *
  * @return SimpleXMLExtended Object with the appended array content
  */
 private function _addchild($child, SimpleXMLExtended $xml, &$positions)
 {
     foreach ($child as $key => $value) {
         $xmlnode = $xml->addChild("Process");
         if (isset($value[0])) {
             array_push($positions, $value[0]);
             $xmlnode->addAttribute('PID', $value[0]);
             $parentid = array_search($value[1], $positions);
             $xmlnode->addAttribute('ParentID', $parentid);
             $xmlnode->addAttribute('PPID', $value[1]);
             $xmlnode->addAttribute('MemoryUsage', $value[2]);
             $xmlnode->addAttribute('Name', $value[3]);
             if (PSI_OS !== 'WINNT') {
                 if ($parentid === 1) {
                     $xmlnode->addAttribute('Expanded', 0);
                 }
                 if (defined('PSI_PLUGIN_PS_SHOW_KTHREADD_EXPANDED') && PSI_PLUGIN_PS_SHOW_KTHREADD_EXPANDED === false && $value[3] === "[kthreadd]") {
                     $xmlnode->addAttribute('Expanded', 0);
                 }
             }
         }
         if (isset($value['childs'])) {
             $this->_addChild($value['childs'], $xml, $positions);
         }
     }
     return $xml;
 }
开发者ID:kampee,项目名称:phpsysinfo,代码行数:36,代码来源:class.ps.inc.php


示例18: saveMenu

 private function saveMenu($post)
 {
     // initialization
     $return = $nodes = $saved = array();
     foreach ($post as $key => $val) {
         if (is_array($val)) {
             $nodes[] = $key;
         }
     }
     // sets up array
     foreach ($post['level'] as $key => $level) {
         foreach ($nodes as $node) {
             $return[$key][$node] = $post[$node][$key];
         }
         // fill empty fields
         if (empty($return[$key]['slug'])) {
             $return[$key]['slug'] = $this->strtoslug($return[$key]['title']);
         }
         // final formatting
         $return[$key]['slug'] = $this->strtoslug($return[$key]['slug']);
         $return[$key]['url'] = $this->transliterate($return[$key]['url']);
         // checks to see slug doesn't already exist
         if (in_array($return[$key]['slug'], $saved)) {
             $return[$key]['slug'] = $return[$key]['slug'] . '-' . rand(0, 100);
         }
         // add to saved array
         $saved[] = $return[$key]['slug'];
     }
     // build xml file
     $xml = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><channel/>');
     $cdata = array('title', 'url');
     // menu items
     $menu = $xml->addChild('menu');
     foreach ($return as $key => $item) {
         $itemxml = $menu->addChild('item');
         foreach ($item as $field => $val) {
             if (in_array($field, $cdata)) {
                 $itemxml->{$field} = null;
                 $itemxml->{$field}->addCData($val);
             } else {
                 $itemxml->addChild($field, $val);
             }
         }
     }
     // settings
     $settings = $xml->addChild('settings');
     // format the xml file (beautify)
     $dom = new DOMDocument();
     $dom->preserveWhiteSpace = false;
     $dom->loadXML($xml->saveXML());
     $dom->formatOutput = true;
     // save to file
     $post['name'] = $this->strtoslug($post['name']);
     $newfile = GSDATAOTHERPATH . self::FILE . '/' . $post['name'] . '.xml';
     if (isset($post['oldname'])) {
         $oldfile = GSDATAOTHERPATH . self::FILE . '/' . $post['oldname'] . '.xml';
         if (file_exists($oldfile) && !file_exists($newfile)) {
             unlink($oldfile);
         }
     }
     return $dom->save($newfile);
 }
开发者ID:elephantcode,项目名称:elephantcode,代码行数:62,代码来源:class.php


示例19: array

echo "job id = {$jobId}<br/>";
echo "packagename = {$packageName}<br/>";
echo "output dir = {$outputDir}<br/>";
$names = array();
// generate one testsuite for each run
$result = mysql_queryf("SELECT name,id FROM runs WHERE job_id = {$jobId};");
while ($run = mysql_fetch_array($result)) {
    $names[$packageName . '.' . $run['name']]['runId'] = $run['id'];
}
foreach ($names as $name => $value) {
    $runId = $value['runId'];
    $xmlstr = "<?xml version='1.0' ?>\n<testsuite></testsuite>";
    // get one testsuite for each useragent (mozilla 3.5, opera 10, ...)
    $result = mysql_queryf("SELECT run_id,useragent_id,name,os FROM run_useragent LEFT OUTER JOIN useragents ON run_useragent.useragent_id = useragents.id WHERE run_id={$runId} AND status=2");
    while ($runAtAgend = mysql_fetch_array($result)) {
        $xml = new SimpleXMLExtended($xmlstr);
        $testsuiteName = $name . '.' . str_replace('.', '-', $runAtAgend['name'] . " on " . $runAtAgend['os']);
        $xml->addAttribute('name', $testsuiteName);
        $value['useragents'][$runAtAgend['useragent_id']]['xml'] = $xml;
        $value['useragents'][$runAtAgend['useragent_id']]['name'] = $testsuiteName;
    }
    // create on test foreach clientrun of user agent
    foreach ($value['useragents'] as $userAgentId => $useragent) {
        $xml = $useragent['xml'];
        $errors = 0;
        $tests = 0;
        $failures = 0;
        $sysout = '';
        $result = mysql_queryf("SELECT fail,error,total,results,ip,useragent FROM run_client INNER JOIN clients ON run_client.client_id = clients.id WHERE useragent_id={$userAgentId} AND run_id={$runId}");
        while ($runAtClient = mysql_fetch_array($result)) {
            preg_match('/\\(.*\\)/', $runAtClient['useragent'], $matches);
开发者ID:hoschi,项目名称:testswarm,代码行数:31,代码来源:getxml.php


示例20: render

 /**
  * returns the XML string
  *
  * @return string
  * @throws \Zend_Config_Exception
  */
 public function render()
 {
     $xml = new SimpleXMLExtended('<' . $this->getRootElementName() . ' />');
     if ($this->_config) {
         $extends = $this->_config->getExtends();
         $sectionName = $this->_config->getSectionName();
         if (is_string($sectionName)) {
             $child = $xml->addChild($sectionName);
             $this->_addBranch($this->_config, $child, $xml);
         } else {
             foreach ($this->_config as $sectionName => $data) {
                 if (!$data instanceof \Zend_Config) {
                     $this->addChildConsiderCdata($xml, $sectionName, $data);
                 } else {
                     $child = $xml->addChild($sectionName);
                     if (isset($extends[$sectionName])) {
                         $child->addAttribute('zf:extends', $extends[$sectionName], \Zend_Config_Xml::XML_NAMESPACE);
                     }
                     $this->_addBranch($data, $child, $xml);
                 }
             }
         }
     }
     $dom = dom_import_simplexml($xml)->ownerDocument;
     if ($encoding = $this->getEncoding()) {
         $dom->encoding = $encoding;
     }
     $dom->formatOutput = $this->getFormatOutput();
     $xmlString = $dom->saveXML();
     return $xmlString;
 }
开发者ID:sfie,项目名称:pimcore,代码行数:37,代码来源:XmlWriter.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP SimpleXMLIterator类代码示例发布时间:2022-05-23
下一篇:
PHP SimpleXMLElement类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap