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


PHP Gadget::getJsLibraries方法代码示例

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


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

示例1: testGetJsLibraries

 /**
  * Tests Gadget->getJsLibraries()
  */
 public function testGetJsLibraries()
 {
     $this->Gadget->addJsLibrary('A');
     $this->Gadget->addJsLibrary('B');
     $this->Gadget->addJsLibrary('C');
     $this->Gadget->addJsLibrary('D');
     $string = implode('', $this->Gadget->getJsLibraries());
     $this->assertEquals('ABCD', $string);
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:12,代码来源:GadgetTest.php

示例2: getJsUrl

 /**
  * generates the library string (core:caja:etc.js) including a checksum of all the
  * javascript content (?v=<sha1 of js) for cache busting
  *
  * @param string $libs
  * @param Gadget $gadget
  * @return string the list of libraries in core:caja:etc.js?v=checksum> format
  */
 private function getJsUrl($libs, $gadget)
 {
     $buf = '';
     if (!is_array($libs) || !count($libs)) {
         $buf = 'core';
     } else {
         $firstDone = false;
         foreach ($libs as $lib) {
             if ($firstDone) {
                 $buf .= ':';
             } else {
                 $firstDone = true;
             }
             $buf .= $lib;
         }
     }
     // Build a version string from the sha1() checksum of all included javascript
     // to ensure the client always has the right version
     $inlineJs = '';
     foreach ($gadget->getJsLibraries() as $library) {
         $type = $library->getType();
         if ($type != 'URL') {
             $inlineJs .= $library->getContent() . "\n";
         }
     }
     $buf .= ".js?v=" . sha1($inlineJs);
     return $buf;
 }
开发者ID:jkinner,项目名称:ringside,代码行数:36,代码来源:GadgetRenderingServlet.php

示例3: appendJsConfig

 /**
  * Appends the javascript features configuration string
  *
  * @param Gadget $gadget
  * @param unknown_type $hasForcedLibs
  * @return string
  */
 private function appendJsConfig(Gadget $gadget, $hasForcedLibs)
 {
     $container = $this->context->getContainer();
     $containerConfig = $this->context->getContainerConfig();
     //TODO some day we should parse the forcedLibs too, and include their config selectivly as well for now we just include everything if forced libs is set.
     if ($hasForcedLibs) {
         $gadgetConfig = $containerConfig->getConfig($container, 'gadgets.features');
     } else {
         $gadgetConfig = array();
         $featureConfig = $containerConfig->getConfig($container, 'gadgets.features');
         foreach ($gadget->getJsLibraries() as $library) {
             $feature = $library->getFeatureName();
             if (!isset($gadgetConfig[$feature]) && !empty($featureConfig[$feature])) {
                 $gadgetConfig[$feature] = $featureConfig[$feature];
             }
         }
     }
     // Add gadgets.util support. This is calculated dynamically based on request inputs.
     // See java/org/apache/shindig/gadgets/render/RenderingContentRewriter.java for reference.
     $requires = array();
     foreach ($gadget->features as $feature) {
         $requires[$feature] = new EmptyClass();
     }
     $gadgetConfig['core.util'] = $requires;
     if (isset($gadgetConfig['osml'])) {
         unset($gadgetConfig['osml']);
     }
     if (!isset($gadgetConfig['osapi.services']) || count($gadgetConfig['osapi.services']) == 1) {
         // this should really be set in config/container.js, but if not, we build a complete default set so at least most of it works out-of-the-box
         $gadgetConfig['osapi.services'] = array('gadgets.rpc' => array('container.listMethods'), 'http://%host%/social/rpc' => array("messages.update", "albums.update", "activities.delete", "activities.update", "activities.supportedFields", "albums.get", "activities.get", "mediaitems.update", "messages.get", "appdata.get", "system.listMethods", "people.supportedFields", "messages.create", "mediaitems.delete", "mediaitems.create", "people.get", "people.create", "albums.delete", "messages.delete", "appdata.update", "activities.create", "mediaitems.get", "albums.create", "appdata.delete", "people.update", "appdata.create"), 'http://%host%/gadgets/api/rpc' => array('cache.invalidate'));
     }
     return "gadgets.config.init(" . json_encode($gadgetConfig) . ");\n";
 }
开发者ID:emma5021,项目名称:toba,代码行数:40,代码来源:GadgetBaseRenderer.php


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