Plugin Directory

Changeset 3296646


Ignore:
Timestamp:
05/19/2025 04:18:30 PM (9 months ago)
Author:
sevenspark
Message:

Committing 1.4.4 to trunk

Location:
bellows-accordion-menu/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • bellows-accordion-menu/trunk/bellows-accordion-menu.php

    r2986331 r3296646  
    55 * Plugin URI:        http://getbellows.com
    66 * Description:       A flexible and robust WordPress accordion menu plugin
    7  * Version:           1.4.3
     7 * Version:           1.4.4
    88 * Requires at least: 5.0
    99 * Requires PHP:      7.4
     
    1414 */
    1515
    16 if( ! defined( 'WPINC' ) ) die;         // If this file is called directly, abort.
     16if (!defined('WPINC'))
     17    die;        // If this file is called directly, abort.
    1718
    18 if( ! defined( 'BELLOWS_VERSION' ) )    define( 'BELLOWS_VERSION',  '1.4.3' );
    19 if( ! defined( 'BELLOWS_PRO' ) )        define( 'BELLOWS_PRO' ,     false );
     19if (!defined('BELLOWS_VERSION'))
     20    define('BELLOWS_VERSION', '1.4.4');
     21if (!defined('BELLOWS_PRO'))
     22    define('BELLOWS_PRO', false);
    2023
    21 if( ! defined( 'BELLOWS_BASENAME' ) )   define( 'BELLOWS_BASENAME', plugin_basename( __FILE__ ) );
    22 if( ! defined( 'BELLOWS_BASEDIR' ) )    define( 'BELLOWS_BASEDIR',  dirname( plugin_basename(__FILE__) ) );
    23 if( ! defined( 'BELLOWS_FILE' ) )       define( 'BELLOWS_FILE',     __FILE__ );
    24 if( ! defined( 'BELLOWS_URL' ) )        define( 'BELLOWS_URL',      plugin_dir_url( __FILE__ ) );
    25 if( ! defined( 'BELLOWS_DIR' ) )        define( 'BELLOWS_DIR',      plugin_dir_path( __FILE__ ) );
    26 if( ! defined( 'BELLOWS_ADMIN_CAP' ) )  define( 'BELLOWS_ADMIN_CAP', 'manage_options' );
     24if (!defined('BELLOWS_BASENAME'))
     25    define('BELLOWS_BASENAME', plugin_basename(__FILE__));
     26if (!defined('BELLOWS_BASEDIR'))
     27    define('BELLOWS_BASEDIR', dirname(plugin_basename(__FILE__)));
     28if (!defined('BELLOWS_FILE'))
     29    define('BELLOWS_FILE', __FILE__);
     30if (!defined('BELLOWS_URL'))
     31    define('BELLOWS_URL', plugin_dir_url(__FILE__));
     32if (!defined('BELLOWS_DIR'))
     33    define('BELLOWS_DIR', plugin_dir_path(__FILE__));
     34if (!defined('BELLOWS_ADMIN_CAP'))
     35    define('BELLOWS_ADMIN_CAP', 'manage_options');
    2736
    28 include( 'Bellows.class.php' ); //Let's get the party started
     37include('Bellows.class.php');   //Let's get the party started
  • bellows-accordion-menu/trunk/includes/bellows.api.php

    r2986331 r3296646  
    11<?php
    22
    3 function bellows_menu_toggle( $menu_id, $content, $btn_class, $args ){
    4     $content = apply_filters( 'bellows_menu_toggle_content', $content, $menu_id, $args );
    5     $btn = '<button class="bellows-menu-toggle '.esc_attr($btn_class).'" aria-controls="'.esc_attr($menu_id).'">'.$content.'</button>';
    6     return apply_filters( 'bellows_menu_toggle', $btn, $menu_id, $args );
     3function bellows_menu_toggle($menu_id, $content, $btn_class, $args)
     4{
     5    $content = apply_filters('bellows_menu_toggle_content', $content, $menu_id, $args);
     6    $btn = '<button class="bellows-menu-toggle ' . esc_attr($btn_class) . '" aria-controls="' . esc_attr($menu_id) . '">' . $content . '</button>';
     7    return apply_filters('bellows_menu_toggle', $btn, $menu_id, $args);
    78}
    89
     
    1415 *
    1516 */
    16 function bellows( $config_id = 'main' , $menu_args = [] ){
    17 
    18     $config_id = bellows_validate_config_id( $config_id );
    19 
    20     _BELLOWS()->set_current_config_id( $config_id );
     17function bellows($config_id = 'main', $menu_args = [])
     18{
     19
     20    $config_id = bellows_validate_config_id($config_id);
     21
     22    _BELLOWS()->set_current_config_id($config_id);
    2123
    2224    $menu_args['bellows_source'] = 'menu'; // Default source
    23     $args = bellows_get_nav_menu_args( $config_id , $menu_args );
     25    $args = bellows_get_nav_menu_args($config_id, $menu_args);
    2426    $toggle = bellows_output_responsive_toggle($config_id, $args);
    2527
    2628    // Generate the menu (wp_nav_menu will print if we're printing)
    27     $menu = wp_nav_menu( $args );
     29    $menu = wp_nav_menu($args);
    2830
    2931    // $menu will be empty if we're printing, but $toggle will not
     
    3234
    3335
    34 add_shortcode( 'bellows' , 'bellows_shortcode' );
    35 function bellows_shortcode( $atts, $content = null ){
    36 
    37     extract( shortcode_atts( array(
    38         'config_id'         => 'main',
    39         'theme_location'    => '',
    40         'menu'              => '',
     36add_shortcode('bellows', 'bellows_shortcode');
     37function bellows_shortcode($atts, $content = null)
     38{
     39
     40    extract(shortcode_atts(array(
     41        'config_id' => 'main',
     42        'theme_location' => '',
     43        'menu' => '',
    4144    ), $atts));
    4245
    43    
     46
    4447    $args = array();
    4548    $args['echo'] = false;
    4649
    4750
    48     if( $theme_location ){
     51    if ($theme_location) {
    4952        $args['theme_location'] = $theme_location;
    5053    }
    51     if( $menu ){
     54    if ($menu) {
    5255        $args['menu'] = $menu;
    5356    }
    5457
    55     return bellows( $config_id , $args );
     58    return bellows($config_id, $args);
    5659
    5760
     
    6164 * Numeric menu ID is required
    6265 */
    63 function bellows_section( string $config_id, array $menu_args, array $section_args ){
    64 
    65     $config_id = bellows_validate_config_id( $config_id );
    66 
    67     if( !BELLOWS_PRO ){
     66function bellows_section(string $config_id, array $menu_args, array $section_args)
     67{
     68
     69    $config_id = bellows_validate_config_id($config_id);
     70
     71    if (!BELLOWS_PRO) {
    6872        return bellows_admin_notice(
    69             'Upgrade to <a href="' . BELLOWS_PRO_URL . '">Bellows Pro</a> to use the Bellows Menu Section feature.' ,
     73            'Upgrade to <a href="' . BELLOWS_PRO_URL . '">Bellows Pro</a> to use the Bellows Menu Section feature.',
    7074            false
    7175        );
    7276    }
    7377
    74     if( !isset( $menu_args['menu'] ) ){
     78    if (!isset($menu_args['menu'])) {
    7579        return '<!-- No menu ID passed, cannot generate Bellows Section -->';
    7680    }
    77     if( !isset( $section_args['root']) ){
     81    if (!isset($section_args['root'])) {
    7882        return '<!-- No section root passed, cannot generate Bellows Section -->';
    7983    }
    8084
    81     _BELLOWS()->set_current_config_id( $config_id );
     85    _BELLOWS()->set_current_config_id($config_id);
    8286
    8387    $menu_args['bellows_source'] = 'section'; // Default source
    8488    $menu_args['bellows_section'] = $section_args;
    85     $args = bellows_get_nav_menu_args( $config_id , $menu_args );
    86     $args['container_id'] = 'bellows-'.$config_id.'-'.sanitize_key( $menu_args['menu'] ).'-section-'.$section_args['root'];
     89    $args = bellows_get_nav_menu_args($config_id, $menu_args);
     90    $args['container_id'] = 'bellows-' . $config_id . '-' . sanitize_key($menu_args['menu']) . '-section-' . $section_args['root'];
    8791
    8892    // // Should the toggle and menu be printed
     
    100104
    101105    // Generate the menu (wp_nav_menu will print if we're printing)
    102     add_filter( 'wp_nav_menu_objects' , 'bellows_filter_section' , 10, 2 );
    103     $menu = wp_nav_menu( $args );
    104     remove_filter( 'wp_nav_menu_objects' , 'bellows_filter_section' , 10, 2 );
     106    add_filter('wp_nav_menu_objects', 'bellows_filter_section', 10, 2);
     107    $menu = wp_nav_menu($args);
     108    remove_filter('wp_nav_menu_objects', 'bellows_filter_section', 10, 2);
    105109
    106110    // $menu will be empty if we're printing, but $toggle will not
     
    108112}
    109113
    110 add_shortcode( 'bellows_section' , 'bellows_section_shortcode' );
    111 function bellows_section_shortcode( $atts, $content = null ){
    112 
    113     extract( shortcode_atts( [
    114         'config_id'         => 'main',
    115         'menu'              => '',
    116         'root'              => '',
    117         'include_root'      => 'false',
     114add_shortcode('bellows_section', 'bellows_section_shortcode');
     115function bellows_section_shortcode($atts, $content = null)
     116{
     117
     118    extract(shortcode_atts([
     119        'config_id' => 'main',
     120        'menu' => '',
     121        'root' => '',
     122        'include_root' => 'false',
    118123    ], $atts));
    119124
     
    122127
    123128
    124     if( $menu ){
     129    if ($menu) {
    125130        $args['menu'] = $menu;
    126131    }
    127132
    128     $include_root = strtolower( $include_root ) === 'true' ? true : false;
     133    $include_root = strtolower($include_root) === 'true' ? true : false;
    129134
    130135    $section_args = [
    131         'root'  => $root,
     136        'root' => $root,
    132137        'include_root' => $include_root,
    133138    ];
    134139
    135     return bellows_section( $config_id , $args, $section_args );
    136 
    137 }
    138 
    139 
    140 
    141 function bellows_terms( $config_id = 'main' , $term_args = array() , $menu_args = array() ){
    142 
    143     if( !BELLOWS_PRO ){
     140    return bellows_section($config_id, $args, $section_args);
     141
     142}
     143
     144
     145
     146function bellows_terms($config_id = 'main', $term_args = array(), $menu_args = array())
     147{
     148
     149    if (!BELLOWS_PRO) {
    144150        return bellows_admin_notice(
    145             'Upgrade to <a href="' . BELLOWS_PRO_URL . '">Bellows Pro</a> to use the Terms Autopopulation feature.' ,
     151            'Upgrade to <a href="' . BELLOWS_PRO_URL . '">Bellows Pro</a> to use the Terms Autopopulation feature.',
    146152            false
    147153        );
    148154    }
    149155
    150     $config_id = bellows_validate_config_id( $config_id );
     156    $config_id = bellows_validate_config_id($config_id);
    151157
    152158    // If 'taxonomies' is passed, convert to 'taxonomy'
    153     if( isset( $term_args['taxonomies'] ) && !isset( $term_args['taxonomy'] ) ){
     159    if (isset($term_args['taxonomies']) && !isset($term_args['taxonomy'])) {
    154160        $term_args['taxonomy'] = $term_args['taxonomies'];
    155161    }
    156162
    157163    $term_args_defaults = array(
    158         'taxonomy'      => 'category',
    159         'number'        => 0,
    160         'offset'        => '',
    161         'child_of'      => 0,
    162         'order'         => 'ASC',
    163         'orderby'       => 'name',
    164         'hide_empty'    => true,
    165         'hierarchical'  => true,
    166         'exclude'       => '',
    167         'counts'        => false,
     164        'taxonomy' => 'category',
     165        'number' => 0,
     166        'offset' => '',
     167        'child_of' => 0,
     168        'order' => 'ASC',
     169        'orderby' => 'name',
     170        'hide_empty' => true,
     171        'hierarchical' => true,
     172        'exclude' => '',
     173        'counts' => false,
    168174    );
    169     $term_args = wp_parse_args( $term_args, $term_args_defaults );
     175    $term_args = wp_parse_args($term_args, $term_args_defaults);
    170176
    171177    // Set up meta_term_order custom meta query if that's the selected orderby field
    172     if( $term_args['orderby'] === 'meta_term_order' ){
     178    if ($term_args['orderby'] === 'meta_term_order') {
    173179        // Set up custom meta query
    174180        $term_args['meta_query'] = [
     
    179185        ];
    180186    }
    181    
    182 
    183     _BELLOWS()->set_current_config_id( $config_id );
     187
     188
     189    _BELLOWS()->set_current_config_id($config_id);
    184190
    185191
     
    190196    // Assign the depth, but only if it's actually set - if we set it to '', which is the default coming from
    191197    // the generator due to the empty string text field, that blows everything up
    192     if( isset( $term_args['depth'] ) && $term_args['depth'] !== '' ){
     198    if (isset($term_args['depth']) && $term_args['depth'] !== '') {
    193199        $menu_args['depth'] = $term_args['depth'];
    194200    }
    195201
    196202
    197     $menu_args = bellows_get_nav_menu_args( $config_id , $menu_args );
     203    $menu_args = bellows_get_nav_menu_args($config_id, $menu_args);
    198204    // bellp( $menu_args );
    199205
     
    201207
    202208    //add_filter( 'wp_get_nav_menu_items' , 'bellows_populate_terms' , 10, 3 );
    203     add_filter( 'wp_nav_menu_objects' , 'bellows_populate_terms' , 10, 2 );
    204     $menu = wp_nav_menu( $menu_args );
    205     remove_filter( 'wp_nav_menu_objects' , 'bellows_populate_terms' , 10, 2 );
     209    add_filter('wp_nav_menu_objects', 'bellows_populate_terms', 10, 2);
     210    $menu = wp_nav_menu($menu_args);
     211    remove_filter('wp_nav_menu_objects', 'bellows_populate_terms', 10, 2);
    206212    //remove_filter( 'wp_get_nav_menu_items' , 'bellows_populate_terms' , 10, 3 );
    207213
     
    212218
    213219
    214 add_shortcode( 'bellows_terms' , 'bellows_terms_shortcode' );
    215 function bellows_terms_shortcode( $atts, $content = null ){
    216 
    217     $term_args = shortcode_atts( array(
    218         'config_id'         => 'main',
    219        
    220         'taxonomy'          => 'category',
    221         'number'            => '',
    222         'offset'            => '',
    223         'orderby'           => 'name',
    224         'order'             => 'ASC',
    225         'hide_empty'        => 'true',
    226         'hierarchical'      => 'true',
    227         'child_of'          => 0,
    228         'depth'             => 0,
    229         'exclude'           => '',
    230         'counts'            => false,
     220add_shortcode('bellows_terms', 'bellows_terms_shortcode');
     221function bellows_terms_shortcode($atts, $content = null)
     222{
     223
     224    $term_args = shortcode_atts(array(
     225        'config_id' => 'main',
     226
     227        'taxonomy' => 'category',
     228        'number' => '',
     229        'offset' => '',
     230        'orderby' => 'name',
     231        'order' => 'ASC',
     232        'hide_empty' => 'true',
     233        'hierarchical' => 'true',
     234        'child_of' => 0,
     235        'depth' => 0,
     236        'exclude' => '',
     237        'counts' => false,
    231238
    232239    ), $atts);
    233240
    234     extract( $term_args );
     241    extract($term_args);
    235242
    236243    $menu_args = array();
    237244    $menu_args['echo'] = false;
    238245
    239     $taxonomies = isset( $atts['taxonomies'] ) ? $atts['taxonomies'] : $taxonomy;
    240 
    241     if( $taxonomies ){
    242 
    243         unset( $term_args['config_id'] );
     246    $taxonomies = isset($atts['taxonomies']) ? $atts['taxonomies'] : $taxonomy;
     247
     248    if ($taxonomies) {
     249
     250        unset($term_args['config_id']);
    244251
    245252        //Taxonomies
    246         $taxonomies = explode( ',' , $taxonomies );
    247         foreach( $taxonomies as $key => $tax ){
    248             $taxonomies[$key] = trim( $tax );
     253        $taxonomies = explode(',', $taxonomies);
     254        foreach ($taxonomies as $key => $tax) {
     255            $taxonomies[$key] = trim($tax);
    249256        }
    250257        $term_args['taxonomy'] = $taxonomies;
    251258
    252259        //TODO: Handle booleans that are strings
    253         if( $term_args['hide_empty'] == 'false' ) $term_args['hide_empty'] = false;
    254         else if( $term_args['hide_empty'] == 'true'  ) $term_args['hide_empty'] = true;
    255         if( $term_args['hierarchical'] == 'false' ) $term_args['hierarchical'] = false;
    256         else if( $term_args['hierarchical'] == 'true' ) $term_args['hierarchical'] = true;
     260        if ($term_args['hide_empty'] == 'false')
     261            $term_args['hide_empty'] = false;
     262        else if ($term_args['hide_empty'] == 'true')
     263            $term_args['hide_empty'] = true;
     264        if ($term_args['hierarchical'] == 'false')
     265            $term_args['hierarchical'] = false;
     266        else if ($term_args['hierarchical'] == 'true')
     267            $term_args['hierarchical'] = true;
    257268
    258269        //if( $child_of ) $term_args['child_of'] = $child_of;
    259270
    260271        //bellp( $term_args );
    261         return bellows_terms( $config_id , $term_args , $menu_args );
     272        return bellows_terms($config_id, $term_args, $menu_args);
    262273    }
    263274
     
    269280
    270281
    271 function bellows_posts( $config_id = 'main' , $post_args = array() , $menu_args = array( 'echo' => true ) ){
    272 
    273     if( !BELLOWS_PRO ){
     282function bellows_posts($config_id = 'main', $post_args = array(), $menu_args = array('echo' => true))
     283{
     284
     285    if (!BELLOWS_PRO) {
    274286        return bellows_admin_notice(
    275             'Upgrade to <a href="' . BELLOWS_PRO_URL . '">Bellows Pro</a> to use the Posts Autopopulation feature.' ,
     287            'Upgrade to <a href="' . BELLOWS_PRO_URL . '">Bellows Pro</a> to use the Posts Autopopulation feature.',
    276288            false
    277289        );
    278290    }
    279291
    280     $config_id = bellows_validate_config_id( $config_id );
     292    $config_id = bellows_validate_config_id($config_id);
    281293
    282294    $post_arg_defaults = array(
    283         'post_type'     => 'page',
    284         'post_parent'   => '', //0,
     295        'post_type' => 'page',
     296        'post_parent' => '', //0,
    285297        'include_parent' => false,
    286         'numberposts'   => -1,
    287         'offset'        => 0,
    288         'orderby'       => 'title',
    289         'order'         => 'ASC',
    290         'author'        => '',
    291         'cat'           => '', //ID
    292         'category__and' => '',
    293         'category__in'  => '',
    294         'tag_id'            => '', //ID
    295         'tag__and'      => '',
    296         'tag__in'       => '',
    297         'depth'         => 2,
    298         'exclude'       => '',
     298        'numberposts' => -1,
     299        'offset' => 0,
     300        'orderby' => 'title',
     301        'order' => 'ASC',
     302        'author' => '',
     303        'cat' => '', //ID
     304        'category__and' => '',
     305        'category__in' => '',
     306        'tag_id' => '', //ID
     307        'tag__and' => '',
     308        'tag__in' => '',
     309        'depth' => 2,
     310        'exclude' => '',
    299311
    300312    );
    301313
    302     $taxonomies = get_taxonomies( array(
    303                     'public'    => true,
    304                     //'_builtin'    => true,
    305                     ) );
    306     foreach( $taxonomies as $tax_name ){
    307         $post_arg_defaults['tax_'.$tax_name] = '';
    308     }
    309 
    310     $post_args = wp_parse_args( $post_args, $post_arg_defaults );
    311 //bellp( $post_args );
     314    $taxonomies = get_taxonomies(array(
     315        'public' => true,
     316        //'_builtin'    => true,
     317    ));
     318    foreach ($taxonomies as $tax_name) {
     319        $post_arg_defaults['tax_' . $tax_name] = '';
     320    }
     321
     322    $post_args = wp_parse_args($post_args, $post_arg_defaults);
     323    //bellp( $post_args );
    312324
    313325    //Inherit current page as parent
    314     if( $post_args['post_parent'] < 0 ){
    315         $post_args['post_parent'] = bellows_get_dynamic_post_parent( $post_args['post_parent'] );
    316     }
    317 //bellp( $post_args );
    318 
    319     foreach( $post_args as $arg_name => $val ){
     326    if ($post_args['post_parent'] < 0) {
     327        $post_args['post_parent'] = bellows_get_dynamic_post_parent($post_args['post_parent']);
     328    }
     329    //bellp( $post_args );
     330
     331    foreach ($post_args as $arg_name => $val) {
    320332
    321333        //Expand taxonomy queries
    322         if( $val && strpos( $arg_name , 'tax_' ) === 0 ){
    323             $tax_id = substr( $arg_name , 4 );
    324             unset( $post_args[$arg_name] );
    325 
    326             if( !isset( $post_args['tax_query'] ) ){
     334        if ($val && strpos($arg_name, 'tax_') === 0) {
     335            $tax_id = substr($arg_name, 4);
     336            unset($post_args[$arg_name]);
     337
     338            if (!isset($post_args['tax_query'])) {
    327339                $post_args['tax_query'] = array();
    328340            }
    329341            $post_args['tax_query'][] = array(
    330                 'taxonomy'  => $tax_id,
    331                 'field'     => 'term_id',
    332                 'terms'     => $val,
     342                'taxonomy' => $tax_id,
     343                'field' => 'term_id',
     344                'terms' => $val,
    333345            );
    334346        }
     
    336348    //bellp( $post_args );
    337349
    338     _BELLOWS()->set_current_config_id( $config_id );
     350    _BELLOWS()->set_current_config_id($config_id);
    339351
    340352
     
    343355    $menu_args['bellows_populate_posts'] = true;
    344356
    345     $menu_args = bellows_get_nav_menu_args( $config_id , $menu_args );
     357    $menu_args = bellows_get_nav_menu_args($config_id, $menu_args);
    346358
    347359    $toggle = bellows_output_responsive_toggle($config_id, $menu_args);
     
    354366    //add_filter( 'wp_get_nav_menu_items' , 'bellows_populate_terms' , 10, 3 );
    355367    //add_filter( 'wp_get_nav_menu_object' , 'bellows_dummy_menu_object' , 10 );
    356     add_filter( 'wp_nav_menu_objects' , 'bellows_populate_posts' , 10, 2 );
    357     $menu = wp_nav_menu( $menu_args );
    358     remove_filter( 'wp_nav_menu_objects' , 'bellows_populate_posts' , 10, 2 );
     368    add_filter('wp_nav_menu_objects', 'bellows_populate_posts', 10, 2);
     369    $menu = wp_nav_menu($menu_args);
     370    remove_filter('wp_nav_menu_objects', 'bellows_populate_posts', 10, 2);
    359371    //remove_filter( 'wp_get_nav_menu_items' , 'bellows_populate_terms' , 10, 3 );
    360372
    361373    //TODO: ECHO OR RETURN CHECK
    362     return $toggle.$menu;
    363 
    364 }
    365 
    366 function bellows_posts_shortcode( $atts, $content = null ){
     374    return $toggle . $menu;
     375
     376}
     377
     378function bellows_posts_shortcode($atts, $content = null)
     379{
    367380
    368381    $post_arg_defaults = array(
    369         'config_id'         => 'main',
    370         'post_type'         => 'page',
    371         'post_parent'       => '',
    372         'include_parent'    => false,
    373         'numberposts'       => -1,
    374         'orderby'           => 'title',
    375         'order'             => 'ASC',
    376         'depth'             => 2,
    377         'exclude'           => '',
     382        'config_id' => 'main',
     383        'post_type' => 'page',
     384        'post_parent' => '',
     385        'include_parent' => false,
     386        'numberposts' => -1,
     387        'orderby' => 'title',
     388        'order' => 'ASC',
     389        'depth' => 2,
     390        'exclude' => '',
    378391    );
    379     $taxonomies = get_taxonomies( array(
    380                     'public'    => true,
    381                     //'_builtin'    => true,
    382                     ) );
    383     foreach( $taxonomies as $tax_name ){
    384         $post_arg_defaults['tax_'.$tax_name] = '';
    385     }
    386 
    387     $post_args = shortcode_atts( $post_arg_defaults , $atts);
    388 
    389     extract( $post_args );
     392    $taxonomies = get_taxonomies(array(
     393        'public' => true,
     394        //'_builtin'    => true,
     395    ));
     396    foreach ($taxonomies as $tax_name) {
     397        $post_arg_defaults['tax_' . $tax_name] = '';
     398    }
     399
     400    $post_args = shortcode_atts($post_arg_defaults, $atts);
     401
     402    extract($post_args);
    390403
    391404    //Menu Arguments
     
    395408
    396409    //Post Query Arguments
    397     unset( $post_args['config_id'] );
     410    unset($post_args['config_id']);
    398411
    399412
    400413    // Handle booleans that are strings
    401     if( $post_args['include_parent'] === 'false' ) $post_args['include_parent'] = false;
    402     else if( $post_args['include_parent'] === 'true'  ) $post_args['include_parent'] = true;
    403 
    404 
    405     return bellows_posts( $config_id , $post_args , $menu_args );
    406 
    407 }
    408 add_shortcode( 'bellows_posts' , 'bellows_posts_shortcode' );
    409 
    410 
    411 
    412 
    413 
    414 function bellows_menu( $query_id , $menu_args = array() ){
    415 
    416     if( !$query_id ){
    417         bellows_admin_notice( 'No Saved Query ID provided, cannot display menu' );
     414    if ($post_args['include_parent'] === 'false')
     415        $post_args['include_parent'] = false;
     416    else if ($post_args['include_parent'] === 'true')
     417        $post_args['include_parent'] = true;
     418
     419
     420    return bellows_posts($config_id, $post_args, $menu_args);
     421
     422}
     423add_shortcode('bellows_posts', 'bellows_posts_shortcode');
     424
     425
     426
     427
     428
     429function bellows_menu($query_id, $menu_args = array())
     430{
     431
     432    if (!$query_id) {
     433        bellows_admin_notice('No Saved Query ID provided, cannot display menu');
    418434        return;
    419435    }
    420436
    421     $query = get_post( $query_id );
    422     if( $query->post_type != 'bellows_query' ){
    423         bellows_admin_notice( 'Post is not a Bellow Query ' . '['.$query_id.'].' );
     437    $query = get_post($query_id);
     438    if (!$query || $query->post_type != 'bellows_query') {
     439        bellows_admin_notice('Post is not a Bellows Query ' . '[' . esc_html($query_id) . '].');
    424440        return;
    425441    }
    426442
    427443
    428     $query_type = get_post_meta( $query_id , 'query_type' , true );
    429     $query_args = get_post_meta( $query_id , 'query_args' , true );
    430 //bellp( $query_args );
     444    $query_type = get_post_meta($query_id, 'query_type', true);
     445    $query_args = get_post_meta($query_id, 'query_args', true);
     446    //bellp( $query_args );
    431447    $config_id = $query_args['config_id'];
    432     unset( $query_args['config_id'] );
    433 
    434     switch( $query_type ){
     448    unset($query_args['config_id']);
     449
     450    switch ($query_type) {
    435451        case 'post':
    436             return bellows_posts( $config_id , $query_args , $menu_args );
     452            return bellows_posts($config_id, $query_args, $menu_args);
    437453            break;
    438454        case 'term':
    439455            //Convert saved string to array if necessary
    440             $taxonomies = explode( ',' , $query_args['taxonomies'] );
    441             foreach( $taxonomies as $key => $tax ){
    442                 $taxonomies[$key] = trim( $tax );
     456            $taxonomies = explode(',', $query_args['taxonomies']);
     457            foreach ($taxonomies as $key => $tax) {
     458                $taxonomies[$key] = trim($tax);
    443459            }
    444460            $query_args['taxonomies'] = $taxonomies;
    445461
    446             return bellows_terms( $config_id , $query_args , $menu_args );
     462            return bellows_terms($config_id, $query_args, $menu_args);
    447463            break;
    448464
     
    453469
    454470}
    455 function bellows_menu_shortcode( $atts , $content = null ){
     471function bellows_menu_shortcode($atts, $content = null)
     472{
    456473    $defaults = array(
    457         'qid'   => 0,
     474        'qid' => 0,
    458475    );
    459     extract( shortcode_atts( $defaults , $atts ) );
    460 
    461     return bellows_menu( $qid , array( 'echo' => false ));
    462 }
    463 add_shortcode( 'bellows_menu' , 'bellows_menu_shortcode' );
     476    extract(shortcode_atts($defaults, $atts));
     477
     478    return bellows_menu($qid, array('echo' => false));
     479}
     480add_shortcode('bellows_menu', 'bellows_menu_shortcode');
  • bellows-accordion-menu/trunk/languages/bellows.pot

    r2986331 r3296646  
    1 # Copyright (C) 2023 SevenSpark
     1# Copyright (C) 2025 SevenSpark
    22# This file is distributed under the same license as the Bellows Pro - Accordion Menu package.
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Bellows Pro - Accordion Menu 1.4.3\n"
     5"Project-Id-Version: Bellows Pro - Accordion Menu 1.4.4\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/bellows-pro\n"
    7 "POT-Creation-Date: 2023-10-30 17:08:51+00:00\n"
     7"POT-Creation-Date: 2025-05-19 16:16:56+00:00\n"
    88"MIME-Version: 1.0\n"
    99"Content-Type: text/plain; charset=utf-8\n"
    1010"Content-Transfer-Encoding: 8bit\n"
    11 "PO-Revision-Date: 2023-MO-DA HO:MI+ZONE\n"
     11"PO-Revision-Date: 2025-MO-DA HO:MI+ZONE\n"
    1212"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    1313"Language-Team: LANGUAGE <[email protected]>\n"
  • bellows-accordion-menu/trunk/readme.txt

    r2986331 r3296646  
    44Tags: menu, navigation, accordion, images, widgets, icons, shortcodes, responsive, expand, toggle, reveal, accordian
    55Requires at least: 5.0
    6 Tested up to: 6.3.2
     6Tested up to: 6.8.1
    77Requires PHP: 7.4
    8 Stable tag: 1.4.3
     8Stable tag: 1.4.4
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5757
    5858== Changelog ==
     59
     60= 1.4.4 =
     61* Security: Fix XSS vulnerability - Authenticated (Contributor+) XSS via shortcode
     62* Fix: Autopopulation Edge case with term autopopulation queries that return result sets that include children but not parents.
    5963
    6064= 1.4.3 =
Note: See TracChangeset for help on using the changeset viewer.