XPressME Integration Kit

Trac

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

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

拡張ブロックのコードが選択テーマに無い場合デフォルトテーマ内を探すように Fixes #305

File size: 1.1 KB
Line 
1<?php
2// Block Version: 1.1
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        $file_found = true;
12        if (empty($include_file)) {
13                $file_found = false;
14                $output = __('The include file name to display it is not set.','xpress');
15        }
16        if (! file_exists($include_path)) {
17                $include_path_temp = $include_path;
18                $include_path = dirname(dirname(dirname(__FILE__))).'/xpress_default/blocks/my_' . $include_file . '_block.php';
19                if (! file_exists($include_path)) {
20                        $file_found = false;
21                        $output = sprintf(__('File %s not exist.','xpress'),$include_path_temp);
22                }
23        }
24        if($file_found) {
25                ob_start();
26                        require $include_path;
27                        $output = ob_get_contents();
28                ob_end_clean();
29                if (empty($output)) $output = __('PHP code error','xpress') . '( ' . $php_code . ' )';
30        }
31        $block['enhanced'] = $output;
32        return $block ;
33}
34?>
Note: See TracBrowser for help on using the repository browser.