[136] | 1 | <?php
|
---|
| 2 | if( ! defined( 'XOOPS_ROOT_PATH' ) ) exit ;
|
---|
| 3 | $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
|
---|
| 4 |
|
---|
| 5 | eval( '
|
---|
| 6 | function b_'.$mydirname.'_widget_show($options){
|
---|
| 7 | return _b_widget_show($options) ;
|
---|
| 8 | }
|
---|
| 9 | function b_'.$mydirname.'_widget_edit($options){
|
---|
| 10 | return _b_widget_edit($options) ;
|
---|
| 11 | }
|
---|
| 12 | ' ) ;
|
---|
| 13 |
|
---|
[194] | 14 | if( ! defined( 'XPRESS_WIDGET_BLOCK_INCLUDED' ) ) {
|
---|
| 15 | define( 'XPRESS_WIDGET_BLOCK_INCLUDED' , 1 ) ;
|
---|
[136] | 16 |
|
---|
| 17 | function _b_widget_edit($options)
|
---|
| 18 | {
|
---|
| 19 | $mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
|
---|
[195] | 20 | $this_template = empty( $options[1] ) ? 'db:'.$mydirname.'_widget_block.html' : trim( $options[1] );
|
---|
[136] | 21 | $selected = array_slice($options,2); // get allowed cats
|
---|
| 22 |
|
---|
| 23 | global $table_prefix,$wpdb,$xoops_db;
|
---|
| 24 | require_once(XOOPS_ROOT_PATH.'/modules/'.$mydirname.'/wp-load.php');
|
---|
| 25 | global $wp_registered_sidebars, $wp_registered_widgets;
|
---|
| 26 |
|
---|
| 27 | require_once(XOOPS_ROOT_PATH.'/modules/'.$mydirname.'/blocks/block_common.php');
|
---|
| 28 |
|
---|
| 29 | $form = "MyDirectory <input type='text' name='options[0]' value='" . $mydirname . "' /><br />";
|
---|
| 30 | $form .= "<input type='hidden' name='options[1]' id='this_template' value='".htmlspecialchars($this_template,ENT_QUOTES)."' /><br />";
|
---|
| 31 | $form .= "<br />";
|
---|
[183] | 32 | $form .= _MB_XP2_SELECT_WIDGET .":<br />\n";
|
---|
[136] | 33 | $form .= " <select name='options[]' multiple=\"multiple\">\n";
|
---|
| 34 | $sidebars_widgets = wp_get_sidebars_widgets();
|
---|
| 35 | foreach($wp_registered_sidebars as $sidebar){
|
---|
| 36 | $sidebar_id = $sidebar['id'];
|
---|
| 37 | $widgets = $sidebars_widgets[$sidebar_id];
|
---|
| 38 | foreach($widgets as $widget){
|
---|
| 39 | if (empty($wp_registered_widgets[$widget])) continue;
|
---|
| 40 | $widget_str = $sidebar_id . '::' . $widget;
|
---|
| 41 | if (in_array($widget_str, $selected))
|
---|
| 42 | $form .= "<option value='" . $widget_str . "' selected='selected'>" . $widget_str;
|
---|
| 43 | else
|
---|
| 44 | $form .= "<option value='" . $widget_str . "'>" . $widget_str;
|
---|
| 45 | }
|
---|
| 46 | }
|
---|
| 47 | $form .= "</select><br/>\n";
|
---|
| 48 | return $form;
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | function _b_widget_show($options)
|
---|
| 52 | {
|
---|
| 53 | $mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ;
|
---|
| 54 | $mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
|
---|
| 55 | $block_function_name = basename( __FILE__ );
|
---|
| 56 |
|
---|
| 57 | require_once $mydirpath.'/include/xpress_block_render.php';
|
---|
| 58 | return xpress_block_render($mydirname,$block_function_name,$options);
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | function sidebar_select($wp_registered_sidebars,$option_name,$option_value)
|
---|
| 62 | {
|
---|
| 63 |
|
---|
| 64 | }
|
---|
| 65 |
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | ?> |
---|