/** * Define shortcode settings. * * @return void */ function element_items() { $this->items = array('content' => array(array('name' => __('Element Title', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'el_title', 'type' => 'text_field', 'class' => 'input-sm', 'std' => __('', WR_MEGAMENU_TEXTDOMAIN), 'role' => 'title', 'tooltip' => __('Set title for current element for identifying easily', WR_MEGAMENU_TEXTDOMAIN)), array('name' => __('Text Content', WR_MEGAMENU_TEXTDOMAIN), 'desc' => __('Enter some content for this textblock', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'text_value', 'type' => 'tiny_mce', 'role' => 'content', 'std' => WR_Megamenu_Helpers_Type::lorem_text(), 'rows' => 15, 'tooltip' => __('Set content of element', WR_MEGAMENU_TEXTDOMAIN))), 'appearance' => array(array('name' => __('Margin', WR_MEGAMENU_TEXTDOMAIN), 'container_class' => 'combo-group', 'id' => 'text_margin', 'type' => 'margin', 'extended_ids' => array('text_margin_top', 'text_margin_right', 'text_margin_bottom', 'text_margin_left'), 'text_margin_top' => array('std' => ''), 'text_margin_bottom' => array('std' => ''), 'tooltip' => __('Set margin size', WR_MEGAMENU_TEXTDOMAIN)), array('name' => __('Enable Dropcap', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'enable_dropcap', 'type' => 'radio', 'std' => 'no', 'options' => array('yes' => __('Yes', WR_MEGAMENU_TEXTDOMAIN), 'no' => __('No', WR_MEGAMENU_TEXTDOMAIN)), 'tooltip' => __('Enable Dropcap', WR_MEGAMENU_TEXTDOMAIN), 'has_depend' => '1'), array('name' => __('Font Face', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'dropcap_font_family', 'type' => array(array('id' => 'dropcap_font_face_type', 'type' => 'jsn_select_font_type', 'class' => 'input-medium input-sm', 'std' => 'standard fonts', 'options' => WR_Megamenu_Helpers_Type::get_fonts(), 'parent_class' => 'combo-item'), array('id' => 'dropcap_font_face_value', 'type' => 'jsn_select_font_value', 'class' => 'input-medium input-sm', 'std' => 'Verdana', 'options' => '', 'parent_class' => 'combo-item')), 'dependency' => array('enable_dropcap', '=', 'yes'), 'tooltip' => __('Set Font Face', WR_MEGAMENU_TEXTDOMAIN), 'container_class' => 'combo-group'), array('name' => __('Font Attributes', WR_MEGAMENU_TEXTDOMAIN), 'type' => array(array('id' => 'dropcap_font_size', 'type' => 'text_append', 'type_input' => 'number', 'class' => 'input-mini', 'std' => '64', 'append' => 'px', 'validate' => 'number', 'parent_class' => 'combo-item input-mini-inline'), array('id' => 'dropcap_font_style', 'type' => 'select', 'class' => 'input-medium wr-mini-input input-sm', 'std' => 'bold', 'options' => WR_Megamenu_Helpers_Type::get_font_styles(), 'parent_class' => 'combo-item'), array('id' => 'dropcap_font_color', 'type' => 'color_picker', 'std' => '#000000', 'parent_class' => 'combo-item')), 'dependency' => array('enable_dropcap', '=', 'yes'), 'tooltip' => __('Set Font Attribute', WR_MEGAMENU_TEXTDOMAIN), 'container_class' => 'combo-group'), array('name' => __('Line height', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'line_height', 'class' => 'wr-slider wr-slider-height col-sm-3', 'exclude_class' => array('form-control'), 'type' => 'slider_height', 'std_max' => '100', 'std' => '20', 'tooltip' => __('Line height', WR_MEGAMENU_TEXTDOMAIN)))); }
/** * contain setting items of this element ( use for modal box ) * */ function element_items() { $this->items = array('Notab' => array(array('name' => __('Background', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'background', 'type' => 'select', 'std' => 'none', 'class' => 'input-sm', 'options' => array('none' => __('None', WR_MEGAMENU_TEXTDOMAIN), 'solid' => __('Solid Color', WR_MEGAMENU_TEXTDOMAIN), 'gradient' => __('Gradient Color', WR_MEGAMENU_TEXTDOMAIN), 'pattern' => __('Pattern', WR_MEGAMENU_TEXTDOMAIN), 'image' => __('Image', WR_MEGAMENU_TEXTDOMAIN)), 'has_depend' => '1'), array('name' => __('Solid Color', WR_MEGAMENU_TEXTDOMAIN), 'type' => array(array('id' => 'solid_color_value', 'type' => 'text_field', 'class' => 'input-small', 'std' => '#FFFFFF', 'parent_class' => 'combo-item'), array('id' => 'solid_color_color', 'type' => 'color_picker', 'std' => '#ffffff', 'parent_class' => 'combo-item')), 'container_class' => 'combo-group', 'dependency' => array('background', '=', 'solid')), array('name' => __('Gradient Color', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'gradient_color', 'type' => 'gradient_picker', 'std' => '0% #FFFFFF,100% #000000', 'dependency' => array('background', '=', 'gradient')), array('id' => 'gradient_color_css', 'type' => 'text_field', 'std' => '', 'type_input' => 'hidden', 'container_class' => 'hidden', 'dependency' => array('background', '=', 'gradient')), array('name' => __('Gradient Direction', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'gradient_direction', 'type' => 'select', 'std' => 'vertical', 'options' => array('vertical' => __('Vertical', WR_MEGAMENU_TEXTDOMAIN), 'horizontal' => __('Horizontal', WR_MEGAMENU_TEXTDOMAIN)), 'dependency' => array('background', '=', 'gradient')), array('name' => __('Pattern', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'pattern', 'type' => 'select_media', 'std' => '', 'class' => 'jsn-input-large-fluid', 'dependency' => array('background', '=', 'pattern')), array('name' => __('Repeat', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'repeat', 'type' => 'radio_button_group', 'std' => 'full', 'options' => array('full' => __('Full', WR_MEGAMENU_TEXTDOMAIN), 'vertical' => __('Vertical', WR_MEGAMENU_TEXTDOMAIN), 'horizontal' => __('Horizontal', WR_MEGAMENU_TEXTDOMAIN)), 'dependency' => array('background', '=', 'pattern')), array('name' => __('Image', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'image', 'type' => 'select_media', 'std' => '', 'class' => 'jsn-input-large-fluid', 'dependency' => array('background', '=', 'image')), array('name' => __('Stretch', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'stretch', 'type' => 'radio_button_group', 'std' => 'none', 'options' => array('none' => __('None', WR_MEGAMENU_TEXTDOMAIN), 'full' => __('Full', WR_MEGAMENU_TEXTDOMAIN), 'cover' => __('Cover', WR_MEGAMENU_TEXTDOMAIN), 'contain' => __('Contain', WR_MEGAMENU_TEXTDOMAIN)), 'dependency' => array('background', '=', 'pattern')), array('name' => __('Position', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'position', 'type' => 'radio', 'label_type' => 'image', 'dimension' => array(23, 23), 'std' => 'center center', 'options' => array('left top' => array('left top'), 'center top' => array('center top'), 'right top' => array('right top', 'linebreak' => true), 'left center' => array('left center'), 'center center' => array('center center'), 'right center' => array('right center', 'linebreak' => true), 'left bottom' => array('left bottom'), 'center bottom' => array('center bottom'), 'right bottom' => array('right bottom')), 'dependency' => array('background', '=', 'image')), array('name' => __('Enable Paralax', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'paralax', 'type' => 'radio', 'std' => 'no', 'options' => array('yes' => __('Yes', WR_MEGAMENU_TEXTDOMAIN), 'no' => __('No', WR_MEGAMENU_TEXTDOMAIN)), 'dependency' => array('background', '=', 'pattern__#__image')), array('name' => __('Border', WR_MEGAMENU_TEXTDOMAIN), 'type' => array(array('id' => 'border_width_value_', 'type' => 'text_append', 'type_input' => 'number', 'class' => '', 'std' => '0', 'append' => 'px', 'validate' => 'number', 'parent_class' => 'input-group-inline'), array('id' => 'border_style', 'type' => 'select', 'class' => 'input-sm', 'std' => 'solid', 'options' => WR_Megamenu_Helpers_Type::get_border_styles(), 'parent_class' => 'combo-item'), array('id' => 'border_color', 'type' => 'color_picker', 'std' => '#000', 'parent_class' => 'combo-item')), 'container_class' => 'combo-group'), array('name' => __('Padding', WR_MEGAMENU_TEXTDOMAIN), 'container_class' => 'combo-group', 'id' => 'div_padding', 'type' => 'margin', 'extended_ids' => array('div_padding_top', 'div_padding_bottom', 'div_padding_right', 'div_padding_left'), 'div_padding_top' => array('std' => '10'), 'div_padding_bottom' => array('std' => '10'), 'div_padding_right' => array('std' => '10'), 'div_padding_left' => array('std' => '10')), array('name' => __('Custom CSS', WR_MEGAMENU_TEXTDOMAIN), 'id' => '', 'type' => 'spacer', 'blank_output' => '1'), array('name' => __('CSS Class', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'css_suffix', 'type' => 'text_field', 'std' => __('', WR_MEGAMENU_TEXTDOMAIN), 'tooltip' => __('Add custom css class for the wrapper div of this element', WR_MEGAMENU_TEXTDOMAIN)), array('name' => __('ID', WR_MEGAMENU_TEXTDOMAIN), 'id' => 'id_wrapper', 'type' => 'text_field', 'std' => __('', WR_MEGAMENU_TEXTDOMAIN), 'tooltip' => __('Add custom id for the wrapper div of this element', WR_MEGAMENU_TEXTDOMAIN)))); }
/** * Generate HTML code from shortcode content. * * @param array $atts Shortcode attributes. * @param string $content Current content. * * @return string */ public function element_shortcode_full($atts = null, $content = null) { $arr_params = shortcode_atts($this->config['params'], $atts); extract($arr_params); $html_elemments = $script = ''; $alt_text = $image_alt ? " alt='{$image_alt}'" : ''; if (isset($arr_params['image_margin_top'])) { $arr_params['div_margin_top'] = $arr_params['image_margin_top']; } if (isset($arr_params['image_margin_bottom'])) { $arr_params['div_margin_bottom'] = $arr_params['image_margin_bottom']; } if (isset($arr_params['image_margin_right'])) { $arr_params['div_margin_right'] = $arr_params['image_margin_right']; } if (isset($arr_params['image_margin_left'])) { $arr_params['div_margin_left'] = $arr_params['image_margin_left']; } // No add image effect in admin view if (is_admin()) { $image_effect = 'no'; } $class_img = $image_container_style != 'no-styling' ? $image_container_style : ''; $class_img = $image_effect == 'yes' ? $class_img . ' image-scroll-fade' : $class_img; $class_img = !empty($class_img) ? ' class="' . $class_img . '"' : ''; if ($image_file) { $image_id = WR_Megamenu_Helpers_Functions::get_image_id($image_file); $attachment = wp_prepare_attachment_for_js($image_id); $image_file = !empty($attachment['sizes'][$image_size]['url']) ? $attachment['sizes'][$image_size]['url'] : $image_file; $html_elemments .= "<img src='{$image_file}'{$alt_text}{$class_img} />"; $script = ''; $target = ''; if ($image_effect == 'yes' and !isset($_POST['action'])) { $data = getimagesize($image_file); $width = $data[0]; $height = $data[1]; $html_elemments = "<img src='" . WR_Megamenu_Helpers_Functions::path('assets/3rd-party') . '/jquery-lazyload/grey.gif' . "' data-original='{$image_file}' width='{$width}' height='{$height}' {$alt_text} {$class_img}/>"; } if ($open_in) { switch ($open_in) { case 'current_browser': $target = ''; break; case 'new_browser': $target = ' target="_blank"'; break; case 'new_window': $cls_button_fancy = 'wr-button-new-window'; $script = WR_Megamenu_Helpers_Functions::new_window(".{$cls_button_fancy}", array('width' => '75%', 'height' => '75%')); break; case 'lightbox': $cls_button_fancy = 'mm-image-fancy'; break; } } $class = isset($cls_button_fancy) && !empty($cls_button_fancy) ? " class='{$cls_button_fancy}'" : ''; // get Single Item and check type to get right link $single_item = explode('__#__', $single_item); $single_item = $single_item[0]; $taxonomies = WR_Megamenu_Helpers_Type::get_public_taxonomies(); $post_types = WR_Megamenu_Helpers_Type::get_post_types(); // single post if (array_key_exists($link_type, $post_types)) { $permalink = home_url() . "/?p={$single_item}"; $html_elemments = "<a href='{$permalink}'{$target}{$class}>" . $html_elemments . '</a>'; } else { if (array_key_exists($link_type, $taxonomies)) { $permalink = get_term_link(intval($single_item), $link_type); if (!is_wp_error($permalink)) { $html_elemments = "<a href='{$permalink}'{$target}{$class}>" . $html_elemments . '</a>'; } } else { switch ($link_type) { case 'url': $html_elemments = "<a href='{$image_type_url}'{$target}{$class}>" . $html_elemments . '</a>'; break; case 'large_image': $image_id = WR_Megamenu_Helpers_Functions::get_image_id($image_file); $attachment = wp_prepare_attachment_for_js($image_id); $image_url = !empty($attachment['sizes'][$image_image_size]['url']) ? $attachment['sizes'][$image_image_size]['url'] : $image_file; $html_elemments = "<a href='{$image_url}'{$target}{$class}>" . $html_elemments . '</a>'; break; } } } if ($image_caption != '') { $html_elemments = $html_elemments . '<div class="clearfix"></div><div class="image_caption">' . $image_caption . '</div>'; } if (strtolower($image_alignment) != 'inherit') { if (strtolower($image_alignment) == 'left') { $cls_alignment = 'pull-left'; } if (strtolower($image_alignment) == 'right') { $cls_alignment = 'pull-right'; } if (strtolower($image_alignment) == 'center') { $cls_alignment = 'text-center'; } $html_elemments = "<div class='{$cls_alignment}'>" . $html_elemments . '</div>'; } } return $this->element_wrapper($html_elemments . $script, $arr_params); }