當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。