PageRenderTime 56ms CodeModel.GetById 31ms RepoModel.GetById 1ms app.codeStats 0ms

/PHPExcel_1.7.8-with_documentation-msoffice_format/PHPExcel_1.7.8-with_documentation-msoffice_format/Classes/PHPExcel/Cell/Hyperlink.php

https://bitbucket.org/izubizarreta/https-bitbucket.org-bityvip
PHP | 127 lines | 35 code | 10 blank | 82 comment | 0 complexity | 245a9cdde9e58ad5819aee82d5fce3ce MD5 | raw file
Possible License(s): LGPL-3.0, LGPL-2.0, JSON, GPL-2.0, BSD-3-Clause, LGPL-2.1, MIT
  1. <?php
  2. /**
  3. * PHPExcel
  4. *
  5. * Copyright (c) 2006 - 2012 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 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
  24. * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
  25. * @version 1.7.8, 2012-10-12
  26. */
  27. /**
  28. * PHPExcel_Cell_Hyperlink
  29. *
  30. * @category PHPExcel
  31. * @package PHPExcel_Cell
  32. * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
  33. */
  34. class PHPExcel_Cell_Hyperlink
  35. {
  36. /**
  37. * URL to link the cell to
  38. *
  39. * @var string
  40. */
  41. private $_url;
  42. /**
  43. * Tooltip to display on the hyperlink
  44. *
  45. * @var string
  46. */
  47. private $_tooltip;
  48. /**
  49. * Create a new PHPExcel_Cell_Hyperlink
  50. *
  51. * @param string $pUrl Url to link the cell to
  52. * @param string $pTooltip Tooltip to display on the hyperlink
  53. * @throws Exception
  54. */
  55. public function __construct($pUrl = '', $pTooltip = '')
  56. {
  57. // Initialise member variables
  58. $this->_url = $pUrl;
  59. $this->_tooltip = $pTooltip;
  60. }
  61. /**
  62. * Get URL
  63. *
  64. * @return string
  65. */
  66. public function getUrl() {
  67. return $this->_url;
  68. }
  69. /**
  70. * Set URL
  71. *
  72. * @param string $value
  73. * @return PHPExcel_Cell_Hyperlink
  74. */
  75. public function setUrl($value = '') {
  76. $this->_url = $value;
  77. return $this;
  78. }
  79. /**
  80. * Get tooltip
  81. *
  82. * @return string
  83. */
  84. public function getTooltip() {
  85. return $this->_tooltip;
  86. }
  87. /**
  88. * Set tooltip
  89. *
  90. * @param string $value
  91. * @return PHPExcel_Cell_Hyperlink
  92. */
  93. public function setTooltip($value = '') {
  94. $this->_tooltip = $value;
  95. return $this;
  96. }
  97. /**
  98. * Is this hyperlink internal? (to another sheet)
  99. *
  100. * @return boolean
  101. */
  102. public function isInternal() {
  103. return strpos($this->_url, 'sheet://') !== false;
  104. }
  105. /**
  106. * Get hash code
  107. *
  108. * @return string Hash code
  109. */
  110. public function getHashCode() {
  111. return md5(
  112. $this->_url
  113. . $this->_tooltip
  114. . __CLASS__
  115. );
  116. }
  117. }