Code Duplication    Length = 30-30 lines in 2 locations

shortcodely-v1.0.0/shortcodely.php 1 location

@@ 381-410 (lines=30) @@
378
    return $did_one;
379
}
380
/* ---------------------------------------------------------------------------*/
381
function shortcodely_reg_sidebar()
382
{
383
    // this is fired late, so hopefully any theme sidebars will have been registered already.
384
385
    global $wp_registered_widgets, $_wp_sidebars_widgets, $wp_registered_sidebars;
386
387
    if (function_exists('register_sidebar')) {    // maybe later, get the first main sidebar and copy it's before/after etc
388
        $args = array(
389
        'name' => 'Widgets for Shortcodely',
390
        'id' => 'widgets_for_shortcodes', // hope to avoid losing widgets
391
        'description' => __('Sidebar to hold widgets and their settings. These widgets will be used in a shortcode.	This sidebars widgets should be saved with your theme settings now.', 'shortcodely-shortcode-any-widget'),
392
        'before_widget' => '<aside' . ' id="%1$s" class="%2$s ">', // 201402 to match twentyfourteen theme
393
        'after_widget' => '</aside>',
394
        'before_title' => '<h1 class="widget-title" >', // 201402 maybe dont use widget class - we are in content here not in a widget area but others want the widget styling. ?
395
        'after_title' => '</h1>',
396
        );
397
398
        if (! empty($wp_registered_sidebars)) {    // we got some sidebars already.
399
                $main_sidebar = reset($wp_registered_sidebars); // Grab the first sidebar and use that as defaults for the widgets
400
                $args['before_widget'] = $main_sidebar['before_widget'];
401
            $args['after_widget'] = $main_sidebar['after_widget'];
402
            $args['before_title'] = $main_sidebar['before_title'];
403
            $args['after_title'] = $main_sidebar['after_title'];
404
        }
405
406
        register_sidebar($args);
407
    }
408
409
    //else {	echo '<h1>CANNOT REGISTER widgets_for_shortcodes SIDEBAR</h1>';}
410
}
411
/*-----------------------------------*/
412
require 'shortcodely-admin-form-html.php';
413
require 'shortcodely-utilities.php';

shortcodely.php 1 location

@@ 381-410 (lines=30) @@
378
    return $did_one;
379
}
380
/* ---------------------------------------------------------------------------*/
381
function shortcodely_reg_sidebar()
382
{
383
    // this is fired late, so hopefully any theme sidebars will have been registered already.
384
385
    global $wp_registered_widgets, $_wp_sidebars_widgets, $wp_registered_sidebars;
386
387
    if (function_exists('register_sidebar')) {    // maybe later, get the first main sidebar and copy it's before/after etc
388
        $args = array(
389
        'name' => 'Widgets for Shortcodely',
390
        'id' => 'widgets_for_shortcodes', // hope to avoid losing widgets
391
        'description' => __('Sidebar to hold widgets and their settings. These widgets will be used in a shortcode.	This sidebars widgets should be saved with your theme settings now.', 'shortcodely-shortcode-any-widget'),
392
        'before_widget' => '<aside' . ' id="%1$s" class="%2$s ">', // 201402 to match twentyfourteen theme
393
        'after_widget' => '</aside>',
394
        'before_title' => '<h1 class="widget-title" >', // 201402 maybe dont use widget class - we are in content here not in a widget area but others want the widget styling. ?
395
        'after_title' => '</h1>',
396
        );
397
398
        if (! empty($wp_registered_sidebars)) {    // we got some sidebars already.
399
                $main_sidebar = reset($wp_registered_sidebars); // Grab the first sidebar and use that as defaults for the widgets
400
                $args['before_widget'] = $main_sidebar['before_widget'];
401
            $args['after_widget'] = $main_sidebar['after_widget'];
402
            $args['before_title'] = $main_sidebar['before_title'];
403
            $args['after_title'] = $main_sidebar['after_title'];
404
        }
405
406
        register_sidebar($args);
407
    }
408
409
    //else {	echo '<h1>CANNOT REGISTER widgets_for_shortcodes SIDEBAR</h1>';}
410
}
411
/*-----------------------------------*/
412
require 'shortcodely-admin-form-html.php';
413
require 'shortcodely-utilities.php';