XPressME Integration Kit

Trac

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

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

ブロックのバージョン管理実装 Fixes #246

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