本文整理汇总了PHP中XML::load方法的典型用法代码示例。如果您正苦于以下问题:PHP XML::load方法的具体用法?PHP XML::load怎么用?PHP XML::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XML
的用法示例。
在下文中一共展示了XML::load方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: start
public static function start()
{
// Gets current time, next update, and expiration.
// Note: i'm making the last two digits to zero. for rounding purposes.
self::$_NOW = BMK;
self::$_TTU = (int) substr((string) self::$_NOW + self::$_TTU, 0, -2) . '00';
self::$_EXP = (int) substr((string) self::$_NOW + self::$_EXP, 0, -2) . '00';
// set the session id with the IP, User-agent and the fingerkey
// TODO: Add username for login based frameworks
session_id(self::$_ID = md5($_SERVER['SERVER_ADDR'] . $_SERVER['HTTP_USER_AGENT'] . Core::config('sess_finger')));
// set the XML dom document, or create it if non existent.
if (file_exists(SESS . 'session')) {
XML::load(SESS . 'session');
} else {
XML::set(SESS . 'session');
}
// if we can't find the ID set, create it in the index..
if (!($element = XML::get_id(self::$_ID))) {
XML::append(array('tagname' => 'session', 'id' => self::$_ID, 'exp' => self::$_EXP));
}
// remove all expired sessions
self::gc(0);
// start session
session_start();
}
示例2: parse
/**
* @param string $xrds
*/
protected function parse($xrds)
{
$xml = XML::load($xrds);
if (count(XML::errors()) > 0) {
return false;
}
$l = $xml->getElementsByTagName('Service');
if ($l->length == 0) {
return false;
}
$priority = 100000;
$index = 0;
foreach ($l as $ind => $service) {
$p = (int) $service->getAttribute('priority');
if ($p < $priority) {
$priority = $p;
$index = $ind;
}
}
$el = $l->item($index);
return $this->parse_service($el);
}
示例3: filemtime
if (empty($_REQUEST['id'])) {
jieqi_printfail(LANG_ERROR_PARAMETER);
}
jieqi_getconfigs(JIEQI_MODULE_NAME, 'sort');
jieqi_getconfigs(JIEQI_MODULE_NAME, 'configs');
$opf_file = jieqi_uploadpath($jieqiConfigs['article']['opfdir'], 'article') . jieqi_getsubdir($_REQUEST['id']) . '/' . $_REQUEST['id'] . '/index' . $jieqi_file_postfix['opf'];
if (!is_file($opf_file)) {
jieqi_printfail($jieqiLang['article']['article_not_exists']);
}
//文章最后更新时间
$lastupdate = filemtime($opf_file);
//打包大小类型标志
$vsflags = array('0' => 1, '64' => 2, '128' => 4, '256' => 8, '512' => 16, '1024' => 32);
include_once JIEQI_ROOT_PATH . '/lib/xml/xml.php';
$opf_xml = new XML();
$opf_xml->load($opf_file);
$opf_metas = array();
$tmpary = explode('-', $opf_xml->firstChild->attributes['unique-identifier']);
$tmpvar = count($tmpary);
if ($tmpvar >= 3 && is_numeric($tmpary[$tmpvar - 1]) && is_numeric($tmpary[$tmpvar - 2])) {
$opf_metas['dc:Sortid'] = $tmpary[$tmpvar - 1];
}
$meta = $opf_xml->firstChild->firstChild->firstChild->firstChild;
while ($meta) {
$opf_metas[$meta->nodeName] = $meta->firstChild->nodeValue;
$meta = $meta->nextSibling;
}
unset($meta);
if (intval($opf_metas['dc:Display']) > 0) {
jieqi_printfail($jieqiLang['article']['article_not_exists']);
}
示例4: is_keyword
/**
* This function checks whether the specified token is a reserved keyword.
*
* @access public
* @static
* @param string $token the token to be cross-referenced
* @return boolean whether the token is a reserved keyword
*
* @see http://www.postgresql.org/docs/7.3/static/sql-keywords-appendix.html
*/
public static function is_keyword($token)
{
if (static::$xml === NULL) {
static::$xml = XML::load('config/sql/postgresql.xml');
}
$token = strtoupper($token);
$nodes = static::$xml->xpath("/sql/dialect[@name='postgresql' and @version='7.3']/keywords[keyword = '{$token}']");
return !empty($nodes);
}
示例5: parse
/**
* Выполняет разбор документа ленты
*
* @param string $xml
*
* @return XML_Feed_Feed
*/
public function parse($xml, $path = null)
{
$document = XML::load(str_replace('xmlns=', 'ns=', $xml));
if (!$document instanceof DOMDocument) {
throw new XML_Feed_BadFileException($path);
}
return new XML_Feed_Feed($document, $this->detect_protocol_for($document));
}