XPressME Integration Kit

Trac

source: branches/Ver2.4/xpressme_integration_kit/blocks/tag_cloud_block.php @ 829

Last change on this file since 829 was 495, checked in by toemon, 14 years ago

ブロックオプションでjavascriptの有効性チェック Fixes #274

File size: 4.7 KB
Line 
1<?php
2if( ! defined( 'XOOPS_ROOT_PATH' ) ) exit ;
3$mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
4
5eval( '
6function b_'.$mydirname.'_tag_cloud_show($options){
7        return _b_tag_cloud_show($options) ;
8}
9function b_'.$mydirname.'_tag_cloud_edit($options){
10        return _b_tag_cloud_edit($options) ;
11}
12' ) ;           
13       
14if( ! defined( 'XPRESS_TAG_CLOUD_BLOCK_INCLUDED' ) ) {
15        define( 'XPRESS_TAG_CLOUD_BLOCK_INCLUDED' , 1 ) ;
16       
17        function _b_tag_cloud_edit($options)
18        {
19                $mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
20                $this_template = empty( $options[1] ) ? 'db:'.$mydirname.'_tag_cloud_block.html' : trim( $options[1] );
21                $smallest = !is_numeric( $options[2] ) ? 8 : $options[2] ;
22                $largest = !is_numeric( $options[3] ) ? 22 : $options[3] ;
23                $unit = empty( $options[4] ) ? 'pt' : $options[4] ;
24                $number = !is_numeric( $options[5] ) ? 45 : $options[5] ;
25                $format = empty( $options[6] ) ? 'flat' : $options[6] ;
26                $orderby = empty( $options[7] ) ? 'name' : $options[7] ;
27                $order = empty( $options[8] ) ? 'ASC' : $options[8] ;
28                $exclude = is_null( $options[9] ) ? '' : $options[9] ;
29                $wp_include = is_null( $options[10] ) ? '' : $options[10] ;
30               
31                require_once(XOOPS_ROOT_PATH.'/modules/'.$mydirname.'/blocks/block_common.php');       
32
33                $form  = javascript_check();
34                $form .= "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />\n";
35                $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES));
36                $form .= "<br />";
37                $form .= _MB_XP2_CLOUD_SMALLEST .": <input type='text' size='4' name='options[2]' value='" . $smallest . "' /><br />";
38                $form .= _MB_XP2_CLOUD_LARGEST .": <input type='text' size='4' name='options[3]' value='" . $largest . "' /><br />";
39                $form .= _MB_XP2_CLOUD_UNIT .": ";
40                $form .=  "<select name='options[4]'>";
41                if ($unit =='pt')
42                        $form .=  "<option value='pt' selected='selected'>pt";
43                else
44                        $form .=  "<option value='pt'>pt";
45                if ($unit =='px')
46                        $form .=  "<option value='px' selected='selected'>px";
47                else
48                        $form .=  "<option value='px'>px";
49                if ($unit =='em')
50                        $form .=  "<option value='em' selected='selected'>em";
51                else
52                        $form .=  "<option value='em'>em";
53                if ($unit =='%')
54                        $form .=  "<option value='%' selected='selected'>%";
55                else
56                        $form .=  "<option value='%'>%";
57                $form .=  "</select><br/>";
58               
59                $form .= _MB_XP2_CLOUD_NUMBER .": <input type='text' size='4' name='options[5]' value='" . $number . "' /><br />";
60               
61                $form .= _MB_XP2_CLOUD_FORMAT .": ";
62                $form .=  "<select name='options[6]'>";
63                if ($format =='flat')
64                        $form .=  "<option value='flat' selected='selected'>" . _MB_XP2_FLAT;
65                else
66                        $form .=  "<option value='flat'>" . _MB_XP2_FLAT;
67                if ($format =='list')
68                        $form .=  "<option value='list' selected='selected'>". _MB_XP2_LIST;
69                else
70                        $form .=  "<option value='list'>". _MB_XP2_LIST;
71                $form .=  "</select><br/>";
72                               
73                $form .= _MB_XP2_CLOUD_ORDERBY .": ";
74                $form .=  "<select name='options[7]'>";
75                if ($orderby =='name')
76                        $form .=  "<option value='name' selected='selected'>". _MB_XP2_TAG_NAME;
77                else
78                        $form .=  "<option value='name'>". _MB_XP2_TAG_NAME;
79                if ($orderby =='count')
80                        $form .=  "<option value='count' selected='selected'>". _MB_XP2_TAG_COUNT;
81                else
82                        $form .=  "<option value='count'>". _MB_XP2_TAG_COUNT;
83                $form .=  "</select><br/>";
84
85                $form .= _MB_XP2_CLOUD_ORDER .": ";
86                $form .=  "<select name='options[8]'>";
87                if ($order =='ASC')
88                        $form .=  "<option value='ASC' selected='selected'>" . _MB_XP2_SORT_ASC;
89                else
90                        $form .=  "<option value='ASC'>" . _MB_XP2_SORT_ASC;
91                if ($order =='DESC')
92                        $form .=  "<option value='DESC' selected='selected'>" . _MB_XP2_SORT_DESC;
93                else
94                        $form .=  "<option value='DESC'>" . _MB_XP2_SORT_DESC;
95                if ($order =='RAND')
96                        $form .=  "<option value='RAND' selected='selected'>" . _MB_XP2_RAND;
97                else
98                        $form .=  "<option value='RAND'>" . _MB_XP2_RAND;
99                $form .=  "</select><br/>";
100
101                $form .= _MB_XP2_CLOUD_EXCLUDE .": <input type='text' size='25' name='options[9]' value='" . $exclude . "' /><br />";
102                $form .= _MB_XP2_CLOUD_INCLUDE .": <input type='text' size='25' name='options[10]' value='" . $wp_include . "' /><br />";
103
104
105//          $form .="<br /><input type='text' size='60' name='options[8]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' />";
106           
107                return $form;
108        }
109       
110        function _b_tag_cloud_show($options)
111        {
112                $mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
113                $mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
114                $block_function_name = basename( __FILE__ );
115               
116                require_once $mydirpath.'/include/xpress_block_render.php';
117                return xpress_block_render($mydirname,$block_function_name,$options);
118        }
119       
120}
121
122?>
Note: See TracBrowser for help on using the repository browser.