protected function singleParamEditForm($param, $param_value) { $param_line = ''; // Textfield - input if ($param['type'] == 'textfield') { $value = __($param_value, "swift-framework-admin"); $value = $param_value; $param_line .= '<input name="' . $param['param_name'] . '" class="spb_param_value spb-textinput ' . $param['param_name'] . ' ' . $param['type'] . '" type="text" value="' . $value . '" />'; } else { if ($param['type'] == 'colorpicker') { $value = __($param_value, "swift-framework-admin"); $value = $param_value; $param_line .= '<input name="' . $param['param_name'] . '" class="spb_param_value spb-colorpicker ' . $param['param_name'] . ' ' . $param['type'] . '" type="text" value="' . $value . '" maxlength="6" size"6" />'; } else { if ($param['type'] == 'uislider') { $value = __($param_value, "swift-framework-admin"); $value = $param_value; $min = isset($param['min']) ? $param['min'] : 0; $max = isset($param['max']) ? $param['max'] : 800; $step = isset($param['step']) ? $param['step'] : 5; $param_line .= '<div class="noUiSlider"></div><input name="' . $param['param_name'] . '" class="spb_param_value spb-uislider ' . $param['param_name'] . ' ' . $param['type'] . '" type="text" value="' . $value . '" maxlength="6" size"6" data-min="' . $min . '" data-max="' . $max . '" data-step="' . $step . '" />'; } else { if ($param['type'] == 'dropdown') { $param_line .= '<select name="' . $param['param_name'] . '" class="spb_param_value spb-input spb-select ' . $param['param_name'] . ' ' . $param['type'] . '">'; foreach ($param['value'] as $text_val => $val) { if (is_numeric($text_val) && is_string($val) || is_numeric($text_val) && is_numeric($val)) { $text_val = $val; } $text_val = __($text_val, "swift-framework-admin"); $val = strtolower(str_replace(array(" "), array("_"), $val)); $selected = ''; if ($val == $param_value) { $selected = ' selected="selected"'; } $param_line .= '<option class="' . $val . '" value="' . $val . '"' . $selected . '>' . $text_val . '</option>'; } $param_line .= '</select>'; } else { if ($param['type'] == 'select-multiple') { $param_line .= '<select name="' . $param['param_name'] . '" class="spb_param_value spb-checkboxes ' . $param['param_name'] . ' ' . $param['type'] . '" type="hidden" value="" name="" multiple>'; $selected_values = explode(",", $param_value); foreach ($param['value'] as $text_val => $val) { if (is_numeric($text_val) && is_string($val) || is_numeric($text_val) && is_numeric($val)) { $text_val = $val; } $text_val = __($text_val, "swift-framework-admin"); $selected = ''; if (in_array($val, $selected_values)) { $selected = ' selected="selected"'; } $param_line .= '<option id="' . $text_val . '" value="' . $val . '"' . $selected . '>' . $text_val . '</option>'; } $param_line .= '</select>'; } else { if ($param['type'] == 'textarea_html') { $param_line .= $this->getTinyHtmlTextArea($param, $param_value); } else { if ($param['type'] == 'posttypes') { $param_line .= '<input class="spb_param_value spb-checkboxes" type="hidden" value="" name="" />'; $args = array('public' => true); $post_types = get_post_types($args); foreach ($post_types as $post_type) { $checked = ""; if ($post_type != 'attachment') { if (in_array($post_type, explode(",", $param_value))) { $checked = ' checked="checked"'; } $param_line .= ' <input id="' . $post_type . '" class="' . $param['param_name'] . ' ' . $param['type'] . '" type="checkbox" name="' . $param['param_name'] . '"' . $checked . '> ' . $post_type; } } } else { if ($param['type'] == 'exploded_textarea') { $param_value = str_replace(",", "\n", $param_value); $param_line .= '<textarea name="' . $param['param_name'] . '" class="spb_param_value spb-textarea ' . $param['param_name'] . ' ' . $param['type'] . '">' . $param_value . '</textarea>'; } else { if ($param['type'] == 'textarea_raw_html') { // $param_value = __($param_value, "swift-framework-admin"); $param_line .= '<textarea name="' . $param['param_name'] . '" class="spb_param_value spb-textarea_raw_html ' . $param['param_name'] . ' ' . $param['type'] . '" rows="16">' . htmlentities(rawurldecode(base64_decode($param_value)), ENT_COMPAT, 'UTF-8') . '</textarea>'; } else { if ($param['type'] == 'textarea') { $param_value = __($param_value, "swift-framework-admin"); $param_line .= '<textarea name="' . $param['param_name'] . '" class="spb_param_value spb-textarea ' . $param['param_name'] . ' ' . $param['type'] . '">' . $param_value . '</textarea>'; } else { if ($param['type'] == 'attach_images') { // TODO: More native way $param_value = spb_removeNotExistingImgIDs($param_value); $param_line .= '<input type="hidden" class="spb_param_value gallery_widget_attached_images_ids ' . $param['param_name'] . ' ' . $param['type'] . '" name="' . $param['param_name'] . '" value="' . $param_value . '" />'; $param_line .= '<a class="button gallery_widget_add_images" href="#" title="' . __('Add images', "swift-framework-admin") . '">' . __('Add images', "swift-framework-admin") . '</a>'; $param_line .= '<div class="gallery_widget_attached_images">'; $param_line .= '<ul class="gallery_widget_attached_images_list">'; $param_line .= $param_value != '' ? spb_fieldAttachedImages(explode(",", $param_value)) : ''; $param_line .= '</ul>'; $param_line .= '</div>'; $param_line .= '<div class="spb_clear"></div>'; } else { if ($param['type'] == 'attach_image') { // TODO: More native way $param_value = spb_removeNotExistingImgIDs(preg_replace('/[^\\d]/', '', $param_value)); $param_line .= '<input type="hidden" class="spb_param_value gallery_widget_attached_images_ids ' . $param['param_name'] . ' ' . $param['type'] . '" name="' . $param['param_name'] . '" value="' . $param_value . '" />'; $param_line .= '<a class="button gallery_widget_add_images" href="#" use-single="true" title="' . __('Add image', "swift-framework-admin") . '" data-uploader_title="' . __('Add image', "swift-framework-admin") . '">' . __('Add image', "swift-framework-admin") . '</a>'; $param_line .= '<div class="gallery_widget_attached_images">'; $param_line .= '<ul class="gallery_widget_attached_images_list">'; $param_line .= $param_value != '' ? spb_fieldAttachedImages(explode(",", $param_value)) : ''; $param_line .= '</ul>'; $param_line .= '</div>'; $param_line .= '<div class="spb_clear"></div>'; } else { if ($param['type'] == 'widgetised_sidebars') { $spb_sidebar_ids = array(); $sidebars = $GLOBALS['wp_registered_sidebars']; $param_line .= '<select name="' . $param['param_name'] . '" class="spb_param_value dropdown spb-input spb-select ' . $param['param_name'] . ' ' . $param['type'] . '">'; foreach ($sidebars as $sidebar) { $selected = ''; if ($sidebar["id"] == $param_value) { $selected = ' selected="selected"'; } $sidebar_name = __($sidebar["name"], "swift-framework-admin"); $param_line .= '<option value="' . $sidebar["id"] . '"' . $selected . '>' . $sidebar_name . '</option>'; } $param_line .= '</select>'; } else { if ($param['type'] == 'altbg_preview') { $param_line .= '<div class="altbg-preview"><p>Alt Background Preview</p></div>'; } else { if ($param['type'] == 'icon-picker') { $value = __($param_value, "swift-framework-admin"); $value = $param_value; $param_line .= '<input name="' . $param['param_name'] . '" class="spb_param_value icon-picker ' . $param['param_name'] . ' ' . $param['type'] . '" type="text" value="' . $value . '" style="visibility: hidden;height: 0;" /><ul class="font-icon-grid">' . sf_icon_list() . '</ul>'; } } } } } } } } } } } } } } } return $param_line; }
protected function singleParamEditForm($param, $param_value) { $param_line = ''; // Textfield - input if ($param['type'] == 'textfield') { $value = __($param_value, 'swiftframework'); $value = $param_value; if ($param['param_name'] == 'address' && $param_value == __('Click the edit button to change the map pin details.', 'swiftframework')) { $param_line .= '<input name="' . $param['param_name'] . '" class="spb_param_value spb-textinput ' . $param['param_name'] . ' ' . $param['type'] . '" type="text" value="" data-previous-text="' . __('Click the edit button to change the map pin details.', 'swiftframework') . '"/>'; } else { $param_line .= '<input name="' . $param['param_name'] . '" class="spb_param_value spb-textinput ' . $param['param_name'] . ' ' . $param['type'] . '" type="text" value="' . $value . '" />'; } } else { if ($param['type'] == 'colorpicker') { $value = __($param_value, 'swiftframework'); $value = $param_value; $param_line .= '<input name="' . $param['param_name'] . '" class="spb_param_value spb-colorpicker ' . $param['param_name'] . ' ' . $param['type'] . '" type="text" value="' . $value . '" maxlength="6" size"6" />'; } else { if ($param['type'] == 'uislider') { $value = $param_value; $min = isset($param['min']) ? $param['min'] : 0; $max = isset($param['max']) ? $param['max'] : 800; $step = isset($param['step']) ? $param['step'] : 5; $param_line .= '<div class="noUiSlider"></div><input name="' . $param['param_name'] . '" class="spb_param_value spb-uislider ' . $param['param_name'] . ' ' . $param['type'] . '" type="text" value="' . $value . '" maxlength="6" size"6" data-min="' . $min . '" data-max="' . $max . '" data-step="' . $step . '" />'; } else { if ($param['type'] == 'buttonset') { $param_line .= '<fieldset id="' . $param['param_name'] . '" class="spb-buttonset">'; $param_line .= '<input name="' . $param['param_name'] . '" class="spb_param_value ' . $param['param_name'] . ' ' . $param['type'] . '" value="' . $param_value . '" type="hidden" />'; foreach ($param['value'] as $text_val => $val) { $text_val = __($text_val, 'swiftframework'); $checked = ''; if ($val == $param_value) { $checked = 'checked="checked"'; } $id = $param['param_name'] . '-' . $val; $param_line .= '<input type="radio" name="' . $param['param_name'] . '" id="' . $id . '" data-id="' . $val . '" class="buttonset-item ui-helper-hidden-accessible" ' . $checked . '></input>'; $param_line .= '<label for="' . $id . '" class="ui-button ui-widget"><span class="ui-button-text">' . $text_val . '</span></label>'; } $param_line .= '</fieldset>'; } else { if ($param['type'] == 'dropdown') { $default = $param_value; if (isset($param['std'])) { $default = $param['std']; } $param_line .= '<select name="' . $param['param_name'] . '" class="spb_param_value spb-input spb-select ' . $param['param_name'] . ' ' . $param['type'] . '" data-default="' . $default . '">'; foreach ($param['value'] as $text_val => $val) { if (is_numeric($text_val) && is_string($val) || is_numeric($text_val) && is_numeric($val)) { $text_val = $val; } $text_val = __($text_val, 'swiftframework'); //$val = strtolower( str_replace( array( " " ), array( "_" ), $val ) ); $val = str_replace(array(" "), array("_"), $val); $selected = ''; if ($val == $param_value) { $selected = ' selected="selected"'; } $param_line .= '<option class="' . $val . '" value="' . $val . '"' . $selected . '>' . $text_val . '</option>'; } $param_line .= '</select>'; } else { if ($param['type'] == 'dropdown-id') { $param_line .= '<select name="' . $param['param_name'] . '" class="spb_param_value spb-input spb-select ' . $param['param_name'] . ' ' . $param['type'] . '">'; foreach ($param['value'] as $val => $text_val) { $text_val = __($text_val, 'swiftframework'); $selected = ''; if ($val == $param_value) { $selected = ' selected="selected"'; } $param_line .= '<option class="' . $val . '" value="' . $val . '"' . $selected . '>' . $text_val . '</option>'; } $param_line .= '</select>'; } else { if ($param['type'] == 'select-multiple') { $param_line .= '<select multiple name="' . $param['param_name'] . '" class="spb_param_value spb-select ' . $param['param_name'] . ' ' . $param['type'] . '" type="hidden" value="" name="" multiple>'; $selected_values = explode(",", $param_value); foreach ($param['value'] as $text_val => $val) { if (is_numeric($text_val) && is_string($val) || is_numeric($text_val) && is_numeric($val)) { $text_val = $val; } $text_val = __($text_val, 'swiftframework'); $selected = ''; if (in_array($val, $selected_values)) { $selected = ' selected="selected"'; } $param_line .= '<option id="' . $text_val . '" value="' . $val . '"' . $selected . '>' . $text_val . '</option>'; } $param_line .= '</select>'; } else { if ($param['type'] == 'select-multiple-id') { $param_line .= '<select multiple name="' . $param['param_name'] . '" class="spb_param_value spb-select ' . $param['param_name'] . ' ' . $param['type'] . '" type="hidden" value="" name="" multiple>'; $selected_values = explode(",", $param_value); foreach ($param['value'] as $val => $text_val) { $text_val = __($text_val, 'swiftframework'); $selected = ''; if (in_array($val, $selected_values)) { $selected = ' selected="selected"'; } $param_line .= '<option id="' . $val . '" value="' . $val . '"' . $selected . '>' . $text_val . '</option>'; } $param_line .= '</select>'; } else { if ($param['type'] == 'textarea_encoded') { $param_value = htmlentities(rawurldecode(base64_decode($param_value)), ENT_COMPAT, 'UTF-8'); $param_line .= '<textarea name="' . $param['param_name'] . '" class="spb_param_value spb-textarea spb-encoded-textarea ' . $param['param_name'] . ' ' . $param['type'] . '">' . $param_value . '</textarea>'; } else { if ($param['type'] == 'textarea_html') { $param_line .= $this->getTinyHtmlTextArea($param, $param_value); } else { if ($param['type'] == 'posttypes') { $param_line .= '<input class="spb_param_value spb-checkboxes" type="hidden" value="" name="" />'; $args = array('public' => true); $post_types = get_post_types($args); foreach ($post_types as $post_type) { $checked = ""; if ($post_type != 'attachment') { if (in_array($post_type, explode(",", $param_value))) { $checked = ' checked="checked"'; } $param_line .= ' <input id="' . $post_type . '" class="' . $param['param_name'] . ' ' . $param['type'] . '" type="checkbox" name="' . $param['param_name'] . '"' . $checked . '> ' . $post_type; } } } else { if ($param['type'] == 'exploded_textarea') { $param_value = str_replace(",", "\n", $param_value); $param_line .= '<textarea name="' . $param['param_name'] . '" class="spb_param_value spb-textarea ' . $param['param_name'] . ' ' . $param['type'] . '">' . $param_value . '</textarea>'; } else { if ($param['type'] == 'textarea_raw_html') { // $param_value = __($param_value, 'swiftframework'); $param_line .= '<textarea name="' . $param['param_name'] . '" class="spb_param_value spb-textarea_raw_html ' . $param['param_name'] . ' ' . $param['type'] . '" rows="16">' . htmlentities(rawurldecode(base64_decode($param_value)), ENT_COMPAT, 'UTF-8') . '</textarea>'; } else { if ($param['type'] == 'textarea') { $param_value = __($param_value, 'swiftframework'); $param_line .= '<textarea name="' . $param['param_name'] . '" class="spb_param_value spb-textarea ' . $param['param_name'] . ' ' . $param['type'] . '">' . $param_value . '</textarea>'; } else { if ($param['type'] == 'attach_images') { // TODO: More native way $param_value = spb_removeNotExistingImgIDs($param_value); $param_line .= '<input type="hidden" class="spb_param_value gallery_widget_attached_images_ids ' . $param['param_name'] . ' ' . $param['type'] . '" name="' . $param['param_name'] . '" value="' . $param_value . '" />'; $param_line .= '<a class="button gallery_widget_add_images" href="#" title="' . __('Add images', 'swiftframework') . '">' . __('Add images', 'swiftframework') . '</a>'; $param_line .= '<div class="gallery_widget_attached_images">'; $param_line .= '<ul class="gallery_widget_attached_images_list">'; $param_line .= $param_value != '' ? spb_fieldAttachedImages(explode(",", $param_value)) : ''; $param_line .= '</ul>'; $param_line .= '</div>'; $param_line .= '<div class="spb_clear"></div>'; } else { if ($param['type'] == 'attach_image') { // TODO: More native way $param_value = spb_removeNotExistingImgIDs(preg_replace('/[^\\d]/', '', $param_value)); $param_line .= '<input type="hidden" class="spb_param_value gallery_widget_attached_images_ids ' . $param['param_name'] . ' ' . $param['type'] . '" name="' . $param['param_name'] . '" value="' . $param_value . '" />'; $param_line .= '<a class="button gallery_widget_add_images" href="#" use-single="true" title="' . __('Add image', 'swiftframework') . '" data-uploader_title="' . __('Add image', 'swiftframework') . '">' . __('Add image', 'swiftframework') . '</a>'; $param_line .= '<div class="gallery_widget_attached_images">'; $param_line .= '<ul class="gallery_widget_attached_images_list">'; $param_line .= $param_value != '' ? spb_fieldAttachedImages(explode(",", $param_value)) : ''; $param_line .= '</ul>'; $param_line .= '</div>'; $param_line .= '<div class="spb_clear"></div>'; } else { if ($param['type'] == 'widgetised_sidebars') { $spb_sidebar_ids = array(); $sidebars = $GLOBALS['wp_registered_sidebars']; $param_line .= '<select name="' . $param['param_name'] . '" class="spb_param_value dropdown spb-input spb-select ' . $param['param_name'] . ' ' . $param['type'] . '">'; foreach ($sidebars as $sidebar) { $selected = ''; if ($sidebar["id"] == $param_value) { $selected = ' selected="selected"'; } $sidebar_name = __($sidebar["name"], 'swiftframework'); $param_line .= '<option value="' . $sidebar["id"] . '"' . $selected . '>' . $sidebar_name . '</option>'; } $param_line .= '</select>'; } else { if ($param['type'] == 'icon-picker') { $value = __($param_value, 'swiftframework'); $value = $param_value; $param_line .= '<div class="span9 edit_form_line"><input type="text" class="search-icon-grid textfield" placeholder="Search Icon"></div><input name="' . $param['param_name'] . '" class="spb_param_value icon-picker ' . $param['param_name'] . ' ' . $param['type'] . '" type="text" value="' . $value . '" style="visibility: hidden;height: 0;" /><ul class="font-icon-grid">' . sf_get_icons_list() . '</ul>'; } } } } } } } } } } } } } } } } } } return $param_line; }
protected function singleParamEditForm($param, $param_value) { $param_line = ''; $max_ocurrences = 0; // Textfield - input if (isset($param['param_type']) && $param['param_type'] == 'repeater') { //Icon Box Grid Repeater fields if ($param['master'] == 'spb_icon_box_grid') { $value = $param_value; $max_ocurrences = substr_count($value, '[spb_icon_box_grid_element'); $param_line .= '<ul class="icon_section_holder spb_param_value">'; for ($i = 1; $i <= $max_ocurrences; $i++) { $shortcode_ini_pos = strpos($value, '[spb_icon_box_grid_element'); $shortcode_end_pos = strpos($value, '[/spb_icon_box_grid_element]'); //Title $title_ini_pos = strpos($value, 'title="'); $title_end_pos = strpos(substr($value, $title_ini_pos + 7), '"'); $title = substr($value, $title_ini_pos + 7, $title_end_pos); //Link $link_ini_pos = strpos($value, 'link="'); $link_end_pos = strpos(substr($value, $link_ini_pos + 6), '"'); $link = substr($value, $link_ini_pos + 6, $link_end_pos); //Icon $icon_ini_pos = strpos($value, 'icon="'); $icon_end_pos = strpos(substr($value, $icon_ini_pos + 6), '"'); $icon = substr($value, $icon_ini_pos + 6, $icon_end_pos); //Target $target_ini_pos = strpos($value, 'target="'); $target_end_pos = strpos(substr($value, $target_ini_pos + 8), '"'); $target = substr($value, $target_ini_pos + 8, $target_end_pos); //Remove the processed shortcode from the string $value = substr($value, $shortcode_end_pos + 28); $selected_blank = $selected_self = ""; if ($target == '_blank') { $selected_blank = 'selected'; } else { $selected_self = 'selected'; } $param_line .= '<li><div class="section_repeater"><div class="left_section"><div class="section_icon_image"><i class="' . $icon . '"></i></div><a href="#" class="section_add_icon"><span class="icon-add"></span></a></div><div class="right_section"><div class="right_top_section">'; $param_line .= '<input name="icon_title_' . $i . '" id="icon_title_' . $i . '" class="textfield validate active icon_title " placeholder="' . __('Icon Box Title', 'swift-framework-plugin') . ' " type="text" value="' . $title . '" /><span class="icon-drag-handle"></span><span class="icon-delete"></span></div>'; $param_line .= '<div class="right_bottom_section"><input name="icon_link_' . $i . '" id="icon_link_' . $i . '" class="textfield validate active icon_link " placeholder="' . __('Icon Box Link', 'swift-framework-plugin') . ' " type="text" value="' . $link . '" />'; $param_line .= '<select id="select_section_' . $i . '" class="icon_target"><option value="_self" ' . $selected_self . '>Same Window</option><option value="_blank" ' . $selected_blank . '>New Window</option></select></div>'; $param_line .= '</div><ul class="font-icon-grid repeater-grid svg-grid">' . spb_get_svg_icons() . '</ul></div></li>'; } if ($max_ocurrences <= 0) { $i = 1; $param_line .= '<li><div class="section_repeater"><div class="left_section"><div class="section_icon_image" style="display:none;"></div><a href="#" class="section_add_icon"><span class="icon-add"></span></a></div><div class="right_section"><div class="right_top_section">'; $param_line .= '<input name="icon_title_' . $i . '" id="icon_title_' . $i . '" class="textfield validate active icon_title " placeholder="' . __('Icon Box Title', 'swift-framework-plugin') . ' " type="text" value="" /><span class="icon-drag-handle"></span><span class="icon-delete"></span></div>'; $param_line .= '<div class="right_bottom_section"><input name="icon_link_' . $i . '" id="icon_link_' . $i . '" class="textfield validate active icon_link " placeholder="' . __('Icon Box Link', 'swift-framework-plugin') . ' " type="text" value="" />'; $param_line .= '<select id="select_section_' . $i . '" class="icon_target"><option value="_self" selected>Same Window</option><option value="_blank">New Window</option></select></div>'; $param_line .= '</div><ul class="font-icon-grid repeater-grid svg-grid">' . spb_get_svg_icons() . '</ul></div></li>'; } $param_line .= '<div class="bottom_action"><a href="#" class="spb_add_new_icon_section">' . __('Add section', 'swift-framework-plugin') . '</a></div></ul>'; } //Pricing table Repeater fields if ($param['master'] == 'spb_pricing_table') { $param_feature_line = $max_ocurrences_features = ''; $value = $param_value; $max_ocurrences = substr_count($value, '[/spb_pricing_column]'); $param_line .= '<ul class="collapsible popout pricing_column_holder spb_param_value ' . $max_ocurrences . '" data-collapsible="accordion">'; for ($i = 1; $i <= $max_ocurrences; $i++) { $shortcode_end_pos = strpos($value, '[/spb_pricing_column]'); $content_ini_pos = strpos($value, ']'); $column_content = substr($value, $content_ini_pos + 1); // Get Column Name $stored_value = $value; $name = $this->extractRepeaterFields('name', $value); //Remove the processed shortcode from the string $value = substr($value, $shortcode_end_pos + 21); $featured_end_pos = strpos($column_content, '[/spb_pricing_column]'); $max_ocurrences_features = substr_count(substr($column_content, 0, $featured_end_pos), '[spb_pricing_column_feature'); if ($max_ocurrences_features > 0) { $param_feature_line = ''; $param_feature_line .= '<ul class="collapsible popout pricing_column_feature_holder ' . $max_ocurrences_features . '" data-collapsible="accordion">'; } for ($z = 1; $z <= $max_ocurrences_features; $z++) { $feature_end_pos = strpos($column_content, '[/spb_pricing_column_feature]'); $param_feature_line .= $this->getPricingTableFeatureField($z, $column_content); //Remove the processed shortcode from the string $column_content = substr($column_content, $feature_end_pos + strlen('[/spb_pricing_column_feature]')); } if ($max_ocurrences_features > 0) { $param_feature_line .= '</ul><div class="bottom_action"><a href="#" class="spb_add_new_column_feature">' . __('Add Feature', 'swift-framework-plugin') . '</a></div>'; } $param_line .= '<li><div class="collapsible-header">' . $name . '<div class="pricing_col_actions"><span class="icon-drag-handle"></span><span class="icon-delete"></span></div></div><div class="collapsible-body">'; $param_line .= '<div class="section_repeater">'; $param_line .= $this->getPricingTableColumn($i, $param_feature_line, $stored_value); $param_line .= '</div></div></li>'; } if ($max_ocurrences_features <= 0) { $j = 1; $param_feature_line = '<ul class="collapsible popout pricing_column_feature_holder" data-collapsible="accordion">'; $param_feature_line .= $this->getPricingTableFeatureField($j); $param_feature_line .= '</ul>'; $param_feature_line .= '<div class="bottom_action"><a href="#" class="spb_add_new_column_feature">' . __('Add Feature', 'swift-framework-plugin') . '</a></div>'; } if ($max_ocurrences <= 0) { $i = 1; $param_line .= '<li><div class="collapsible-header">' . __('Plan Name', 'swift-framework-plugin') . '<div class="pricing_col_actions"><span class="icon-drag-handle"></span><span class="icon-delete"></span></div></div><div class="collapsible-body">'; $param_line .= '<div class="section_repeater">'; $param_line .= $this->getPricingTableColumn($i, $param_feature_line); $param_line .= '</div></li>'; } $param_line .= '<div class="bottom_action"><a href="#" class="spb_add_new_pricing_column">' . __('Add column', 'swift-framework-plugin') . '</a></div></ul>'; } //Pricing table Features Rows Repeater fields if ($param['master'] == 'spb_pricing_column') { $value = $param_value; $max_ocurrences = substr_count($value, '[spb_pricing_column_feature'); $param_line .= '<ul class="collapsible popout pricing_column_holder spb_param_value" data-collapsible="accordion">'; for ($i = 1; $i <= $max_ocurrences; $i++) { $shortcode_ini_pos = strpos($value, '[spb_pricing_column_feature'); $shortcode_end_pos = strpos($value, '[/spb_pricing_column_feature]'); //Remove the processed shortcode from the string $stored_value = $value; $value = substr($value, $shortcode_end_pos + strlen('[/spb_pricing_column_feature]')); $param_line .= '<li><div class="collapsible-header">' . $name . '<div class="pricing_col_actions"><span class="icon-drag-handle"></span><span class="icon-delete"></span></div></div><div class="collapsible-body">'; $param_line .= '<div class="section_repeater">'; $param_line .= $this->getPricingTableColumn($i, $featureField, $stored_value); $param_line .= '</div></div></li>'; } if ($max_ocurrences <= 0) { $i = 1; $param_line .= '<li><div class="section_repeater"><div class="pricing_col_actions"><span class="icon-drag-handle"></span><span class="icon-delete"></span></div>'; $param_line .= $this->getPricingTableColumn($i, $featureField); $param_line .= '</div></li>'; } $param_line .= '<div class="bottom_action"><a href="#" class="spb_add_new_pricing_column">' . __('Add column', 'swift-framework-plugin') . '</a></div></ul>'; } } else { if (isset($param['param_type']) && $param['param_type'] == 'css-field') { $margin = "0"; $border = "0"; $padding = "0"; $mt = $this->extractCssFields('margin-top', $param_value); $mb = $this->extractCssFields('margin-bottom', $param_value); $bt = $this->extractCssFields('border-top', $param_value); $bl = $this->extractCssFields('border-left', $param_value); $br = $this->extractCssFields('border-right', $param_value); $bb = $this->extractCssFields('border-bottom', $param_value); $pt = $this->extractCssFields('padding-top', $param_value); $pl = $this->extractCssFields('padding-left', $param_value); $pr = $this->extractCssFields('padding-right', $param_value); $pb = $this->extractCssFields('padding-bottom', $param_value); if ($mt == $mb) { $margin = $mt; } if ($bt == $bl && $bl == $br && $br == $bb) { $border = $bt; } if ($pt == $pl && $pl == $pr && $pr == $pb) { $padding = $pt; } $param_line .= '<div class="css-detailed-controls">'; $param_line .= '<input name="' . $param['param_name'] . '" class="spb_param_value spb-textinput ' . $param['param_name'] . ' ' . $param['type'] . '" type="hidden" value="' . $param_value . '" />'; //Padding $param_line .= '<div class="css-top-label">' . __('Padding Top', 'swift-framework-plugin') . '</div>'; $param_line .= '<div class="css-top-label">' . __('Padding Left', 'swift-framework-plugin') . '</div>'; $param_line .= '<div class="css-top-label">' . __('Padding Right', 'swift-framework-plugin') . '</div>'; $param_line .= '<div class="css-top-label">' . __('Padding Bottom', 'swift-framework-plugin') . '</div>'; $param_line .= '<input name="custom-padding-top" class="spb-textinput cp-global custom-padding-top ' . $param['type'] . '" type="text" value="' . $pt . '" />'; $param_line .= '<input name="custom-padding-left" class="spb-textinput cp-global custom-padding-left ' . $param['type'] . '" type="text" value="' . $pl . '" />'; $param_line .= '<input name="custom-padding-right" class="spb-textinput cp-global custom-padding-right ' . $param['type'] . '" type="text" value="' . $pr . '" />'; $param_line .= '<input name="custom-padding-bottom" class="spb-textinput cp-global custom-padding-bottom ' . $param['type'] . '" type="text" value="' . $pb . '" />'; // Border $param_line .= '<div class="css-top-label">' . __('Border Top', 'swift-framework-plugin') . '</div>'; $param_line .= '<div class="css-top-label">' . __('Border Left', 'swift-framework-plugin') . '</div>'; $param_line .= '<div class="css-top-label">' . __('Border Right', 'swift-framework-plugin') . '</div>'; $param_line .= '<div class="css-top-label">' . __('Border Bottom', 'swift-framework-plugin') . '</div>'; $param_line .= '<input name="custom-border-top" class="spb-textinput cb-global custom-border-top ' . $param['type'] . '" type="text" value="' . $bt . '" />'; $param_line .= '<input name="custom-border-left" class="spb-textinput cb-global custom-border-left ' . $param['type'] . '" type="text" value="' . $bl . '" />'; $param_line .= '<input name="custom-border-right" class="spb-textinput cb-global custom-border-right ' . $param['type'] . '" type="text" value="' . $br . '" />'; $param_line .= '<input name="custom-border-bottom" class="spb-textinput cb-global custom-border-bottom ' . $param['type'] . '" type="text" value="' . $bb . '" />'; //Margin $param_line .= '<div class="css-top-label">' . __('Margin Top', 'swift-framework-plugin') . '</div>'; $param_line .= '<div class="css-top-label">' . __('Margin Bottom', 'swift-framework-plugin') . '</div>'; $param_line .= '<input name="custom-margin-top" class="spb-textinput cm-global custom-margin-top ' . $param['type'] . '" type="text" value="' . $mt . '" />'; $param_line .= '<input name="custom-margin-bottom" class="spb-textinput cm-global custom-margin-bottom ' . $param['type'] . '" type="text" value="' . $mb . '" />'; $param_line .= '</div>'; } else { if ($param['type'] == 'textfield') { $value = __($param_value, 'swift-framework-plugin'); $value = $param_value; $active_input = ''; if ($value != '') { $active_input = 'class="active"'; } if ($param['param_name'] == 'address' && $param_value == __('Click the edit button to change the map pin details.', 'swift-framework-plugin')) { $param_line .= '<input name="' . $param['param_name'] . '" class="textfield spb_param_value spb-textinput ' . $param['param_name'] . ' ' . $param['type'] . '" type="text" value="" data-previous-text="' . __('Click the edit button to change the map pin details.', 'swift-framework-plugin') . '"/>'; } else { $param_line .= '<div class="input-field col s12"><input name="' . $param['param_name'] . '" id="' . $param['param_name'] . '" class="textfield validate active spb_param_value " type="text" value="' . $value . '" />'; $param_line .= '<label for="' . $param['param_name'] . '" ' . $active_input . '>' . $param['heading'] . '</label></div>'; } // Textfield - input } else { if ($param['type'] == 'textfield_html') { $value = __($param_value, 'swift-framework-plugin'); $param_value = htmlentities($param_value); $param_line .= '<input name="' . $param['param_name'] . '" class="spb_param_value spb-textinput ' . $param['param_name'] . ' ' . $param['type'] . '" type="text" value="' . $value . '" />'; } else { if ($param['type'] == 'colorpicker') { $value = __($param_value, 'swift-framework-plugin'); $value = $param_value; $param_line .= '<input name="' . $param['param_name'] . '" class="spb_param_value spb-colorpicker ' . $param['param_name'] . ' ' . $param['type'] . '" type="text" value="' . $value . '" maxlength="6" size"6" />'; } else { if ($param['type'] == 'uislider2') { $value = $param_value; $min = isset($param['min']) ? $param['min'] : 0; $max = isset($param['max']) ? $param['max'] : 800; $step = isset($param['step']) ? $param['step'] : 5; $param_line .= '<div class="noUiSlider"></div><input name="' . $param['param_name'] . '" class="spb_param_value spb-uislider ' . $param['param_name'] . ' ' . $param['type'] . '" type="text" value="' . $value . '" maxlength="6" size"6" data-min="' . $min . '" data-max="' . $max . '" data-step="' . $step . '" />'; } else { if ($param['type'] == 'uislider') { $value = $param_value; $min = isset($param['min']) ? $param['min'] : 0; $max = isset($param['max']) ? $param['max'] : 800; $step = isset($param['step']) ? $param['step'] : 5; if ($value != '') { $active_input = 'class="active"'; } $param_line .= '<form action="#"><p class="range-field"> <span class="ui_slider_track_filled" style="width:' . $value / $max * 100 . '%"></span> <input type="range" class="spb_param_value uislider" id="' . $param['param_name'] . '" name="' . $param['param_name'] . '" min="' . $min . '" max="' . $max . '" value="' . $value . '" step="' . $step . '"/> <div class="input-field lb_slider_input"><input name="' . $param['param_name'] . '_val" id="' . $param['param_name'] . '_val" min="' . $min . '" max="' . $max . '" class="validate active spb_param_value uisliderinput " type="text" value="' . $value . '" /></div>'; } else { if ($param['type'] == 'buttonset') { $param_value_off = $param_value_on = $checked = $buttonset_on = ''; foreach ($param['value'] as $text_val => $val) { $text_val = __($text_val, 'swift-framework-plugin'); if (isset($param['buttonset_on'])) { $buttonset_on = $param['buttonset_on']; } else { $buttonset_on = 'yes'; } if ($buttonset_on == $val) { $param_value_on = $val; } else { $param_value_off = $val; } $id = $param['param_name']; } if ($param_value == $param_value_on) { $checked = 'checked="checked"'; } $param_line .= '<div class="switch"><label><input type="checkbox" class="spb_param_value ' . $param_value . ' ' . $param['param_name'] . ' ' . $param['type'] . '" name="' . $param['param_name'] . '" id="' . $param['param_name'] . '" ' . $checked . ' data-value-on="' . $param_value_on . '" data-value-off="' . $param_value_off . '" ><span class="lever"></span></label></div>'; } else { if ($param['type'] == 'dropdown') { $default = $param_value; if (isset($param['std'])) { $default = $param['std']; } $param_line .= '<div class="input-field col s12 m6 spb_param_value dropdown" ><select name="' . $param['param_name'] . '" class=" spb-input spb-select ' . $param['param_name'] . ' ' . $param['type'] . '" data-default="' . $default . '">'; foreach ($param['value'] as $text_val => $val) { if (is_numeric($text_val) && is_string($val) || is_numeric($text_val) && is_numeric($val)) { $text_val = $val; } $text_val = __($text_val, 'swift-framework-plugin'); //$val = strtolower( str_replace( array( " " ), array( "_" ), $val ) ); $val = str_replace(array(" "), array("_"), $val); $selected = ''; if ($val == $param_value) { $selected = ' selected="selected"'; } $param_line .= '<option class="' . $val . '" value="' . $val . '"' . $selected . '>' . $text_val . '</option>'; } $param_line .= '</select></div>'; } else { if ($param['type'] == 'dropdown-id') { $default = $param_value; if (isset($param['std'])) { $default = $param['std']; } $param_line .= '<div class="input-field col s12 m6 spb_param_value dropdown" ><select name="' . $param['param_name'] . '" class=" spb-input spb-select ' . $param['param_name'] . ' ' . $param['type'] . '" data-default="' . $default . '">'; foreach ($param['value'] as $val => $text_val) { if (is_numeric($text_val) && is_string($val) || is_numeric($text_val) && is_numeric($val)) { $text_val = $val; } $text_val = __($text_val, 'swift-framework-plugin'); //$val = strtolower( str_replace( array( " " ), array( "_" ), $val ) ); $val = str_replace(array(" "), array("_"), $val); $selected = ''; if ($val == $param_value) { $selected = ' selected="selected"'; } $param_line .= '<option class="' . $val . '" value="' . $val . '"' . $selected . '>' . $text_val . '</option>'; } $param_line .= '</select></div>'; } else { if ($param['type'] == 'select-multiple') { $param_line .= '<div class="input-field col s12 m6 spb_param_value select-multiple" ><select multiple name="' . $param['param_name'] . '" class="spb-select ' . $param['param_name'] . ' ' . $param['type'] . '" type="hidden" value="" name="" multiple>'; $selected_values = explode(",", $param_value); $selected_values = array_map('ltrim', $selected_values); foreach ($param['value'] as $text_val => $val) { if (is_numeric($text_val) && is_string($val) || is_numeric($text_val) && is_numeric($val)) { $text_val = $val; } $text_val = __($text_val, 'swift-framework-plugin'); $selected = ' '; if (in_array($val, $selected_values)) { $selected = ' selected '; } $param_line .= '<option id="' . $text_val . '" value="' . $val . '"' . $selected . '>' . $val . '</option>'; } $param_line .= '</select></div>'; } else { if ($param['type'] == 'select-multiple-id') { $param_line .= '<div class="input-field col s12 m6 spb_param_value dropdown" ><select multiple name="' . $param['param_name'] . '" class=" spb-select ' . $param['param_name'] . ' ' . $param['type'] . '" type="hidden" value="" name="" multiple>'; //$param_line .= '<select multiple name="' . $param['param_name'] . '" class="spb_param_value spb-select ' . $param['param_name'] . ' ' . $param['type'] . '" type="hidden" value="" name="" multiple>'; $selected_values = explode(",", $param_value); $selected_values = array_map('ltrim', $selected_values); foreach ($param['value'] as $val => $text_val) { $text_val = __($text_val, 'swift-framework-plugin'); $selected = ''; if (in_array($val, $selected_values)) { $selected = ' selected="selected"'; } $param_line .= '<option id="' . $val . '" value="' . $val . '"' . $selected . '>' . $text_val . '</option>'; } $param_line .= '</select></div>'; } else { if ($param['type'] == 'textarea_encoded') { $param_value = htmlentities(rawurldecode(base64_decode($param_value)), ENT_COMPAT, 'UTF-8'); $param_line .= '<textarea name="' . $param['param_name'] . '" class="spb_param_value spb-textarea spb-encoded-textarea ' . $param['param_name'] . ' ' . $param['type'] . '">' . $param_value . '</textarea>'; } else { if ($param['type'] == 'textarea_html') { $param_line .= $this->getTinyHtmlTextArea($param, $param_value); } else { if ($param['type'] == 'posttypes') { $param_line .= '<input class="spb_param_value spb-checkboxes" type="hidden" value="" name="" />'; $args = array('public' => true); $post_types = get_post_types($args); foreach ($post_types as $post_type) { $checked = ""; if ($post_type != 'attachment') { if (in_array($post_type, explode(",", $param_value))) { $checked = ' checked="checked"'; } $param_line .= ' <input id="' . $post_type . '" class="' . $param['param_name'] . ' ' . $param['type'] . '" type="checkbox" name="' . $param['param_name'] . '"' . $checked . '> ' . $post_type; } } } else { if ($param['type'] == 'exploded_textarea') { $param_value = str_replace(",", "\n", $param_value); $param_line .= '<textarea name="' . $param['param_name'] . '" class="spb_param_value spb-textarea ' . $param['param_name'] . ' ' . $param['type'] . '">' . $param_value . '</textarea>'; } else { if ($param['type'] == 'textarea_raw_html') { // $param_value = __($param_value, 'swift-framework-plugin'); $param_line .= '<textarea name="' . $param['param_name'] . '" class="spb_param_value spb-textarea_raw_html ' . $param['param_name'] . ' ' . $param['type'] . '" rows="16">' . htmlentities(rawurldecode(base64_decode($param_value)), ENT_COMPAT, 'UTF-8') . '</textarea>'; } else { if ($param['type'] == 'textarea') { $param_value = __($param_value, 'swift-framework-plugin'); $param_line .= '<textarea name="' . $param['param_name'] . '" class="spb_param_value spb-textarea ' . $param['param_name'] . ' ' . $param['type'] . '">' . $param_value . '</textarea>'; } else { if ($param['type'] == 'attach_images') { // TODO: More native way $param_value = spb_removeNotExistingImgIDs($param_value); $param_line .= '<input type="hidden" class="spb_param_value sf_gallery_widget_attached_images_ids ' . $param['param_name'] . ' ' . $param['type'] . '" name="' . $param['param_name'] . '" value="' . $param_value . '" />'; $param_line .= '<a class="button sf_gallery_widget_add_images" href="#" title="' . __('Add images', 'swift-framework-plugin') . '">' . __('Add images', 'swift-framework-plugin') . '</a>'; $param_line .= '<div class="sf_galSFages">'; $param_line .= '<ul class="sf_gallery_widget_attached_images_list">'; $param_line .= $param_value != '' ? spb_fieldAttachedImages(explode(",", $param_value)) : ''; $param_line .= '</ul>'; $param_line .= '</div>'; $param_line .= '<div class="spb_clear"></div>'; } else { if ($param['type'] == 'attach_image') { // TODO: More native way $param_value = spb_removeNotExistingImgIDs(preg_replace('/[^\\d]/', '', $param_value)); $param_line .= '<input type="hidden" class="spb_param_value sf_gallery_widget_attached_images_ids ' . $param['param_name'] . ' ' . $param['type'] . '" name="' . $param['param_name'] . '" value="' . $param_value . '" />'; $param_line .= '<a class="button sf_gallery_widget_add_images" href="#" use-single="true" title="' . __('Add image', 'swift-framework-plugin') . '" data-uploader_title="' . __('Add image', 'swift-framework-plugin') . '">' . __('Add image', 'swift-framework-plugin') . '</a>'; $param_line .= '<div class="sf_gallery_widget_attached_images">'; $param_line .= '<ul class="sf_gallery_widget_attached_images_list">'; $param_line .= $param_value != '' ? spb_fieldAttachedImages(explode(",", $param_value)) : ''; $param_line .= '</ul>'; $param_line .= '</div>'; $param_line .= '<div class="spb_clear"></div>'; } else { if ($param['type'] == 'widgetised_sidebars') { $spb_sidebar_ids = array(); $sidebars = $GLOBALS['wp_registered_sidebars']; $param_line .= '<div class="input-field col s12 m6 spb_param_value dropdown" ><select name="' . $param['param_name'] . '" class=" spb-input spb-select ' . $param['param_name'] . ' ' . $param['type'] . '" data-default="' . $default . '">'; foreach ($sidebars as $sidebar) { $selected = ''; if ($sidebar["id"] == $param_value) { $selected = ' selected="selected"'; } $sidebar_name = __($sidebar["name"], 'swift-framework-plugin'); $param_line .= '<option value="' . $sidebar["id"] . '"' . $selected . '>' . $sidebar_name . '</option>'; } $param_line .= '</select></div>'; } else { if ($param['type'] == 'icon-picker') { $value = __($param_value, 'swift-framework-plugin'); $value = $param_value; $icon_grid_data = sf_get_icons_list(); if (isset($param['data'])) { $icon_grid_data = $param['data']; } $param_line .= '<div class="span9 edit_form_line"><input type="text" class="search-icon-grid textfield" placeholder="Search Icon"></div><input name="' . $param['param_name'] . '" class="spb_param_value ' . $param['param_name'] . ' ' . $param['type'] . '" type="text" value="' . $value . '" style="visibility: hidden;height: 0;" /><ul class="font-icon-grid std-grid">' . $icon_grid_data . '</ul>'; } } } } } } } } } } } } } } } } } } } } } } return $param_line; }