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


PHP Gadget::setChecksum方法代码示例

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


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

示例1: parse

 public function parse($xml, $context)
 {
     if (empty($xml)) {
         throw new SpecParserException("Empty XML document");
     }
     // make sure we can generate a detailed error report
     libxml_use_internal_errors(true);
     if (($doc = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)) == false) {
         $errors = @libxml_get_errors();
         $xmlErrors = '';
         foreach ($errors as $error) {
             $xmlErrors .= $this->displayXmlError($error);
         }
         @libxml_clear_errors();
         throw new SpecParserException("<b>Invalid XML Document</b><br/>\n" . $xmlErrors);
     }
     if (count($doc->ModulePrefs) != 1) {
         throw new SpecParserException("Missing or duplicated <ModulePrefs>");
     }
     $gadget = new Gadget($context->getGadgetId(), $context);
     // record Checksum to trace xml version
     $gadget->setChecksum($xml);
     // process ModulePref attributes
     $this->processModulePrefs($gadget, $doc->ModulePrefs);
     if (isset($doc->ModulePrefs->OAuth)) {
         // process OAuthPref attributes
         $this->processOAuthSpec($gadget, $doc->ModulePrefs->OAuth, $context);
     }
     // process UserPrefs, if any
     foreach ($doc->UserPref as $pref) {
         $this->processUserPref($gadget, $pref);
     }
     foreach ($doc->Content as $content) {
         $this->processContent($gadget, $content);
     }
     foreach ($doc->ModulePrefs->Preload as $feature) {
         $gadget->preloads[] = new Preload($feature);
     }
     foreach ($doc->ModulePrefs->Require as $feature) {
         $this->processFeature($gadget, $feature, true);
     }
     foreach ($doc->ModulePrefs->Optional as $feature) {
         $this->processFeature($gadget, $feature, false);
     }
     foreach ($doc->ModulePrefs->Icon as $icon) {
         $this->processIcon($gadget, $icon);
     }
     return $gadget;
 }
开发者ID:hgschmie,项目名称:shindig,代码行数:49,代码来源:GadgetSpecParser.php

示例2: parse

 public function parse($xml, $context)
 {
     if (empty($xml)) {
         throw new SpecParserException("Empty XML document");
     }
     // make sure we can generate a detailed error report
     libxml_use_internal_errors(true);
     if (($doc = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)) == false) {
         $errors = @libxml_get_errors();
         $xmlErrors = '';
         foreach ($errors as $error) {
             $xmlErrors .= $this->displayXmlError($error);
         }
         @libxml_clear_errors();
         throw new SpecParserException("<b>Invalid XML Document</b><br/>\n" . $xmlErrors);
     }
     if (count($doc->ModulePrefs) != 1) {
         throw new SpecParserException("Missing or duplicated <ModulePrefs>");
     }
     $gadget = new Gadget($context->getGadgetId(), $context);
     // record Checksum to trace xml version
     $gadget->setChecksum($xml);
     // process ModulePref attributes
     $this->processModulePrefs($gadget, $doc->ModulePrefs);
     if (isset($doc->ModulePrefs->OAuth)) {
         // process OAuthPref attributes
         $this->processOAuthSpec($gadget, $doc->ModulePrefs->OAuth, $context);
     }
     // process UserPrefs, if any
     foreach ($doc->UserPref as $pref) {
         $this->processUserPref($gadget, $pref);
     }
     // Assume gadget v1
     $explicit_profile = false;
     foreach ($doc->Content as $content) {
         $attributes = $content->attributes();
         if (empty($attributes['type'])) {
             throw new SpecParserException("No content type specified!");
         }
         $view = isset($attributes['view']) ? trim($attributes['view']) : '';
         // Note if we find a profile explicity defined
         if (strpos($view, "profile") !== false) {
             $explicit_profile = true;
         }
     }
     foreach ($doc->Content as $content) {
         $attributes = $content->attributes();
         if (empty($attributes['type'])) {
             throw new SpecParserException("No content type specified!");
         }
         $view = isset($attributes['view']) ? trim($attributes['view']) : '';
         // If view isnt defined and we didnt find a profile explicity defined
         if ($view == '') {
             if (!$explicit_profile) {
                 $this->processContent($gadget, $content, array(0 => DEFAULT_VIEW));
             }
             // If view isnt defined and a profile was found, this will catch it
         } else {
             $views = explode(',', $view);
             $this->processContent($gadget, $content, $views);
         }
     }
     foreach ($doc->ModulePrefs->Preload as $feature) {
         $gadget->preloads[] = new Preload($feature);
     }
     foreach ($doc->ModulePrefs->Require as $feature) {
         $this->processFeature($gadget, $feature, true);
     }
     foreach ($doc->ModulePrefs->Optional as $feature) {
         $this->processFeature($gadget, $feature, false);
     }
     foreach ($doc->ModulePrefs->Icon as $icon) {
         $this->processIcon($gadget, $icon);
     }
     return $gadget;
 }
开发者ID:jakob-stoeck,项目名称:os_poker,代码行数:76,代码来源:GadgetSpecParser.php


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