extract(shortcode_atts(array('title' => '', 'icon' => '', 'character' => '', 'image' => '', 'svg_icon' => '', 'animate_svg' => '', 'box_type' => '', 'box_icon_type' => '', 'icon_color' => '', 'icon_bg_color' => '', 'text_color' => '', 'bg_color' => '', 'flip_text_color' => '', 'flip_bg_color' => '', 'animated_box_style' => '', 'animated_box_rounded' => '', 'animation' => '', 'animation_delay' => '', 'link' => '', 'target' => '', 'el_class' => '', 'el_position' => '', 'width' => '1/1'), $atts)); $output = ''; if ($image != "") { $img_url = wp_get_attachment_url($image, 'full'); $image_object = sf_aq_resize($img_url, 70, 70, true, false); $image_url = $image_object[0]; } $icon_box_output = do_shortcode('[sf_iconbox icon="' . $icon . '" character="' . $character . '" image="' . $image_url . '" svg="' . $svg_icon . '" animate_svg="' . $animate_svg . '" type="' . $box_type . '" icon_type="' . $box_icon_type . '" title="' . $title . '" animation="' . $animation . '" animation_delay="' . $animation_delay . '" bg_color="' . $bg_color . '" text_color="' . $text_color . '" icon_color="' . $icon_color . '" icon_bg_color="' . $icon_bg_color . '" flip_text_color="' . $flip_text_color . '" flip_bg_color="' . $flip_bg_color . '" animated_box_style="' . $animated_box_style . '" animated_box_rounded="' . $animated_box_rounded . '" link="' . $link . '" target="' . $target . '"]' . $content . '[/sf_iconbox]'); $el_class = $this->getExtraClass($el_class); $width = spb_translateColumnWidthToSpan($width); $output .= "\n\t" . '<div class="spb_icon_box ' . $width . $el_class . '">'; $output .= "\n\t\t" . '<div class="spb-asset-content">'; $output .= "\n\t\t" . $icon_box_output; $output .= "\n\t\t" . '</div>'; $output .= "\n\t" . '</div> ' . $this->endBlockComment($width); $output = $this->startRow($el_position) . $output . $this->endRow($el_position); global $sf_include_carousel; $sf_include_carousel = true; return $output; } } $target_arr = array(__("Same window", 'swift-framework-plugin') => "_self", __("New window", 'swift-framework-plugin') => "_blank"); $icon_box_icon_types = array('' => '', __("Icon", 'swift-framework-plugin') => "icon", __("Character", 'swift-framework-plugin') => "character", __("Image", 'swift-framework-plugin') => "image"); $icon_box_types = array(__('Standard', 'swift-framework-plugin') => "standard", __('Standard with Title Icon', 'swift-framework-plugin') => "standard-title", __('Bold', 'swift-framework-plugin') => "bold", __('Left Icon', 'swift-framework-plugin') => "left-icon", __('Left Icon Alt', 'swift-framework-plugin') => "left-icon-alt", __('Boxed One', 'swift-framework-plugin') => "boxed-one", __('Boxed Two', 'swift-framework-plugin') => "boxed-two", __('Boxed Three', 'swift-framework-plugin') => "boxed-three", __('Boxed Four', 'swift-framework-plugin') => "boxed-four", __('Animated', 'swift-framework-plugin') => "animated"); if (spb_get_theme_name() == "atelier") { $icon_box_types = array(__('Standard', 'swift-framework-plugin') => "standard", __('Standard with Title Icon', 'swift-framework-plugin') => "standard-title", __('Left Icon', 'swift-framework-plugin') => "left-icon", __('Left Icon Alt', 'swift-framework-plugin') => "left-icon-alt", __('Boxed One', 'swift-framework-plugin') => "boxed-one", __('Boxed Two', 'swift-framework-plugin') => "boxed-two", __('Boxed Three', 'swift-framework-plugin') => "boxed-three", __('Boxed Four', 'swift-framework-plugin') => "boxed-four", __('Animated', 'swift-framework-plugin') => "animated"); } $icon_box_icon_types = apply_filters('spb_icon_box_icon_types', $icon_box_icon_types); $icon_box_types = apply_filters('spb_icon_box_types', $icon_box_types); SPBMap::map('spb_icon_box', array("name" => __("Icon Box", 'swift-framework-plugin'), "base" => "spb_icon_box", "class" => "spb_tab_ui", "icon" => "icon-icon-box", "wrapper_class" => "clearfix", "params" => array(array("type" => "textfield", "heading" => __("Icon Box title", 'swift-framework-plugin'), "param_name" => "title", "value" => "", "description" => __("Icon Box title text.", 'swift-framework-plugin')), array("type" => "dropdown", "heading" => __("Icon Box Type", 'swift-framework-plugin'), "param_name" => "box_type", "value" => $icon_box_types, "description" => __("Choose the type of icon box.", 'swift-framework-plugin')), array("type" => "dropdown", "heading" => __("Icon Box Icon Type", 'swift-framework-plugin'), "param_name" => "box_icon_type", "value" => $icon_box_icon_types, "description" => __("Choose the type of icon box.", 'swift-framework-plugin')), array("type" => "icon-picker", "heading" => __("Icon Box Icon", 'swift-framework-plugin'), "param_name" => "icon", "value" => "", "required" => array("box_icon_type", "=", "icon"), "description" => ''), array("type" => "textfield", "heading" => __("Icon Box Character", 'swift-framework-plugin'), "param_name" => "character", "value" => "", "required" => array("box_icon_type", "=", "character"), "description" => __("Instead of an icon, you can optionally provide a single letter/digit here. NOTE: This will override the icon selection.", 'swift-framework-plugin')), array("type" => "attach_image", "heading" => __("Icon Box Image", 'swift-framework-plugin'), "param_name" => "image", "value" => "", "required" => array("box_icon_type", "=", "image"), "description" => __("Instead of an icon, you can optionally upload an image here. This will be resized to 70px x 70px. NOTE: This will override the icon selection.", 'swift-framework-plugin')), array("type" => "icon-picker", "heading" => __("Icon Box SVG", 'swift-framework-plugin'), "param_name" => "svg_icon", "data" => spb_get_svg_icons(), "value" => "", "required" => array("box_icon_type", "=", "svg"), "description" => __("You can select an SVG icon here.", 'swift-framework-plugin')), array("type" => "buttonset", "heading" => __("Animate SVG Icon", 'swift-framework-plugin'), "param_name" => "animate_svg", "value" => array(__('No', 'swift-framework-plugin') => "no", __('Yes', 'swift-framework-plugin') => "yes"), "required" => array("box_icon_type", "=", "svg"), "description" => __("If you are using an outline svg icon, then you can enable/disable the drawing animation on appear here.", 'swift-framework-plugin')), array("type" => "textarea_html", "holder" => "div", "class" => "", "heading" => __("Text", 'swift-framework-plugin'), "param_name" => "content", "value" => __("click the edit button to change this text.", 'swift-framework-plugin'), "description" => __("Enter your content.", 'swift-framework-plugin')), array("type" => "textfield", "heading" => __("Icon Box Link", 'swift-framework-plugin'), "param_name" => "link", "value" => "", "description" => __("If you would like, you can set a link here for the icon and title to link through to.", 'swift-framework-plugin')), array("type" => "dropdown", "heading" => __("Link Target", 'swift-framework-plugin'), "param_name" => "target", "value" => $target_arr), array("type" => "section", "param_name" => "ib_animation_options", "heading" => __("Animation Options", 'swift-framework-plugin')), array("type" => "dropdown", "heading" => __("Intro Animation", 'swift-framework-plugin'), "param_name" => "animation", "value" => spb_animations_list(), "description" => __("Select an intro animation for the icon box that will show it when it appears within the viewport.", 'swift-framework-plugin')), array("type" => "textfield", "heading" => __("Animation Delay", 'swift-framework-plugin'), "param_name" => "animation_delay", "value" => "0", "description" => __("If you wish to add a delay to the animation, then you can set it here (ms).", 'swift-framework-plugin')), array("type" => "section_tab", "param_name" => "design_tab", "heading" => __("Design Options", 'swift-framework-plugin')), array("type" => "colorpicker", "heading" => __("Icon color", 'swift-framework-plugin'), "param_name" => "icon_color", "value" => "", "description" => __("Set the icon colour for the icon box, or leave blank to use the default colours.", 'swift-framework-plugin')), array("type" => "colorpicker", "heading" => __("Icon Background color", 'swift-framework-plugin'), "param_name" => "icon_bg_color", "value" => "", "description" => __("Set the icon background colour for the icon box, or leave blank to use the default colours.", 'swift-framework-plugin')), array("type" => "colorpicker", "heading" => __("Text color", 'swift-framework-plugin'), "param_name" => "text_color", "value" => "", "description" => __("Set the text colour for the icon box, or leave blank to use the default colours.", 'swift-framework-plugin')), array("type" => "colorpicker", "heading" => __("Background color", 'swift-framework-plugin'), "param_name" => "bg_color", "value" => "", "description" => __("Set the background colour for the icon box, or leave blank to use the default colours.", 'swift-framework-plugin')), array("type" => "colorpicker", "heading" => __("Flip Background color", 'swift-framework-plugin'), "param_name" => "flip_bg_color", "value" => "", "required" => array("box_type", "or", "animated,animated-alt"), "description" => __("Set the background colour for the back of the animated icon box, or leave blank to use the default colours.", 'swift-framework-plugin')), array("type" => "colorpicker", "heading" => __("Flip Text color", 'swift-framework-plugin'), "param_name" => "flip_text_color", "value" => "", "required" => array("box_type", "or", "animated,animated-alt"), "description" => __("Set the text colour for the back of the animated icon box, or leave blank to use the default colours.", 'swift-framework-plugin')), array("type" => "dropdown", "heading" => __("Animated Box Style", 'swift-framework-plugin'), "param_name" => "animated_box_style", "value" => array(__('Stroke', 'swift-framework-plugin') => "stroke", __('Coloured', 'swift-framework-plugin') => "coloured"), "std" => 'coloured', "required" => array("box_type", "=", "animated-alt"), "description" => __("If you are using the animated icon box option, you can choose the style here.", 'swift-framework-plugin')), array("type" => "buttonset", "heading" => __("Animated Box Rounded", 'swift-framework-plugin'), "param_name" => "animated_box_rounded", "value" => array(__('Yes', 'swift-framework-plugin') => "yes", __('No', 'swift-framework-plugin') => "no"), "std" => 'yes', "required" => array("box_type", "=", "animated-alt"), "description" => __("If you are using the animated icon box option, you can choose to set it to be rounded here.", 'swift-framework-plugin')), array("type" => "section_tab", "param_name" => "misc_tab", "heading" => __("Misc Options", 'swift-framework-plugin')), array("type" => "textfield", "heading" => __("Extra class", 'swift-framework-plugin'), "param_name" => "el_class", "value" => "", "description" => __("If you wish to style this particular content element differently, then use this field to add a class name and then refer to it in your css file.", 'swift-framework-plugin')))));
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; }