/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
- <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
- /**
- * MaxSite CMS
- * (c) http://max-3000.com/
- */
-
-
- # ??????? ??????????????? ???????
- function randomtext_autoload($args = array())
- {
- # ???????????? ??????
- mso_register_widget('randomtext_widget', t('??????', 'plugins'));
- }
- function randomtext_uninstall($args = array())
- {
- mso_delete_option_mask('randomtext_widget_', 'plugins'); // ?????? ????????? ?????
- return $args;
- }
- # ??????? ???????
- function randomtext_widget($num = 1)
- {
- $widget = 'randomtext_widget_' . $num; // ??? ??? ????? = ?????? + ?????
- $options = mso_get_option($widget, 'plugins', array() ); // ???????? ?????
-
- // ??????? ?????????, ????? ??? ? h2 class="box"
- if ( isset($options['header']) and $options['header'] )
- $options['header'] = mso_get_val('widget_header_start', '<h2 class="box"><span>') . $options['header'] . mso_get_val('widget_header_end', '</span></h2>');
- else $options['header'] = '';
-
- return randomtext_widget_custom($options, $num);
- }
- # ??????? ?????? ????? ????????? ???????
- function randomtext_widget_form($num = 1)
- {
- $widget = 'randomtext_widget_' . $num; // ??? ??? ????? ? ????? = ?????? + ?????
-
- // ???????? ?????
- $options = mso_get_option($widget, 'plugins', array());
-
- if ( !isset($options['header']) ) $options['header'] = '';
-
- // ????? ????? ?????
- $CI = & get_instance();
- $CI->load->helper('form');
-
- $form = '<p><div class="t150">' . t('?????????:', 'plugins') . '</div> '.
- form_input( array( 'name'=>$widget . 'header', 'value'=>$options['header'] ) ) ;
-
- return $form;
- }
- # ???? ???????? POST ?? ????? ????????? ???????
- # ??? ??????? = ??????_update
- function randomtext_widget_update($num = 1)
- {
- $widget = 'randomtext_widget_' . $num; // ??? ??? ????? = ?????? + ?????
-
- // ???????? ?????
- $options = $newoptions = mso_get_option($widget, 'plugins', array());
-
- # ???????????? POST
- $newoptions['header'] = mso_widget_get_post($widget . 'header');
-
- if ( $options != $newoptions )
- mso_add_option($widget, $newoptions, 'plugins');
- }
- # ???????? ???????
- function randomtext_widget_custom($arg = array(), $num = 1)
- {
- 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>') ;
- if ( !isset($arg['block_start']) ) $arg['block_start'] = '<div class="random-text">';
- if ( !isset($arg['block_end']) ) $arg['block_end'] = '</div>';
-
- $text = '';
-
- # ???? ???? ???? randomtext, ?? ????? ????? ?? ???
- if (function_exists('ushka'))
- {
- $text = ushka('randomtext', "\n");
- }
-
- if (!$text)
- {
- $text =
- '????????? ?????????? ??????, ?? ??? ??????? ????, ? ?? ????. /?. ????????/
- ?????? ??? ?????????? ???????? ????? ????????. /?. ?????/
- ????? ? ???? ???? ??????, ??? ?????. /??????/
- ??????? ???? ???? ?????, ? ???? ???????. /?. ???????/
- ????????????? ???? ??? ?????. /?. ???????/
- ??????? ?? ???? ?????, ?? ????? ????????. /????????/
- ??? ?? ?????, ??? ????? ???, ?? ?????, ??? ?? ???
/???? ???????/
- ??? ?????? ?????? ????????. /?. ?????/
- ???????? ???? ??????? ????????. /?. ???????/
- ?? ???? ?????? ????????? ???????? ??????? ??????????. /?. ???????/
- ???????? ????? ???????, ???? ?????????? ????? ?????????. /????????/
- ?? ?????? ? ??????? ? ??????. /?. ?????????/
- ???????? ??????????? ???????. /?. ?????/
- ??????? ?????? ??? ??? ??????, ??? ?? ??? ??? ???????. /??????/
- ???????????????? ??????, ? ????????? ???????????. /?. ????/
- ????? ???????? ????, ???? ??????? ????? ????, ? ?? ?????? ?????? ? ????? ????????. /?????? ????????? ????/
- ?????????? ????????? ???????? ????? ?? ???? ????. /?????? ??????/
- ??????? ?????????? ?????????? ??????? ? ????. /?. ????????/
- ???????? ?? ??? ?? ??????, ??????? ????? ??????????? ?????? ????. /?????/
- ????? ?????????? ??????? ????????. /?. ???????/
- ???? ????? ???? ??? ?????. /?. ?????/
- ????????, ????? ?????????. /????????/
- ??? ????? ???? ? ???????? ????. (??? ????? ???? ? ????? ?????) /???????/
- ??????? ??? ??????? ??? ?????????. /?. ??????/
- ???? ??? ????? ????. /?. ???????/
- ???????? ??? ??, ?????????? ?? ???????. /?????? ????????/
- ??? ???? ? ???? ? ?????. /????????/
- ????? ???? ????. /????????/
- ?????? ????? ???????????. /?????/
- ???????? ?? ??????? ???????? ??? ?????????????. /?????/
- ????? ??????? ?????? ?????? ????. /?. ??????????/
- ?????????? ??????? ???????????? ?? ??????????. /?. ?????????/
- ?? ???? ?????? ?? ?????? ??? ???????, ??? ?????????. /?. ?????????/
- ??????? ??? ????????????. /??????/
- ????? ?????? ?? ????, ? ????????????? ? ???. /???????/
- ???? ?????? ???? ????????, ??????? ? ??????. /?. ???????/
- ?????????? ???? ? ???????? ????????????????? ?? ?????????. /?????/
- ??? ????? ??????, ??? ?? ????? ??????. /?. ?. ????????/
- ??????? ??????? ???????. ??? ?????? ?????? ???, ??? ?????? ??? ??????????. ?? ???? ?? ?????????? ???? ???????? ?? ?????? ????, ??? ?????? ? ???????? ????? ??? ?? ?????. /?.?????? (???????????? ?????????????)/
- ??????????? ?? ??? ??? ?? ??. ???? ????? ??? ????? ????????; ???? ????? ????????; ???? ??????? ??????. /????? ??????/
- ??? ???? Ť????ť ??? ?????? ????: ??? ?? ????, ??? ? ??? ??????, ?????? ??????????
?? ???? ?????? ??? ????? ???????? ????? ? ??????? ??? ??????? ? ???, ????? ?? ????? ????? ???????. /???? ????/
- ???????, ??-?????????? ????????, ??????? ?? ????? ?????? ?? ?????? ????????, ??? ?? ????? ???????. /???? ????/
- ??????? ???? ??? ???? ?? ??????????, ??? ?? ??? ????? ? ???? ????. /?????? ???????/
- ????????? ???? ?????? ??????? ? ?????? ?????, ?? ??? ?? ??????? ???????? ????????. /?????? ??????/
- ??? ????? ??????? ??????????, ??? ????? ??? ????????. /??????? ?????/
- ????? ??? ???????? ?????, ?? ?????? ??? ??????????. /?????????? ?????????/
- ??? ???????????? ??????? ???? ?? ???????. ? ??????? ???. ?? ?????? ??? ??? ???????, ????? ????? ?? ???????? ????. /???? ?????/';
- }
-
- $text = explode("\n", $text);
- $out = trim($text[ mt_rand(0, count($text) - 1) ] );
-
- return $arg['header'] . $arg['block_start'] . $out . $arg['block_end'];
- }
- # end file