[1] | 1 | <?php |
---|
| 2 | /** |
---|
| 3 | * PHPExcel |
---|
| 4 | * |
---|
| 5 | * Copyright (c) 2006 - 2014 PHPExcel |
---|
| 6 | * |
---|
| 7 | * This library is free software; you can redistribute it and/or |
---|
| 8 | * modify it under the terms of the GNU Lesser General Public |
---|
| 9 | * License as published by the Free Software Foundation; either |
---|
| 10 | * version 2.1 of the License, or (at your option) any later version. |
---|
| 11 | * |
---|
| 12 | * This library is distributed in the hope that it will be useful, |
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 15 | * Lesser General Public License for more details. |
---|
| 16 | * |
---|
| 17 | * You should have received a copy of the GNU Lesser General Public |
---|
| 18 | * License along with this library; if not, write to the Free Software |
---|
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
---|
| 20 | * |
---|
| 21 | * @category PHPExcel |
---|
| 22 | * @package PHPExcel_Cell |
---|
| 23 | * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) |
---|
| 24 | * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
---|
| 25 | * @version 1.8.0, 2014-03-02 |
---|
| 26 | */ |
---|
| 27 | |
---|
| 28 | |
---|
| 29 | /** |
---|
| 30 | * PHPExcel_Cell_Hyperlink |
---|
| 31 | * |
---|
| 32 | * @category PHPExcel |
---|
| 33 | * @package PHPExcel_Cell |
---|
| 34 | * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) |
---|
| 35 | */ |
---|
| 36 | class PHPExcel_Cell_Hyperlink |
---|
| 37 | { |
---|
| 38 | /** |
---|
| 39 | * URL to link the cell to |
---|
| 40 | * |
---|
| 41 | * @var string |
---|
| 42 | */ |
---|
| 43 | private $_url; |
---|
| 44 | |
---|
| 45 | /** |
---|
| 46 | * Tooltip to display on the hyperlink |
---|
| 47 | * |
---|
| 48 | * @var string |
---|
| 49 | */ |
---|
| 50 | private $_tooltip; |
---|
| 51 | |
---|
| 52 | /** |
---|
| 53 | * Create a new PHPExcel_Cell_Hyperlink |
---|
| 54 | * |
---|
| 55 | * @param string $pUrl Url to link the cell to |
---|
| 56 | * @param string $pTooltip Tooltip to display on the hyperlink |
---|
| 57 | */ |
---|
| 58 | public function __construct($pUrl = '', $pTooltip = '') |
---|
| 59 | { |
---|
| 60 | // Initialise member variables |
---|
| 61 | $this->_url = $pUrl; |
---|
| 62 | $this->_tooltip = $pTooltip; |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | /** |
---|
| 66 | * Get URL |
---|
| 67 | * |
---|
| 68 | * @return string |
---|
| 69 | */ |
---|
| 70 | public function getUrl() { |
---|
| 71 | return $this->_url; |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | /** |
---|
| 75 | * Set URL |
---|
| 76 | * |
---|
| 77 | * @param string $value |
---|
| 78 | * @return PHPExcel_Cell_Hyperlink |
---|
| 79 | */ |
---|
| 80 | public function setUrl($value = '') { |
---|
| 81 | $this->_url = $value; |
---|
| 82 | return $this; |
---|
| 83 | } |
---|
| 84 | |
---|
| 85 | /** |
---|
| 86 | * Get tooltip |
---|
| 87 | * |
---|
| 88 | * @return string |
---|
| 89 | */ |
---|
| 90 | public function getTooltip() { |
---|
| 91 | return $this->_tooltip; |
---|
| 92 | } |
---|
| 93 | |
---|
| 94 | /** |
---|
| 95 | * Set tooltip |
---|
| 96 | * |
---|
| 97 | * @param string $value |
---|
| 98 | * @return PHPExcel_Cell_Hyperlink |
---|
| 99 | */ |
---|
| 100 | public function setTooltip($value = '') { |
---|
| 101 | $this->_tooltip = $value; |
---|
| 102 | return $this; |
---|
| 103 | } |
---|
| 104 | |
---|
| 105 | /** |
---|
| 106 | * Is this hyperlink internal? (to another worksheet) |
---|
| 107 | * |
---|
| 108 | * @return boolean |
---|
| 109 | */ |
---|
| 110 | public function isInternal() { |
---|
| 111 | return strpos($this->_url, 'sheet://') !== false; |
---|
| 112 | } |
---|
| 113 | |
---|
| 114 | /** |
---|
| 115 | * Get hash code |
---|
| 116 | * |
---|
| 117 | * @return string Hash code |
---|
| 118 | */ |
---|
| 119 | public function getHashCode() { |
---|
| 120 | return md5( |
---|
| 121 | $this->_url |
---|
| 122 | . $this->_tooltip |
---|
| 123 | . __CLASS__ |
---|
| 124 | ); |
---|
| 125 | } |
---|
| 126 | } |
---|