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


PHP xml::load方法代码示例

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


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

示例1: parse_query

 function parse_query($expression, $document)
 {
     if (preg_match('/\\A([\\w:]+)\\(([^\\)]*)\\)\\Z/', $expression, $match)) {
         return $this->query($match[1], args::decode($match[2]), $document);
     } else {
         if (!isset($this->cache[$expression])) {
             $this->cache[$expression] = xml::load($expression);
         }
         return $this->cache[$expression];
     }
 }
开发者ID:nyan-cat,项目名称:easyweb,代码行数:11,代码来源:dispatcher.php

示例2: load

 function load($filename)
 {
     $this->xml = xml::load($filename);
     $query = array();
     foreach (self::$languages as $language) {
         $query[] = "/local//{$language}";
     }
     foreach ($this->xml->query(implode('|', $query)) as $node) {
         $doc = new xml();
         foreach ($this->xml->query('* | text()', $node) as $piece) {
             $doc->append($doc->import($piece));
         }
         $path = explode(':', str_replace('/', ':', trim($node->path(), '/')));
         array_shift($path);
         $this->local[implode(':', $path)] = xtree::create($doc);
     }
 }
开发者ID:nyan-cat,项目名称:easyweb,代码行数:17,代码来源:locale.php

示例3: read

 public function read($url)
 {
     extract($this->using('xml', 'archive'));
     $file = TM_TEMP_DIR . md5($url);
     @unlink($file);
     $archive->download($url, $file);
     $feed = array('head' => array(), 'body' => array());
     if (file_exists($file)) {
         $xml = new xml();
         $xml->load($file);
         $nodes = $xml->get_nodes('rss/channel');
         if (!empty($nodes['_nodes'])) {
             foreach ($nodes['_nodes'] as $i => $v) {
                 $channel_node =& $nodes['_nodes'][$i]['channel'];
                 if (!empty($channel_node['_nodes'])) {
                     foreach ($channel_node['_nodes'] as $j => $w) {
                         reset($w);
                         list($name) = each($w);
                         if (preg_match('/^(copyright|pubdate|description|link|title)$/', $name)) {
                             $feed['head'][$name] = $w[$name]['_data'];
                         } else {
                             if ($name == 'item') {
                                 $item_node =& $w['item'];
                                 $item =& $feed['body'][];
                                 if (isset($item_node)) {
                                     foreach ($item_node['_nodes'] as $k => $x) {
                                         list($name) = each($x);
                                         if (preg_match('/^(title|link|description|pubdate|guid)$/i', $name)) {
                                             $item[$name] = $x[$name]['_data'];
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         return $feed;
     }
 }
开发者ID:laiello,项目名称:xiv,代码行数:41,代码来源:feedreader.php

示例4: api

<?php

$config = xml::load($options->config);
$root = $config->root();
$templates = $root->attribute('templates');
$data = $root->attribute('data');
$scripts = $root->attribute('scripts');
$engine = $root->attribute('engine');
$schema = $root->attribute('schema');
$this->api = new api($schema);
$this->locale = new locale($options->language, $options->country);
$this->locale->load($root['@locale']);
foreach ($config->query('/config/pages//page') as $page) {
    $params = [];
    foreach ($config->query_assoc('param[@name and @value]', $page, '@name', '@value') as $name => $value) {
        $params[$name] = (object) ['type' => 'value', 'value' => $value];
    }
    foreach ($config->query_assoc('param[@name and @query]', $page, '@name', '@query') as $name => $value) {
        $params[$name] = (object) ['type' => 'query', 'value' => $value];
    }
    foreach ($config->query('param[@name and @get]', $page) as $param) {
        $array = ['type' => 'get', 'value' => $param['@get']];
        if ($default = $param->attribute('default')) {
            $array['default'] = $default;
        }
        $params[$param['@name']] = (object) $array;
    }
    foreach ($config->query('param[@name and @post]', $page) as $param) {
        $array = ['type' => 'post', 'value' => $param['@post']];
        if (($default = $param->attribute('default')) !== null) {
            $array['default'] = $default;
开发者ID:nyan-cat,项目名称:easyweb,代码行数:31,代码来源:www_load.php

示例5: load_sql_procedures

<?php

$config = xml::load(config_location);
foreach ($config->query('/config/vars//var') as $var) {
    $this->vars->insert($var['@name'], $var['@value']);
}
function load_sql_procedures($config, $vars, $drivers)
{
    $procedures = array();
    foreach ($drivers as $easyweb => $pdo) {
        foreach ($config->query('/config/datasources//datasource[@type = "' . $easyweb . '"]') as $ds) {
            $datasource = new sql_datasource($pdo, $ds['@server'], $ds['@username'], $ds['@password'], $ds['@database'], $ds['@charset']);
            foreach ($config->query('/config/procedures//procedure[@datasource = "' . $ds['@name'] . '"]') as $procedure) {
                $procedures[] = new sql_procedure($vars, $datasource, $procedure['@name'], $config->query_assoc('param', $procedure, '@name', '@type'), $procedure->attribute('empty') !== 'false', $procedure->attribute('root'), $procedure->attribute('item'), $procedure->value(), $config->query_assoc('output', $procedure, '@name', '@transform'), $procedure->attribute('permission'), $procedure->attribute('cache') !== 'false');
            }
        }
    }
    return $procedures;
}
function load_template($config, $node)
{
    if ($node) {
        $template = new template($node['@src'], args::decode($node->attribute('args', '')), $node->attribute('xml'));
        foreach ($config->query('template', $node) as $child) {
            $template->insert($child['@name'], load_template($config, $child));
        }
        return $template;
    } else {
        return null;
    }
}
开发者ID:nyan-cat,项目名称:easyweb,代码行数:31,代码来源:www_load.php

示例6: load

 static function load($filename)
 {
     return new censor(xml::load($filename));
 }
开发者ID:nyan-cat,项目名称:easyweb,代码行数:4,代码来源:censor.php


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