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


PHP Auth_Yadis_getXMLParser函数代码示例

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


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

示例1: detect_xml

function detect_xml($r, &$out)
{
    global $__Auth_Yadis_xml_extensions;
    $out .= $r->h2('XML Support');
    // Try to get an XML extension.
    $ext = Auth_Yadis_getXMLParser();
    if ($ext !== null) {
        $out .= $r->p('XML parsing support is present using the ' . $r->b(get_class($ext)) . ' interface.');
        return true;
    } else {
        $out .= $r->p('XML parsing support is absent; please install one ' . 'of the following PHP extensions:');
        foreach ($__Auth_Yadis_xml_extensions as $name => $cls) {
            $out .= "<li>" . $r->b($name) . "</li>";
        }
        return false;
    }
}
开发者ID:Jobava,项目名称:diacritice-meta-repo,代码行数:17,代码来源:detect.php

示例2: _checkForm

 function _checkForm($html, $message_, $action_url, $form_tag_attrs, $submit_text)
 {
     $parser =& Auth_Yadis_getXMLParser();
     // Parse HTML source
     $this->assertTrue($parser->init($html, array()));
     // Get root element
     $form = $parser->evalXPath('/form[1]');
     $this->assertTrue(count($form) == 1);
     $form = $form[0];
     // Check required form attributes
     $form_attrs = $parser->attributes($form);
     foreach ($this->required_form_attrs as $k => $v) {
         $this->assertTrue($form_attrs[$k] == $v);
     }
     // Check extra form attributes
     foreach ($form_tag_attrs as $k => $v) {
         // Skip attributes that already passed the required
         // attribute check, since they should be ignored by the
         // form generation code.
         if (in_array($k, array_keys($this->required_form_attrs))) {
             continue;
         }
         $this->assertTrue($form_attrs[$k] == $v, "Form attr {$k} is " . $form_attrs[$k] . " (expected {$v})");
     }
     // Check hidden fields against post args
     $hiddens = array();
     $input_elements = $parser->evalXPath('input', $form);
     foreach ($input_elements as $e) {
         $attrs = $parser->attributes($e);
         if (strtoupper($attrs['type']) == 'HIDDEN') {
             $hiddens[] = $e;
         }
     }
     // For each post arg, make sure there is a hidden with that
     // value.  Make sure there are no other hiddens.
     $postargs = $message_->toPostArgs();
     foreach ($postargs as $name => $value) {
         $found = false;
         foreach ($hiddens as $e) {
             $attrs = $parser->attributes($e);
             if ($attrs['name'] == $name) {
                 $this->assertTrue($attrs['value'] == $value);
                 $found = true;
                 break;
             }
         }
         if (!$found) {
             $this->fail("Post arg {$name} not found in form");
         }
     }
     $keys = array_keys($postargs);
     foreach ($hiddens as $e) {
         $attrs = $parser->attributes($e);
         $this->assertTrue(in_array($attrs['name'], $keys));
     }
     // Check action URL
     $this->assertTrue($form_attrs['action'] == $action_url);
     // Check submit text
     $submits = array();
     foreach ($input_elements as $e) {
         $attrs = $parser->attributes($e);
         if (strtoupper($attrs['type']) == 'SUBMIT') {
             $submits[] = $e;
         }
     }
     $this->assertTrue(count($submits) == 1);
     $attrs = $parser->attributes($submits[0]);
     $this->assertTrue($attrs['value'] == $submit_text);
 }
开发者ID:Jobava,项目名称:diacritice-meta-repo,代码行数:69,代码来源:Message.php

示例3: Auth_Yadis_getXMLParser

 /**
  * Parse an XML string (XRDS document) and return either a
  * Auth_Yadis_XRDS object or null, depending on whether the
  * XRDS XML is valid.
  *
  * @param string $xml_string An XRDS XML string.
  * @return mixed $xrds An instance of Auth_Yadis_XRDS or null,
  * depending on the validity of $xml_string
  */
 function &parseXRDS($xml_string, $extra_ns_map = null)
 {
     $_null = null;
     if (!$xml_string) {
         return $_null;
     }
     $parser = Auth_Yadis_getXMLParser();
     $ns_map = Auth_Yadis_getNSMap();
     if ($extra_ns_map && is_array($extra_ns_map)) {
         $ns_map = array_merge($ns_map, $extra_ns_map);
     }
     if (!($parser && $parser->init($xml_string, $ns_map))) {
         return $_null;
     }
     // Try to get root element.
     $root = $parser->evalXPath('/xrds:XRDS[1]');
     if (!$root) {
         return $_null;
     }
     if (is_array($root)) {
         $root = $root[0];
     }
     $attrs = $parser->attributes($root);
     if (array_key_exists('xmlns:xrd', $attrs) && $attrs['xmlns:xrd'] != Auth_Yadis_XMLNS_XRDS) {
         return $_null;
     } else {
         if (array_key_exists('xmlns', $attrs) && preg_match('/xri/', $attrs['xmlns']) && $attrs['xmlns'] != Auth_Yadis_XMLNS_XRD_2_0) {
             return $_null;
         }
     }
     // Get the last XRD node.
     $xrd_nodes = $parser->evalXPath('/xrds:XRDS[1]/xrd:XRD');
     if (!$xrd_nodes) {
         return $_null;
     }
     $xrds = new Auth_Yadis_XRDS($parser, $xrd_nodes);
     return $xrds;
 }
开发者ID:sdgdsffdsfff,项目名称:auth-center,代码行数:47,代码来源:XRDS.php


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