/** * Generate Setting HTML for each shortcode * * @global object $Wr_Pb * @param string $shortcode The current shortcode * @param array $params The shortcode content * @param string $el_title Title of shortcode * @param bool $no_tab * * @return string */ public static function shortcode_modal_settings($shortcode, $params, $el_title = '', $no_tab = false) { $html = ''; // get shortcode class $class = WR_Pb_Helper_Shortcode::get_shortcode_class($shortcode); if (class_exists($class)) { global $Wr_Pb; $settings_html = ''; $elements = $Wr_Pb->get_elements(); $instance = isset($elements['element'][strtolower($class)]) ? $elements['element'][strtolower($class)] : null; if (!is_object($instance)) { $instance = new $class(); } $instance->init_element(); $has_preview = false; // Generate default params if they were not posted. if (empty($params)) { $params = $instance->config['shortcode_structure']; } if (!empty($params)) { $params = str_replace('#_EDITTED', '', $params); $extract_params = WR_Pb_Helper_Shortcode::extract_params($params, $shortcode); // if have sub-shortcode, extract sub shortcodes content if (!empty($instance->config['has_subshortcode'])) { $sub_sc_data = WR_Pb_Helper_Shortcode::extract_sub_shortcode($params, true); $sub_sc_data = apply_filters('wr_pb_sub_items_filter', $sub_sc_data, $shortcode, isset($_COOKIE['wr_pb_data_for_modal']) ? $_COOKIE['wr_pb_data_for_modal'] : ''); $extract_params['sub_items_content'] = $sub_sc_data; } // Set auto title for the subitem if have $extract_title = isset($el_title) && $el_title != __('(Untitled)', WR_PBL) ? $el_title : ''; // MODIFY $instance->items WR_Pb_Helper_Shortcode::generate_shortcode_params($instance->items, NULL, $extract_params, TRUE, FALSE, $extract_title, $has_preview); // if have sub-shortcode, re-generate shortcode structure if (!empty($instance->config['has_subshortcode'])) { $instance->shortcode_data(); } } // get Modal setting box $settings = $instance->items; $settings_html .= WR_Pb_Objects_Modal::get_shortcode_modal_settings($settings, $shortcode, $extract_params, $params, $has_preview, $no_tab); // Add preview if ($has_preview) { $settings_html .= WR_Pb_Helper_Shortcode::render_parameter('preview'); } $html = balanceTags($settings_html); } return $html; }
/** * Print Setting HTML of Pricing Item */ function _modal_footer($shortcode) { $pricing_item = new WR_Item_Pricing_Table(); if ($shortcode == $this->config['shortcode']) { // Create instance of sub shortcode $instance = new $pricing_item->config['has_subshortcode'](); $instance->init_element(); // Get modal settings html $settings_html = WR_Pb_Objects_Modal::get_shortcode_modal_settings($instance->items, $instance->config['shortcode']); // Print html as template script printf("<script type='text/html' id='tmpl-wr-pb-hidden-setting'>\n%s\n</script>\n", balanceTags($settings_html)); } }