wg.class.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * The base widget class file of zin of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2023 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
  6. * @author Hao Sun <sunhao@easycorp.ltd>
  7. * @package zin
  8. * @version $Id
  9. * @link https://www.zentao.net
  10. */
  11. namespace zin;
  12. require_once __DIR__ . DS . 'node.class.php';
  13. class wg extends node
  14. {
  15. public static function getPageCSS()
  16. {
  17. return null; // No css
  18. }
  19. public static function getPageJS()
  20. {
  21. return null; // No js
  22. }
  23. protected static function checkPageResources()
  24. {
  25. $name = get_called_class();
  26. if(isset(static::$pageResources[$name])) return;
  27. static::$pageResources[$name] = true;
  28. $pageCSS = static::getPageCSS();
  29. $pageJS = static::getPageJS();
  30. if(!empty($pageCSS)) context::css($pageCSS);
  31. if(!empty($pageJS)) context::js($pageJS);
  32. }
  33. /**
  34. * @var mixed[]
  35. */
  36. protected static $pageResources = array();
  37. }
  38. /**
  39. * Create an new widget.
  40. *
  41. * @return wg
  42. * @param mixed ...$args
  43. */
  44. function wg(...$args)
  45. {
  46. return new wg(...$args);
  47. }