code: function() {
          var metadata = this.metadata;
          if (!metadata.resourceSets || !this.map || !this.map.center) {
              return;
          }
          var res = metadata.resourceSets[0].resources[0];
          var extent = this.map.getExtent().transform(
              this.map.getProjectionObject(),
              new OpenLayers.Projection("EPSG:4326")
          );
          var providers = res.imageryProviders || [],
              zoom = OpenLayers.Util.indexOf(this.serverResolutions,
                                             this.getServerResolution()),
              copyrights = "", provider, i, ii, j, jj, bbox, coverage;
          for (i=0,ii=providers.length; i<ii; ++i) {
              provider = providers[i];
              for (j=0,jj=provider.coverageAreas.length; j<jj; ++j) {
                  coverage = provider.coverageAreas[j];
                  // axis order provided is Y,X
                  bbox = OpenLayers.Bounds.fromArray(coverage.bbox, true);
                  if (extent.intersectsBounds(bbox) &&
                          zoom <= coverage.zoomMax && zoom >= coverage.zoomMin) {
                      copyrights += provider.attribution + " ";
                  }
              }
          }
          var logo = metadata.brandLogoUri.replace(this.protocolRegex, this.protocol);
          this.attribution = OpenLayers.String.format(this.attributionTemplate, {
              type: this.type.toLowerCase(),
              logo: logo,
              copyrights: copyrights
          });
          this.map && this.map.events.triggerEvent("changelayer", {
              layer: this,
              property: "attribution"
          });
      }
docs: Method: updateAttribution
  Updates the attribution according to the requirements outlined in
  http://gis.638310.n2.nabble.com/Bing-imagery-td5789168.html