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


PHP XmlParser::readDocumentByUri方法代码示例

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


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

示例1: executePopupHelp

 public function executePopupHelp()
 {
     $idXml = $this->hasRequestParameter('idXml') ? $this->getRequestParameter('idXml') : false;
     if ($idXml) {
         // Read doc
         $info['html'] = "<table border='0' cellpadding='0' cellspacing='0' id='whelp'><tr><th colspan=3><strong>Widget Help</strong></th></tr>";
         $xp = XmlParser::readDocumentByUri($idXml);
         // Parse variables..
         $module = strtok($idXml, "/");
         $action = strtok("/");
         $vars = afConfigUtils::getConfigVars($module, $action, $this->getRequest());
         $ps = $xp->evaluate("/i:view/descendant::*[(local-name(.)='title' or local-name(.)='tooltip' or local-name(.)='help') and contains(.,'{') and contains(.,'}')]");
         foreach ($ps as $node) {
             preg_match_all("/(\\{[^\\}]+\\})/", $node->nodeValue, $matches);
             foreach ($matches[1] as $tmp) {
                 $match = true;
                 $tmp = preg_replace("/[\\{\\}]+/", "", $tmp);
                 if (array_key_exists($tmp, $vars)) {
                     $node->nodeValue = str_replace("{" . $tmp . "}", $vars[$tmp], $node->nodeValue);
                 } else {
                     $info = array("success" => false, "message" => "The variable \"" . $tmp . "\" cannot be found among " . $idXml . " variables!");
                     $info = json_encode($info);
                     return $this->renderText($info);
                 }
             }
         }
         // View type
         $view = $xp->evaluate("//i:view")->item(0)->getAttribute("type");
         // Title
         $title = $xp->evaluate("//i:title")->item(0)->nodeValue;
         $wh = $xp->evaluate("//i:description");
         if ($wh->length) {
             $info['html'] .= "<tr><td colspan=2>" . $wh->item(0)->nodeValue . "</td></tr>";
         } else {
             $info['html'] .= "<tr><td colspan=2>Not available..</td></tr>";
         }
         if ($view == "edit" || $view == "show") {
             $fields = $xp->evaluate("//i:field[@type!='hidden']");
             $info['html'] .= "<tr><th><strong>Field</strong></th><th><strong>Tip</strong></th></tr>";
             $tmp = array();
             $found = false;
             foreach ($fields as $t) {
                 $tip = $xp->evaluate("./i:tooltip", $t);
                 if ($tip->length == 1) {
                     $h = $tip->item(0)->nodeValue;
                 } else {
                     $h = "";
                 }
                 if (trim($h)) {
                     $info['html'] .= "<tr><td>" . $t->getAttribute("label") . "</td><td>" . $h . "</td></tr>";
                     $found = true;
                 }
             }
             if (!$found) {
                 $info['html'] .= "<tr><td colspan=2>Not available..</td></tr>";
             }
         }
         $info['html'] .= "</table>";
         $info['winConfig']['title'] = $title . " Help";
         $info['winConfig']['width'] = 500;
         $info['winConfig']['height'] = 300;
     }
     $info = json_encode($info);
     return $this->renderText($info);
 }
开发者ID:cbsistem,项目名称:appflower_engine,代码行数:65,代码来源:actions.class.php

示例2: isUnAllowedWidget

 private function isUnAllowedWidget($uri)
 {
     $xp = XmlParser::readDocumentByUri($uri);
     $ret = $xp->evaluate("//i:view[@type='edit']|//i:view[@type='show']|//i:view[@type='wizard']")->length;
     if ($ret) {
         return false;
     }
     $module = substr($uri, 0, strrpos($uri, "/"));
     $method = "execute" . ucfirst(substr($uri, strrpos($uri, "/") + 1));
     $class = $module . "Actions";
     if (!class_exists($class) && !in_array($class, $this->classes)) {
         require_once $this->modules_dir . "/" . $module . "/actions/actions.class.php";
         $this->classes[] = $class;
     }
     $obj = new $class($this->context, $module, $method);
     $ret = !method_exists($obj, $method);
     if ($ret) {
         afWidgetSelectorPeer::removeWidgetByUrl($uri);
         return false;
     }
     $permission = $obj->getCredential();
     if (is_null($permission)) {
         return false;
     }
     if (is_array($permission)) {
         $permission = json_encode($permission);
     }
     return $permission;
 }
开发者ID:cbsistem,项目名称:appflower_engine,代码行数:29,代码来源:afUpdateWidgetSelectorTask.class.php


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