Skip to content

Commit

Permalink
Avoid warnings when using [guts] shortcode #45
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbingwide committed Oct 5, 2021
1 parent b07cf23 commit 002c777
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
23 changes: 22 additions & 1 deletion oik-bob-bing-wide.php
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,30 @@ function oik_bob_bing_wide_dynamic_block_search( $attributes ) {
function oik_bob_bing_wide_dynamic_block_wp( $attributes ) {
$html=\oik\oik_blocks\oik_blocks_check_server_func( "shortcodes/oik-guts.php", "oik-bob-bing-wide", "oik_block_guts" );
if ( ! $html ) {
$html=oik_block_guts( $attributes, null, null );
$html = oik_block_guts( $attributes, null, null );
$html = oik_bob_bing_wide_wrap_wp( $html );

}
return $html;
}

/**
* Wraps the output using the block's attributes.
*
* @param $html
* @return mixed
*/
function oik_bob_bing_wide_wrap_wp( $text ) {
// get_block_wrapper_attributes needs to know what the block supports
// It doesn't need to know about the $atts
$extra_attributes = [];
$wrapper_attributes=get_block_wrapper_attributes( $extra_attributes );
$html = sprintf(
'<div %1$s>%2$s</div>',
$wrapper_attributes,
$text
);
return $html;
}

oik_bob_bing_wide_loaded();
17 changes: 2 additions & 15 deletions shortcodes/oik-guts.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,14 @@
* - and/or Memory limit
*
*/

function oik_block_guts( $attributes, $content, $tag ) {
global $wp_version;
//sdiv( "guts");
$extra_attributes = [];
$v = bw_array_get( $attributes, 'v', null );
$g = bw_array_get( $attributes, 'g', null );
$p = bw_array_get( $attributes, 'p', null );
$m = bw_array_get( $attributes, 'm', null );
$br = false;
//print_r( $extra_attributes );
// get_block_wrapper_attributes needs to know what the block supports
// It doesn't need to know about the $atts
$wrapper_attributes = get_block_wrapper_attributes( $extra_attributes );
if ( $v ) {
if ( $v ) {
span( "label" );
/** Note: Translators / automatic translation tools may remove trailing blanks.
* Instead of using these we add padding to span.label
Expand Down Expand Up @@ -78,15 +71,9 @@ function oik_block_guts( $attributes, $content, $tag ) {
$memory_limit = ini_get( "memory_limit" );
e( $memory_limit );
epan();

}
$text = bw_ret();
$html = sprintf(
'<div %1$s>%2$s</div>',
$wrapper_attributes,
$text
);
return $html;
return $text;
}

/**
Expand Down

0 comments on commit 002c777

Please sign in to comment.