Creates a link Element to load an external stylesheet

@method stylesheet
@param  {String} arg   URL to stylesheet
@param  {String} media [Optional] Medias the stylesheet applies to
@return {Objecct}      Stylesheet
167869
function ( arg, media ) {
		return element.create( "link", {rel: "stylesheet", type: "text/css", href: arg, media: media || "print, screen"}, utility.$( "head" )[0] );
	}
603344
private function makeLink($args)
    {
        if (!isset($args['href'])) {
            Core::i()->log->warning('Unable to add stylesheet, no href attribute.');
            return false;
        }
        if (!isset($args['rel'])) {
            $args['rel'] = 'stylesheet';
        }
        if (!isset($args['type']) && $args['rel'] == 'stylesheet') {
            $args['type'] = 'text/css';
        }

        $link = '<link';
        foreach ($args as $key => $value) {
            $link .= ' ' . $key . '="' . $value . '"';
        }
        $link .= ' />';
        return $link;
    }
7199
function bin(argv) {
  // setup config
  var config = require('../config/config.js')

  program
  .option('-d, --database <database>', 'Database')
  .parse(argv)

  var defaultDatabase = 'media'

  config.database = program.database || config.database || defaultDatabase
  var mediaURI     = process.argv[2]
  var length       = process.argv[3]
  var subtitlesURI = process.argv[4]
  var charenc      = process.argv[5]

  if (!mediaURI) {
    console.error('Please supply a media URI')
  }

  var params           = {}
  params.uri           = mediaURI
  params.length        = length
  params.subtitlesURI  = subtitlesURI
  params.charenc       = charenc

  qpm_media.addMeta(params).then(function(ret) {
    if (ret.conn) {
      ret.conn.close()
    }
    if (ret.ret) {
      console.log(ret.ret)
    }
  }).catch(function(err) {
    console.error(err)
  })

}
243495
function renderSocialMediaField( $args ) {
		unset( $args['label_for'], $args['class'] );
		$this->renderCheckbox(
			[
				'id' => 'social_media',
				'name' => 'pressbooks_theme_options_' . $this->getSlug(),
				'option' => 'social_media',
				'value' => ( isset( $this->options['social_media'] ) ) ? $this->options['social_media'] : '',
				'label' => $args[0],
			]
		);
	}
633724
function bin(argv) {
  // setup config
  var config = require('../config/config.js')



  program
  .arguments('<uri> [uris...]')
  .option('-d, --database <database>', 'Database')
  .parse(argv)


  var defaultDatabase = 'media'

  config.database = program.database || config.database || defaultDatabase

  var uris = program.args;
  if (!uris || uris.length === 0) {
    return 'You must enter a valid uri'
  }

  // Usage
  var i = 0;
  qpm_queue.promiseWhile(function () { return i < uris.length }, function () {
    qpm_media.addMedia(uris[i]).then(function(ret) {
      console.log(ret)
      ret.conn.close()
    }).catch(function(err){
      console.error(err)
    })

    console.log(i);
    i++;
    return Q.delay(1000); // arbitrary async
  }).then(function () {
      console.log("done");
  }).done();



}
896233
function applyCss(element, args) {
                    if (element && args) {
                        for (var i = 0; i < args.length; i++) {
                            var className = args[i];
                            if (className) {
                                if (element.className) {
                                    element.className += ' ';
                                }
                                element.className += _classPrefix + className;
                            }
                        }
                    }
                }
473032
function getStylesheet(data, isUrl, cb) {
    var el = document.createElement(isUrl ? 'link' : 'style'),
        head = document.getElementsByTagName('head')[0];

    el.type = 'text/css';

    if (isUrl) {
      el.href = data;
      el.rel = 'stylesheet';

      // Waiting for script to load
      el.onload = el.onreadystatechange = function() {
        if ((!this.readyState ||
              this.readyState == 'loaded' ||
              this.readyState == 'complete')) {
          el.onload = el.onreadystatechange = null;

          if (typeof cb === 'function')
            cb();
        }
      };
    }
    else {
      el.innerHTML = data;
    }

    // Appending the stylesheet to head
    head.appendChild(el);
  }
252335
function getUrl(file, size, media) {
      media = media || get_media;
      var version = new Date(file.updatedAt).valueOf();
      return media(file.location, size) + '?version=' + version;
    }
942968
function(media) {
      if (options.use_external) {
        media.forEach(function(item) {
          strMediaStyles += processMedia(item);
        });
      } else {
        media.forEach(function(item) {
          strStyles += processMedia(item);
        });
      }

    }
390352
private Element buildImageElement(Media media, Element element) {
    if (media.isValid()) {
      element.setAttribute("src", media.getUrl());
    }
    return element;
  }
1344716
public function setMediaId($arg) {
        if (empty($this->type)) {
            $this->setType(self::MEDIA);
        }
        $this->mediaId = $arg;
        return $this;
    }
129923
public function addCSS(string $stylesheet, $media = "screen")
    {
        $stylesheet = $this->stripSuffix($stylesheet, ".min", ".css");
        $this->CSS[$stylesheet] = array("path" => $stylesheet, "media" => $media);
        return $this;
    }
84996
def _split_js(media, domain):
    
    # Read internal property without creating new Media instance.
    if not media._js:
        return ImmutableMedia.empty_instance

    needs_local = domain == 'local'
    new_js = []
    for url in media._js:
        if needs_local == _is_local(url):
            new_js.append(url)

    if not new_js:
        return ImmutableMedia.empty_instance
    else:
        return Media(js=new_js)
790521
function ( arg ) {
		var obj = document.createDocumentFragment();

		if ( arg ) {
			array.each( array.cast( element.create( "div", {innerHTML: arg}, obj ).childNodes ), function ( i ) {
				obj.appendChild( i );
			});

			obj.removeChild( obj.childNodes[0] );
		}

		return obj;
	}
255077
function(file) {
    var link = document.createElement("link")
    link.href = file
    link.type = "text/css"
    link.rel = "stylesheet"
    link.media = "screen,print"
    document.getElementsByTagName("head")[0].appendChild(link)
  }
1106414
public function appendStylesheet($href, $media = null, array $attributes = [], $priority = false)
    {
        static $counter = 0;
        
        $attributes['rel'] = 'stylesheet';
        $attributes['href'] = $href;
        //$attributes['type'] = 'text/css';
        $media && $attributes['media'] = $media;
        $this->links[$priority == 'high' ? $counter + 1000 : $counter] = Html::buildHtmlElement('link', $attributes);
        $counter++;
        return $this;
    }
1198802
protected function initMediaResource(&$arg)
    {
        if (is_string($arg)) {
            $mr = new MediaResource();
            $mr->setUrl($arg);
        } else {
            $mr = $arg;
        }

        $mr->setHttpClient($this->httpClient);
        $mr->setStore($this->storage);
        return $mr;
    }