Hyperlink.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. class PHPExcel_Cell_Hyperlink
  8. {
  9. /**
  10. * URL to link the cell to
  11. *
  12. * @var string
  13. */
  14. private $url;
  15. /**
  16. * Tooltip to display on the hyperlink
  17. *
  18. * @var string
  19. */
  20. private $tooltip;
  21. /**
  22. * Create a new PHPExcel_Cell_Hyperlink
  23. *
  24. * @param string $pUrl Url to link the cell to
  25. * @param string $pTooltip Tooltip to display on the hyperlink
  26. */
  27. public function __construct($pUrl = '', $pTooltip = '')
  28. {
  29. // Initialise member variables
  30. $this->url = $pUrl;
  31. $this->tooltip = $pTooltip;
  32. }
  33. /**
  34. * Get URL
  35. *
  36. * @return string
  37. */
  38. public function getUrl()
  39. {
  40. return $this->url;
  41. }
  42. /**
  43. * Set URL
  44. *
  45. * @param string $value
  46. * @return PHPExcel_Cell_Hyperlink
  47. */
  48. public function setUrl($value = '')
  49. {
  50. $this->url = $value;
  51. return $this;
  52. }
  53. /**
  54. * Get tooltip
  55. *
  56. * @return string
  57. */
  58. public function getTooltip()
  59. {
  60. return $this->tooltip;
  61. }
  62. /**
  63. * Set tooltip
  64. *
  65. * @param string $value
  66. * @return PHPExcel_Cell_Hyperlink
  67. */
  68. public function setTooltip($value = '')
  69. {
  70. $this->tooltip = $value;
  71. return $this;
  72. }
  73. /**
  74. * Is this hyperlink internal? (to another worksheet)
  75. *
  76. * @return boolean
  77. */
  78. public function isInternal()
  79. {
  80. return strpos($this->url, 'sheet://') !== false;
  81. }
  82. /**
  83. * Get hash code
  84. *
  85. * @return string Hash code
  86. */
  87. public function getHashCode()
  88. {
  89. return md5(
  90. $this->url .
  91. $this->tooltip .
  92. __CLASS__
  93. );
  94. }
  95. }