PageRenderTime 54ms CodeModel.GetById 29ms RepoModel.GetById 1ms app.codeStats 0ms

/html/includes/EcomGlobal.php

https://bitbucket.org/kuy/ecom
PHP | 257 lines | 162 code | 86 blank | 9 comment | 24 complexity | b59a2948a655b1fdc40373c5e2a0be26 MD5 | raw file
Possible License(s): GPL-3.0, LGPL-2.1, GPL-2.0
  1. <?php
  2. /* Copyright (c) 2009 National Research Institute for Earth Science and
  3. * Disaster Prevention (NIED).
  4. * This code is licensed under the GPL 3.0 license, availible at the root
  5. * application directory.
  6. */
  7. ?>
  8. <?php
  9. /**
  10. * 既存のグローバル変数の操作メソッド.
  11. * @author ikeda
  12. */
  13. class EcomGlobal {
  14. public static function addJqueryReady( $file ) {
  15. global $JQUERY;
  16. if ( false === array_search( $file, $JQUERY["ready"] ) ) {
  17. $JQUERY["ready"][] = $file;
  18. }
  19. }
  20. public static function removeJQueryReady( $file ) {
  21. global $JQUERY;
  22. $index = array_search( $file, $JQUERY["ready"] );
  23. if ( false !== $index ) {
  24. $JQUERY["ready"][$index] = null;
  25. }
  26. }
  27. public static function addHeadJs( $file ) {
  28. global $COMUNI_HEAD_JS;
  29. if ( false === array_search( $file, $COMUNI_HEAD_JS ) ) {
  30. $COMUNI_HEAD_JS[] = $file;
  31. }
  32. }
  33. public static function removeHeadJs( $file ) {
  34. global $COMUNI_HEAD_JS;
  35. $index = array_search( $file, $COMUNI_HEAD_JS );
  36. if ( false !== $index ) {
  37. $COMUNI_HEAD_JS[$index] = null;
  38. }
  39. }
  40. public static function addFootJs( $file ) {
  41. global $COMUNI_FOOT_JS;
  42. if ( false === array_search( $file, $COMUNI_FOOT_JS ) ) {
  43. $COMUNI_FOOT_JS[] = $file;
  44. }
  45. }
  46. public static function removeFootJs( $file ) {
  47. global $COMUNI_FOOT_JS;
  48. $index = array_search( $file, $COMUNI_FOOT_JS );
  49. if ( false !== $index ) {
  50. $COMUNI_FOOT_JS[$index] = null;
  51. }
  52. }
  53. public static function addHeadJsRaw( $code ) {
  54. global $COMUNI_HEAD_JSRAW;
  55. if ( false === array_search( $code, $COMUNI_HEAD_JSRAW ) ) {
  56. $COMUNI_HEAD_JSRAW[] = $code;
  57. }
  58. }
  59. public static function removeHeadJsRaw( $code ) {
  60. global $COMUNI_HEAD_JSRAW;
  61. $index = array_search( $code, $COMUNI_HEAD_JSRAW );
  62. if ( false !== $index ) {
  63. $COMUNI_HEAD_JSRAW[$index] = null;
  64. }
  65. }
  66. public static function addFootJsRaw( $code ) {
  67. global $COMUNI_FOOT_JSRAW;
  68. if ( false === array_search( $code, $COMUNI_FOOT_JSRAW ) ) {
  69. $COMUNI_FOOT_JSRAW[] = $code;
  70. }
  71. }
  72. public static function removeFootJsRaw( $code ) {
  73. global $COMUNI_FOOT_JSRAW;
  74. $index = array_search( $code, $COMUNI_FOOT_JSRAW );
  75. if ( false !== $index ) {
  76. $COMUNI_FOOT_JSRAW[$index] = null;
  77. }
  78. }
  79. public static function addHeadCss( $file ) {
  80. global $COMUNI_HEAD_CSS;
  81. if ( false === array_search( $file, $COMUNI_HEAD_CSS ) ) {
  82. $COMUNI_HEAD_CSS[] = $file;
  83. }
  84. }
  85. public static function removeHeadCss( $file ) {
  86. global $COMUNI_HEAD_CSS;
  87. $index = array_search( $file, $COMUNI_HEAD_CSS );
  88. if ( false !== $index ) {
  89. $COMUNI_HEAD_CSS[$index] = null;
  90. }
  91. }
  92. public static function addFootCss( $file ) {
  93. global $COMUNI_FOOT_CSS;
  94. if ( false === array_search( $file, $COMUNI_FOOT_CSS ) ) {
  95. $COMUNI_FOOT_CSS[] = $file;
  96. }
  97. }
  98. public static function removeFootCss( $file ) {
  99. global $COMUNI_FOOT_CSS;
  100. $index = array_search( $file, $COMUNI_FOOT_CSS );
  101. if ( false !== $index ) {
  102. $COMUNI_FOOT_CSS[$index] = null;
  103. }
  104. }
  105. public static function addHeadCssRaw( $code ) {
  106. global $COMUNI_HEAD_CSSRAW;
  107. if ( false === array_search( $code, $COMUNI_HEAD_CSSRAW ) ) {
  108. $COMUNI_HEAD_CSSRAW[] = $code;
  109. }
  110. }
  111. public static function removeHeadCssRaw( $code ) {
  112. global $COMUNI_HEAD_CSSRAW;
  113. $index = array_search( $code, $COMUNI_HEAD_CSSRAW );
  114. if ( false !== $index ) {
  115. $COMUNI_HEAD_CSSRAW[$index] = null;
  116. }
  117. }
  118. public static function addFootCssRaw( $code ) {
  119. global $COMUNI_FOOT_CSSRAW;
  120. if ( false === array_search( $code, $COMUNI_FOOT_CSSRAW ) ) {
  121. $COMUNI_FOOT_CSSRAW[] = $code;
  122. }
  123. }
  124. public static function removeFootCssRaw( $code ) {
  125. global $COMUNI_FOOT_CSSRAW;
  126. $index = array_search( $code, $COMUNI_FOOT_CSSRAW );
  127. if ( false !== $index ) {
  128. $COMUNI_FOOT_CSSRAW[$index] = null;
  129. }
  130. }
  131. public static function addHeadHtml( $file ) {
  132. global $COMUNI_HEAD_HTML;
  133. if ( false === array_search( $file, $COMUNI_HEAD_HTML ) ) {
  134. $COMUNI_HEAD_HTML[] = $file;
  135. }
  136. }
  137. public static function removeHeadHtml( $file ) {
  138. global $COMUNI_HEAD_HTML;
  139. $index = array_search( $file, $COMUNI_HEAD_HTML );
  140. if ( false !== $index ) {
  141. $COMUNI_HEAD_HTML[$index] = null;
  142. }
  143. }
  144. public static function addFootHtml( $file ) {
  145. global $COMUNI_FOOT_HTML;
  146. if ( false === array_search( $file, $COMUNI_FOOT_HTML ) ) {
  147. $COMUNI_FOOT_HTML[] = $file;
  148. }
  149. }
  150. public static function removeFootHtml( $file ) {
  151. global $COMUNI_FOOT_HTML;
  152. $index = array_search( $file, $COMUNI_FOOT_HTML );
  153. if ( false !== $index ) {
  154. $COMUNI_FOOT_HTML[$index] = null;
  155. }
  156. }
  157. public static function addTPath( $path ) {
  158. global $COMUNI_TPATH;
  159. if ( false === array_search( $path, $COMUNI_TPATH ) ) {
  160. $COMUNI_TPATH[] = $path;
  161. }
  162. }
  163. public static function removeTPath( $path ) {
  164. global $COMUNI_TPATH;
  165. $index = array_search( $path, $COMUNI_TPATH );
  166. if ( false !== $index ) {
  167. $COMUNI_TPATH[$index] = null;
  168. }
  169. }
  170. }
  171. ?>