XPressME Integration Kit

Trac

source: trunk/xpressme_integration_kit/blocks/popular_posts_block.php @ 842

Last change on this file since 842 was 495, checked in by toemon, 15 years ago

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

File size: 2.6 KB
RevLine 
[109]1<?php
2if( ! defined( 'XOOPS_ROOT_PATH' ) ) exit ;
3$mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
4
5eval( '
6function b_'.$mydirname.'_popular_show($options){
7        return _b_popular_show($options) ;
8}
9function b_'.$mydirname.'_popular_edit($options){
10        return _b_popular_edit($options) ;
11}
12' ) ;
13
14if( ! defined( 'XPRESS_POPULAR_BLOCK_INCLUDED' ) ) {
15        define( 'XPRESS_POPULAR_BLOCK_INCLUDED' , 1 ) ;
16        function _b_popular_edit($options)
17        {
18                $mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
[195]19                $this_template = empty( $options[1] ) ? 'db:'.$mydirname.'_popular_posts_block.html' : trim( $options[1] );
[120]20                $disp_count = empty( $options[2] ) ? '10' : $options[2] ;
21                $show_month_range = empty( $options[3] ) ? '0' : $options[3] ;
[142]22                $date_format = empty( $options[4] ) ? '' : $options[4] ;
23                $time_format = empty( $options[5] ) ? '' : $options[5] ;
24                $tag_select = $options[6] ;
[435]25                $cat_select = empty( $options[7] ) ? '0' : $options[7] ;
[142]26
[109]27                $mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
28               
29                require_once(XOOPS_ROOT_PATH.'/modules/'.$mydirname.'/blocks/block_common.php');
[495]30                $form  = javascript_check();
31                $form .= "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />\n";
[484]32                $form .= block_template_setting($mydirname,'options[1]',htmlspecialchars($this_template,ENT_QUOTES));
[142]33                $form .= "<br />\n";
[183]34                $form .= _MB_XP2_COUNT .": <input type='text' name='options[2]' value='" . $disp_count . "' /><br />\n";
35                $form .= _MB_XP2_MONTH_RANGE .": <input type='text' name='options[3]' value='" . $show_month_range . "' /><br />\n";
36                $form .= _MB_XP2_DATE_FORMAT .": <input type='text' name='options[4]' value='" . $date_format . "' /><br />\n";
37                $form .= _MB_XP2_TIME_FORMAT .": <input type='text' name='options[5]' value='" . $time_format . "' /><br />\n";
[365]38                include $mydirpath .'/wp-includes/version.php' ;
39                if (wp_version_compare($wp_version, '>=','2.3')){
40                        $form .= "<br />\n";
41                        $form .= _MB_XP2_TAGS_SELECT .": <input type='text' name='options[6]' value='" . $tag_select . "' /><br />\n";
42                } else {
43                        $form .= "<input type='hidden' name='options[6]' value='' /><br />\n";
44                }
45
[435]46                $form .= categorie_select('options[7]' , $cat_select);
[109]47                return $form;
48        }
49
50        function _b_popular_show($options)
51        {
52                $mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
53                $mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
54                $block_function_name = basename( __FILE__ );
55               
56                require_once $mydirpath.'/include/xpress_block_render.php';
57                return xpress_block_render($mydirname,$block_function_name,$options);
58        }
59}
60?>
Note: See TracBrowser for help on using the repository browser.