/** * Merge new style params to existed shortcode content * * @return type */ function merge_style_params() { if (!isset($_POST[IGNONCE]) || !wp_verify_nonce($_POST[IGNONCE], IGNONCE)) { return; } $shortcode_name = $_POST['shortcode_name']; $structure = str_replace("\\", "", $_POST['content']); $alter_structure = str_replace("\\", "", $_POST['new_style_content']); // Extract params of current element $params = IG_Pb_Helper_Shortcode::extract_params($structure, $shortcode_name); // Extract styling params of copied element $alter_params = IG_Pb_Helper_Shortcode::get_styling_atts($shortcode_name, $alter_structure); // Alter params of current element by copied element's params if (count($alter_params)) { foreach ($alter_params as $k => $v) { $params[$k] = $v; } } $_shortcode_content = ''; // Exclude shortcode_content from param list if (isset($params['_shortcode_content'])) { $_shortcode_content = $params['_shortcode_content']; unset($params['_shortcode_content']); } $new_shortcode_structure = IG_Pb_Helper_Shortcode::join_params($params, $shortcode_name, $_shortcode_content); // Print out new shortcode structure. echo $new_shortcode_structure; exit; }