function do_binding($response, $data) { $mode = $data['mode']; $value = $data['value']; $id = $data['pageID']; $args = isset($data['args']) ? $data['args'] : array(); global $post; if (isset($args['id'])) { $post = get_post($args['id']); } else { $post = get_post($id); } if ($mode == 'media') { $media_args = array('thumb-size' => $value); $media_args = wp_parse_args($args, $media_args); $response['template'] = pagelines_media($media_args); } elseif ($mode == 'shortcodes') { $response['template'] = stripslashes_deep(do_shortcode($value)); //global $pl_shortcode_engine; //$response['engine'] = array( 'scripts' => $pl_shortcode_engine->scripts, 'styles' => $pl_shortcode_engine->styles ); } elseif ($mode == 'autop') { $response['template'] = do_shortcode(wpautop($value)); } elseif ($mode == 'sidebar') { $response['template'] = pl_draw_sidebar($value); } elseif ($mode == 'menu') { $menu_args = array('menu' => $data['value']); $menu_args = wp_parse_args($args, $menu_args); $response['template'] = pl_nav($menu_args); } else { $response = apply_filters('pl_binding_' . $mode, $response, $data); } return $response; }
function pl_dynamic_nav($config = array()) { $defaults = array('key' => '', 'menu' => '', 'menu_class' => '', 'wrap_class' => '', 'default' => true, 'binds' => ''); $config = wp_parse_args($config, $defaults); $wrap_classes = sprintf('pl-nav-container %s', $config['wrap_class']); $binds = 'plnav:' . $config['key']; $binds .= '' != $config['binds'] ? ',' . $config['binds'] : ''; ?> <div class="<?php echo $wrap_classes; ?> " data-bind="<?php echo $binds; ?> " data-class="<?php echo $config['menu_class']; ?> " data-default="<?php echo $config['default']; ?> " > <?php echo pl_nav($config); ?> </div> <?php }