Rev | Line | |
---|
[138] | 1 | <?php
|
---|
[451] | 2 | // Block Version: 1.0
|
---|
[138] | 3 | function 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.