PageRenderTime 47ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/application/maxsite/plugins/randomtext/index.php

https://code.google.com/p/maxsite/
PHP | 148 lines | 103 code | 27 blank | 18 comment | 11 complexity | 99b776bf1cf1267af70972904fc19dca MD5 | raw file
  1. <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
  2. /**
  3. * MaxSite CMS
  4. * (c) http://max-3000.com/
  5. */
  6. # ??????? ??????????????? ???????
  7. function randomtext_autoload($args = array())
  8. {
  9. # ???????????? ??????
  10. mso_register_widget('randomtext_widget', t('??????', 'plugins'));
  11. }
  12. function randomtext_uninstall($args = array())
  13. {
  14. mso_delete_option_mask('randomtext_widget_', 'plugins'); // ?????? ????????? ?????
  15. return $args;
  16. }
  17. # ??????? ???????
  18. function randomtext_widget($num = 1)
  19. {
  20. $widget = 'randomtext_widget_' . $num; // ??? ??? ????? = ?????? + ?????
  21. $options = mso_get_option($widget, 'plugins', array() ); // ???????? ?????
  22. // ??????? ?????????, ????? ??? ? h2 class="box"
  23. if ( isset($options['header']) and $options['header'] )
  24. $options['header'] = mso_get_val('widget_header_start', '<h2 class="box"><span>') . $options['header'] . mso_get_val('widget_header_end', '</span></h2>');
  25. else $options['header'] = '';
  26. return randomtext_widget_custom($options, $num);
  27. }
  28. # ??????? ?????? ????? ????????? ???????
  29. function randomtext_widget_form($num = 1)
  30. {
  31. $widget = 'randomtext_widget_' . $num; // ??? ??? ????? ? ????? = ?????? + ?????
  32. // ???????? ?????
  33. $options = mso_get_option($widget, 'plugins', array());
  34. if ( !isset($options['header']) ) $options['header'] = '';
  35. // ????? ????? ?????
  36. $CI = & get_instance();
  37. $CI->load->helper('form');
  38. $form = '<p><div class="t150">' . t('?????????:', 'plugins') . '</div> '.
  39. form_input( array( 'name'=>$widget . 'header', 'value'=>$options['header'] ) ) ;
  40. return $form;
  41. }
  42. # ???? ???????? POST ?? ????? ????????? ???????
  43. # ??? ??????? = ??????_update
  44. function randomtext_widget_update($num = 1)
  45. {
  46. $widget = 'randomtext_widget_' . $num; // ??? ??? ????? = ?????? + ?????
  47. // ???????? ?????
  48. $options = $newoptions = mso_get_option($widget, 'plugins', array());
  49. # ???????????? POST
  50. $newoptions['header'] = mso_widget_get_post($widget . 'header');
  51. if ( $options != $newoptions )
  52. mso_add_option($widget, $newoptions, 'plugins');
  53. }
  54. # ???????? ???????
  55. function randomtext_widget_custom($arg = array(), $num = 1)
  56. {
  57. if ( !isset($arg['header'])) $arg['header'] = mso_get_val('widget_header_start', '<h2 class="box"><span>') . t('??????', 'plugins') .mso_get_val('widget_header_end', '</span></h2>') ;
  58. if ( !isset($arg['block_start']) ) $arg['block_start'] = '<div class="random-text">';
  59. if ( !isset($arg['block_end']) ) $arg['block_end'] = '</div>';
  60. $text = '';
  61. # ???? ???? ???? randomtext, ?? ????? ????? ?? ???
  62. if (function_exists('ushka'))
  63. {
  64. $text = ushka('randomtext', "\n");
  65. }
  66. if (!$text)
  67. {
  68. $text =
  69. '????????? ?????????? ??????, ?? ??? ??????? ????, ? ?? ????. /?. ????????/
  70. ?????? — ??? ?????????? ???????? ????? ????????. /?. ?????/
  71. ????? ? ???? ???? ??????, ??? ?????. /??????/
  72. ??????? ???? ???? ?????, ? ???? ???????. /?. ???????/
  73. ????????????? — ???? ??? ?????. /?. ???????/
  74. ??????? ?? ???? ?????, ?? ????? ????????. /????????/
  75. ??? ?? ?????, ??? ????? ???, ?? ?????, ??? ?? ???… /???? ???????/
  76. ??? ?????? — ?????? ????????. /?. ?????/
  77. ???????? ???? ??????? ????????. /?. ???????/
  78. ?? ???? ?????? ????????? ???????? ??????? ??????????. /?. ???????/
  79. ???????? ????? ???????, ???? ?????????? ????? ?????????. /????????/
  80. ?? ?????? ? ??????? ? ??????. /?. ?????????/
  81. ???????? — ??????????? ???????. /?. ?????/
  82. ??????? ?????? ??? ??? ??????, ??? ?? ??? ??? ???????. /??????/
  83. ???????????????? ??????, ? ????????? ???????????. /?. ????/
  84. ????? ???????? ????, ???? ??????? ????? ????, ? ?? ?????? ?????? ? ????? ????????. /?????? ????????? ????/
  85. ?????????? ????????? ???????? ????? ?? ???? ????. /?????? ??????/
  86. ??????? ?????????? — ?????????? ??????? ? ????. /?. ????????/
  87. ???????? ?? ??? ?? ??????, ??????? ????? — ??????????? ?????? ????. /?????/
  88. ????? — ?????????? ??????? ????????. /?. ???????/
  89. ???? ????? ???? ??? ?????. /?. ?????/
  90. ????????, ????? ?????????. /????????/
  91. ??? — ????? ???? ? ???????? ????. (??? — ????? ???? ? ????? ?????) /???????/
  92. ??????? — ??? ??????? ??? ?????????. /?. ??????/
  93. ???? — ??? ????? ????. /?. ???????/
  94. ???????? — ??? ??, ?????????? ?? ???????. /?????? ????????/
  95. ??? ???? ? ???? ? ?????. /????????/
  96. ????? — ???? ????. /????????/
  97. ?????? ????? ???????????. /?????/
  98. ???????? ?? ??????? ???????? ??? ?????????????. /?????/
  99. ????? ??????? ?????? ?????? ????. /?. ??????????/
  100. ?????????? ??????? ???????????? ?? ??????????. /?. ?????????/
  101. ?? ???? ?????? ?? ?????? ??? ???????, ??? ?????????. /?. ?????????/
  102. ??????? — ??? ????????????. /??????/
  103. ????? ?????? ?? ????, ? ????????????? ? ???. /???????/
  104. ???? ?????? ???? ????????, ??????? ? ??????. /?. ???????/
  105. ?????????? ???? ? ???????? ????????????????? ?? ?????????. /?????/
  106. ??? ????? — ??????, ??? ?? ????? — ??????. /?. ?. ????????/
  107. ??????? ??????? ???????. ??? ?????? ?????? ???, ??? ?????? ??? ??????????. ?? ???? ?? ?????????? ???? ???????? ?? ?????? ????, ??? ?????? ? ???????? ????? ??? ?? ?????. /?.?????? (???????????? ?????????????)/
  108. ??????????? ?? ??? — ??? ?? ??. ???? ????? — ??? ????? ????????; ???? ????? — ????????; ???? ??????? — ??????. /????? ??????/
  109. ??? ???? Ť????ť ??? ?????? ????: ??? ?? ????, ??? — ? ??? ??????, ?????? ??????????… ?? ???? ?????? ??? ????? ???????? ????? ? ??????? ??? ??????? ? ???, ????? ?? ????? ????? ???????. /???? ????/
  110. ???????, ??-?????????? ????????, ??????? ?? ????? ?????? ?? ?????? ????????, ??? ?? ????? ???????. /???? ????/
  111. ??????? ???? ??? ???? — ?? ??????????, ??? ?? ??? ????? ? ???? ????. /?????? ???????/
  112. ????????? ???? ?????? ??????? ? ?????? ?????, ?? ??? ?? ??????? ???????? ????????. /?????? ??????/
  113. ??? ????? ??????? ??????????, ??? ????? ??? ????????. /??????? ?????/
  114. ????? ??? ???????? ?????, ?? ?????? ??? ??????????. /?????????? ?????????/
  115. ??? ???????????? ??????? ???? ?? ???????. ? ??????? ???. ?? ?????? ??? ??? ???????, ????? ????? ?? ???????? ????. /???? ?????/';
  116. }
  117. $text = explode("\n", $text);
  118. $out = trim($text[ mt_rand(0, count($text) - 1) ] );
  119. return $arg['header'] . $arg['block_start'] . $out . $arg['block_end'];
  120. }
  121. # end file