1<?php 2/** 3 * Copyright 2012-2017 Horde LLC (http://www.horde.org/) 4 * 5 * See the enclosed file COPYING for license information (LGPL). If you 6 * did not receive this file, see http://www.horde.org/licenses/lgpl21. 7 * 8 * @category Horde 9 * @copyright 2012-2017 Horde LLC 10 * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 11 * @package Core 12 */ 13 14/** 15 * This class represents an external script file to include. 16 * 17 * @author Michael Slusarz <slusarz@horde.org> 18 * @category Horde 19 * @copyright 2012-2017 Horde LLC 20 * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 21 * @package Core 22 */ 23class Horde_Script_File_External extends Horde_Script_File 24{ 25 /** 26 * External scripts are not cached. 27 */ 28 public $cache = null; 29 30 /** 31 * By default, put external scripts as very low priority so it doesn't 32 * break-up caching collections (since a non-cached script will cause 33 * separate cache files to be created). 34 */ 35 protected $_priority = self::PRIORITY_LOW; 36 37 /** 38 * External URL. 39 * 40 * @param string 41 */ 42 protected $_url; 43 44 /** 45 * Adds an external javascript script to the output. 46 * 47 * @param string $url The URL to the external script file. 48 */ 49 public function __construct($url) 50 { 51 $this->_app = 'horde'; 52 $this->_file = basename($url); 53 $this->_url = $url; 54 } 55 56 /** 57 */ 58 public function __get($name) 59 { 60 switch ($name) { 61 case 'hash': 62 return hash('md5', $this->_url); 63 64 case 'modified': 65 return 0; 66 67 case 'path': 68 return null; 69 70 case 'url': 71 case 'url_full': 72 return $this->_url; 73 } 74 75 return parent::__get($name); 76 } 77 78} 79