PageRenderTime 32ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 1ms

/plugins/system/legacy/html.php

https://gitlab.com/endomorphosis/greenrenaissancejoomla
PHP | 346 lines | 198 code | 32 blank | 116 comment | 34 complexity | 0705d9adc7195346bff36311cddc2373 MD5 | raw file
  1. <?php
  2. /**
  3. * @version $Id: html.php 9764 2007-12-30 07:48:11Z ircmaxell $
  4. * @package Joomla.Legacy
  5. * @subpackage 1.5
  6. * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
  7. * @license GNU/GPL, see LICENSE.php
  8. * Joomla! is free software. This version may have been modified pursuant
  9. * to the GNU General Public License, and as distributed it includes or
  10. * is derivative of works licensed under the GNU General Public License or
  11. * other free or open source software licenses.
  12. * See COPYRIGHT.php for copyright notices and details.
  13. */
  14. // Check to ensure this file is within the rest of the framework
  15. defined('JPATH_BASE') or die();
  16. /**
  17. * Legacy class, use {@link JHTML} instead
  18. *
  19. * @deprecated As of version 1.5
  20. * @package Joomla.Legacy
  21. * @subpackage 1.5
  22. */
  23. class mosHTML
  24. {
  25. /**
  26. * Legacy function, use {@link JHTML::_('select.option')} instead
  27. *
  28. * @deprecated As of version 1.5
  29. */
  30. function makeOption( $value, $text='', $value_name='value', $text_name='text' )
  31. {
  32. return JHTML::_('select.option', $value, $text, $value_name, $text_name);
  33. }
  34. /**
  35. * Legacy function, use {@link JHTML::_('select.genericlist')} instead
  36. *
  37. * @deprecated As of version 1.5
  38. */
  39. function selectList( &$arr, $tag_name, $tag_attribs, $key, $text, $selected=NULL, $idtag=false, $flag=false )
  40. {
  41. return JHTML::_('select.genericlist', $arr, $tag_name, $tag_attribs, $key, $text, $selected, $idtag, $flag );
  42. }
  43. /**
  44. * Legacy function, use {@link JHTML::_('select.integerlist')} instead
  45. *
  46. * @deprecated As of version 1.5
  47. */
  48. function integerSelectList( $start, $end, $inc, $tag_name, $tag_attribs, $selected, $format="" )
  49. {
  50. return JHTML::_('select.integerlist', $start, $end, $inc, $tag_name, $tag_attribs, $selected, $format) ;
  51. }
  52. /**
  53. * Legacy function, use {@link JHTML::_('select.radiolist')} instead
  54. *
  55. * @deprecated As of version 1.5
  56. */
  57. function radioList( &$arr, $tag_name, $tag_attribs, $selected=null, $key='value', $text='text', $idtag=false )
  58. {
  59. return JHTML::_('select.radiolist', $arr, $tag_name, $tag_attribs, $key, $text, $selected, $idtag) ;
  60. }
  61. /**
  62. * Legacy function, use {@link JHTML::_('select.booleanlist')} instead
  63. *
  64. * @deprecated As of version 1.5
  65. */
  66. function yesnoRadioList( $tag_name, $tag_attribs, $selected, $yes='yes', $no='no', $id=false )
  67. {
  68. return JHTML::_('select.booleanlist', $tag_name, $tag_attribs, $selected, $yes, $no, $id ) ;
  69. }
  70. /**
  71. * Legacy function, deprecated
  72. *
  73. * @deprecated As of version 1.5
  74. */
  75. function writableCell( $folder, $relative=1, $text='', $visible=1 )
  76. {
  77. $writeable = '<b><font color="green">'. JText::_( 'Writable' ) .'</font></b>';
  78. $unwriteable = '<b><font color="red">'. JText::_( 'Unwritable' ) .'</font></b>';
  79. echo '<tr>';
  80. echo '<td class="item">';
  81. echo $text;
  82. if ( $visible ) {
  83. echo $folder . '/';
  84. }
  85. echo '</td>';
  86. echo '<td >';
  87. if ( $relative ) {
  88. echo is_writable( "../$folder" ) ? $writeable : $unwriteable;
  89. } else {
  90. echo is_writable( "$folder" ) ? $writeable : $unwriteable;
  91. }
  92. echo '</td>';
  93. echo '</tr>';
  94. }
  95. /**
  96. * Legacy function, deprecated
  97. *
  98. * @deprecated As of version 1.5
  99. */
  100. function monthSelectList( $tag_name, $tag_attribs, $selected )
  101. {
  102. $arr = array(
  103. mosHTML::makeOption( '01', JText::_( 'JANUARY_SHORT' ) ),
  104. mosHTML::makeOption( '02', JText::_( 'FEBRUARY_SHORT' ) ),
  105. mosHTML::makeOption( '03', JText::_( 'MARCH_SHORT' ) ),
  106. mosHTML::makeOption( '04', JText::_( 'APRIL_SHORT' ) ),
  107. mosHTML::makeOption( '05', JText::_( 'MAY_SHORT' ) ),
  108. mosHTML::makeOption( '06', JText::_( 'JUNE_SHORT' ) ),
  109. mosHTML::makeOption( '07', JText::_( 'JULY_SHORT' ) ),
  110. mosHTML::makeOption( '08', JText::_( 'AUGUST_SHORT' ) ),
  111. mosHTML::makeOption( '09', JText::_( 'SEPTEMBER_SHORT' ) ),
  112. mosHTML::makeOption( '10', JText::_( 'OCTOBER_SHORT' ) ),
  113. mosHTML::makeOption( '11', JText::_( 'NOVEMBER_SHORT' ) ),
  114. mosHTML::makeOption( '12', JText::_( 'DECEMBER_SHORT' ) )
  115. );
  116. return mosHTML::selectList( $arr, $tag_name, $tag_attribs, 'value', 'text', $selected );
  117. }
  118. /**
  119. * Legacy function, deprecated
  120. *
  121. * @deprecated As of version 1.5
  122. */
  123. function treeSelectList( &$src_list, $src_id, $tgt_list, $tag_name, $tag_attribs, $key, $text, $selected )
  124. {
  125. // establish the hierarchy of the menu
  126. $children = array();
  127. // first pass - collect children
  128. foreach ($src_list as $v ) {
  129. $pt = $v->parent;
  130. $list = @$children[$pt] ? $children[$pt] : array();
  131. array_push( $list, $v );
  132. $children[$pt] = $list;
  133. }
  134. // second pass - get an indent list of the items
  135. $ilist = JHTML::_('menu.treerecurse', 0, '', array(), $children );
  136. // assemble menu items to the array
  137. $this_treename = '';
  138. foreach ($ilist as $item) {
  139. if ($this_treename) {
  140. if ($item->id != $src_id && strpos( $item->treename, $this_treename ) === false) {
  141. $tgt_list[] = mosHTML::makeOption( $item->id, $item->treename );
  142. }
  143. } else {
  144. if ($item->id != $src_id) {
  145. $tgt_list[] = mosHTML::makeOption( $item->id, $item->treename );
  146. } else {
  147. $this_treename = "$item->treename/";
  148. }
  149. }
  150. }
  151. // build the html select list
  152. return mosHTML::selectList( $tgt_list, $tag_name, $tag_attribs, $key, $text, $selected );
  153. }
  154. /**
  155. * Legacy function, deprecated
  156. *
  157. * @deprecated As of version 1.5
  158. */
  159. function yesnoSelectList( $tag_name, $tag_attribs, $selected, $yes='yes', $no='no' )
  160. {
  161. $arr = array(
  162. mosHTML::makeOption( 0, JText::_( $no ) ),
  163. mosHTML::makeOption( 1, JText::_( $yes ) ),
  164. );
  165. return mosHTML::selectList( $arr, $tag_name, $tag_attribs, 'value', 'text', (int) $selected );
  166. }
  167. /**
  168. * Legacy function, use {@link JHTML::_('grid.id')} instead
  169. *
  170. * @deprecated As of version 1.5
  171. */
  172. function idBox( $rowNum, $recId, $checkedOut=false, $name='cid' )
  173. {
  174. return JHTML::_('grid.id', $rowNum, $recId, $checkedOut, $name);
  175. }
  176. /**
  177. * Legacy function, deprecated
  178. *
  179. * @deprecated As of version 1.5
  180. */
  181. function sortIcon( $text, $base_href, $field, $state='none' )
  182. {
  183. $alts = array(
  184. 'none' => JText::_( 'No Sorting' ),
  185. 'asc' => JText::_( 'Sort Ascending' ),
  186. 'desc' => JText::_( 'Sort Descending' ),
  187. );
  188. $next_state = 'asc';
  189. if ($state == 'asc') {
  190. $next_state = 'desc';
  191. } else if ($state == 'desc') {
  192. $next_state = 'none';
  193. }
  194. if ($state == 'none') {
  195. $img = '';
  196. } else {
  197. $img = "<img src=\"images/sort_$state.png\" width=\"12\" height=\"12\" border=\"0\" alt=\"{$alts[$next_state]}\" />";
  198. }
  199. $html = "<a href=\"$base_href&field=$field&order=$next_state\">"
  200. . JText::_( $text )
  201. . '&nbsp;&nbsp;'
  202. . $img
  203. . "</a>";
  204. return $html;
  205. }
  206. /**
  207. * Legacy function, deprecated
  208. *
  209. * @deprecated As of version 1.5
  210. */
  211. function CloseButton ( &$params, $hide_js=NULL )
  212. {
  213. // displays close button in Pop-up window
  214. if ( $params->get( 'popup' ) && !$hide_js ) {
  215. ?>
  216. <div align="center" style="margin-top: 30px; margin-bottom: 30px;">
  217. <script type="text/javascript">
  218. document.write('<a href="#" onclick="javascript:window.close();"><span class="small"><?php echo JText::_( 'Close Window' );?></span></a>');
  219. </script>
  220. <?php
  221. if ( $_SERVER['HTTP_REFERER'] != "") {
  222. echo '<noscript>';
  223. echo '<a href="'. $_SERVER['HTTP_REFERER'] .'"><span class="small">'. JText::_( 'BACK' ) .'</span></a>';
  224. echo '</noscript>';
  225. }
  226. ?>
  227. </div>
  228. <?php
  229. }
  230. }
  231. /**
  232. * Legacy function, deprecated
  233. *
  234. * @deprecated As of version 1.5
  235. */
  236. function BackButton ( &$params, $hide_js=NULL )
  237. {
  238. // Back Button
  239. if ( $params->get( 'back_button' ) && !$params->get( 'popup' ) && !$hide_js) {
  240. ?>
  241. <div class="back_button">
  242. <a href='javascript:history.go(-1)'>
  243. <?php echo JText::_( 'BACK' ); ?></a>
  244. </div>
  245. <?php
  246. }
  247. }
  248. /**
  249. * Legacy function, use {@link JFilterOutput::cleanText()} instead
  250. *
  251. * @deprecated As of version 1.5
  252. */
  253. function cleanText ( &$text ) {
  254. return JFilterOutput::cleanText($text);
  255. }
  256. /**
  257. * Legacy function, deprecated
  258. *
  259. * @deprecated As of version 1.5
  260. */
  261. function PrintIcon( &$row, &$params, $hide_js, $link, $status=NULL )
  262. {
  263. if ( $params->get( 'print' ) && !$hide_js ) {
  264. // use default settings if none declared
  265. if ( !$status ) {
  266. $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no';
  267. }
  268. // checks template image directory for image, if non found default are loaded
  269. if ( $params->get( 'icons' ) ) {
  270. $image = mosAdminMenus::ImageCheck( 'printButton.png', '/images/M_images/', NULL, NULL, JText::_( 'Print' ), JText::_( 'Print' ) );
  271. } else {
  272. $image = JText::_( 'ICON_SEP' ) .'&nbsp;'. JText::_( 'Print' ) .'&nbsp;'. JText::_( 'ICON_SEP' );
  273. }
  274. if ( $params->get( 'popup' ) && !$hide_js ) {
  275. // Print Preview button - used when viewing page
  276. ?>
  277. <script type="text/javascript">
  278. document.write('<td align="right" width="100%" class="buttonheading">');
  279. document.write('<a href="#" onclick="javascript:window.print(); return false" title="<?php echo JText::_( 'Print' );?>">');
  280. document.write('<?php echo $image;?>');
  281. document.write('</a>');
  282. document.write('</td>');
  283. </script>
  284. <?php
  285. } else {
  286. // Print Button - used in pop-up window
  287. ?>
  288. <td align="right" width="100%" class="buttonheading">
  289. <a href="<?php echo $link; ?>" onclick="window.open('<?php echo $link; ?>','win2','<?php echo $status; ?>'); return false;" title="<?php echo JText::_( 'Print' );?>">
  290. <?php echo $image;?></a>
  291. </td>
  292. <?php
  293. }
  294. }
  295. }
  296. /**
  297. * Legacy function, use {@link JHTML::_('email.cloak')} instead
  298. *
  299. * @deprecated As of version 1.5
  300. */
  301. function emailCloaking( $mail, $mailto=1, $text='', $email=1 )
  302. {
  303. return JHTML::_('email.cloak', $mail, $mailto, $text, $email);
  304. }
  305. /**
  306. * Legacy function, use {@link JHTML::_('behavior.keepalive')} instead
  307. *
  308. * @deprecated As of version 1.5
  309. */
  310. function keepAlive()
  311. {
  312. echo JHTML::_('behavior.keepalive');
  313. }
  314. }