XPressME Integration Kit

Trac

source: trunk/wp-content/themes/xpress_default/blocks/enhanced_block_theme.php @ 138

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

拡張ブロックの実装 #78 bump Ver 0.17

File size: 833 bytes
Line 
1<?php
2function enhanced_block($options)
3{
4        $mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
5        $this_template = empty( $options[1] ) ? 'db:'.$mydirname.'_enhanced_block.html' : trim( $options[1] );
6        $include_file = empty( $options[2] ) ? '' : $options[2] ;
7       
8        $include_path = dirname(__FILE__) . '/my_' . $include_file . '_block.php';
9
10        if (empty($include_file)) {
11                $output = __('The include file name to display it is not set.','xpress');
12        } else if (! file_exists($include_path)) {
13                $output = sprintf(__('File %s not exist.','xpress'),$include_path);
14        } else {
15                ob_start();
16                        require $include_path;
17                        $output = ob_get_contents();
18                ob_end_clean();
19                if (empty($output)) $output = __('PHP code error','xpress') . '( ' . $php_code . ' )';
20        }
21        $block['enhanced'] = $output;
22        return $block ;
23}
24?>
Note: See TracBrowser for help on using the repository browser.