/** * Renders all soical icons not belonging to shortcodes * * @since 3.5.0 * @param array $args Holding all necessarry data for social icons * @return string The HTML mark up for social icons, incl. wrapping container */ public function render_social_icons($args) { parent::$args = $args; // Get a list of all the available social networks $social_networks_full_array = Avada_Data::fusion_social_icons(true, true); if (isset(parent::$args['authorpage']) && parent::$args['authorpage'] == 'yes') { $social_networks = $this->get_authorpage_social_links_array(parent::$args); } else { $social_networks = $this->get_sharingbox_social_links_array(parent::$args); } $html = $icons = ''; $i = 0; $per_icon_colors = 'brand' == Avada()->settings->get('sharing_social_links_color_type') ? true : false; $number_of_social_networks = count($social_networks); foreach ($social_networks as $network => $icon_args) { $icon_options = array('social_network' => $network, 'social_link' => $icon_args['url']); if ($per_icon_colors) { $network_for_colors = str_replace('sharing_', '', $network); $network_for_colors = in_array($network_for_colors, array('google', 'googleplus')) ? 'gplus' : $network_for_colors; if (parent::$args['icon_boxed']) { $icon_options['icon_color'] = '#ffffff'; $icon_options['box_color'] = $social_networks_full_array[$network_for_colors]['color']; } else { $icon_options['icon_color'] = $social_networks_full_array[$network_for_colors]['color']; $icon_options['box_color'] = '#ffffff'; } } else { $icon_options['icon_color'] = Avada()->settings->get('sharing_social_links_icon_color'); $icon_options['box_color'] = Avada()->settings->get('sharing_social_links_box_color'); } // Check if are on the last social icon; // $i needs to be incremented first to make it match the count() value $i++; $icon_options['last'] = $i == $number_of_social_networks ? true : false; $icons .= parent::get_markup($icon_options); } if (!empty($icons)) { $attr = array('class' => 'fusion-social-networks'); if (parent::$args['icon_boxed']) { $attr['class'] .= ' boxed-icons'; } $html = '<div ' . fusion_attr('social-icons-class-social-networks', $attr) . '><div ' . fusion_attr('fusion-social-networks-wrapper') . '>' . $icons; if (isset(parent::$args['position']) && ('header' == parent::$args['position'] || 'footer' == parent::$args['position'])) { $html .= '</div></div>'; } else { $html .= '<div class="fusion-clearfix"></div></div></div>'; } } return $html; }
/** * Social Media * * @var array any existing settings * @return array existing sections + social_media * */ function avada_options_section_social_media($sections) { $sections['social_media'] = array('label' => esc_html__('Social Media', 'Avada'), 'id' => 'heading_social_media', 'priority' => 18, 'icon' => 'el-icon-share-alt', 'fields' => array('social_media_icons_section' => array('label' => esc_html__('Social Media Icons', 'Avada'), 'id' => 'social_media_icons_section', 'icon' => true, 'type' => 'sub-section', 'fields' => array('social_media_icons_important_note_info' => array('label' => '', 'description' => '<div class="avada-avadaredux-important-notice">' . __('<strong>IMPORTANT NOTE:</strong> This tab controls the social networks that display in the header and footer. Add the network of your choice along with your unique URL. Each network you wish to display must be added here to show up in the header and footer. These settings do not control the avada social widget, social link shortcode or person shortcode.', 'Avada') . '</div>', 'id' => 'social_media_icons_important_note_info', 'type' => 'custom'), 'social_media_icons' => array('label' => esc_html__('Social Media Links', 'Avada'), 'description' => esc_html__('Social media links use a repeater field and allow one network per field. Click the "Add" button to add additional fields.', 'Avada'), 'id' => 'social_media_icons', 'default' => array(), 'type' => 'repeater', 'bind_title' => 'icon', 'fields' => array('icon' => array('type' => 'select', 'description' => esc_html__('Select a social network to automatically add its icon', 'Avada'), 'default' => 'none', 'choices' => Avada_Data::fusion_social_icons(true, false)), 'url' => array('type' => 'text', 'label' => esc_html__('Link (URL)', 'Avada'), 'description' => esc_html__('Insert your custom link here', 'Avada'), 'default' => ''), 'custom_title' => array('type' => 'text', 'label' => esc_html__('Custom Icon Title', 'Avada'), 'description' => esc_html__('Insert your custom link here', 'Avada'), 'default' => ''), 'custom_source' => array('type' => 'media', 'label' => esc_html__('Link (URL) of the image you want to use as the icon', 'Avada'), 'description' => esc_html__('Upload your custom icon', 'Avada'), 'default' => ''))))), 'header_social_icons_options' => array('label' => esc_html__('Header Social Icons', 'Avada'), 'description' => '', 'id' => 'header_social_icons_options', 'default' => '', 'icon' => true, 'type' => 'sub-section', 'fields' => array('header_social_links_font_size' => array('label' => esc_html__('Header Social Icon Font Size', 'Avada'), 'description' => esc_html__('Controls the font size of the header social icons.', 'Avada'), 'id' => 'header_social_links_font_size', 'default' => '16px', 'type' => 'dimension'), 'header_social_links_tooltip_placement' => array('label' => esc_html__('Header Social Icon Tooltip Position', 'Avada'), 'description' => esc_html__('Controls the tooltip position of the header social icons.', 'Avada'), 'id' => 'header_social_links_tooltip_placement', 'default' => 'Bottom', 'type' => 'radio-buttonset', 'choices' => array('Top' => esc_html__('Top', 'Avada'), 'Right' => esc_html__('Right', 'Avada'), 'Bottom' => esc_html__('Bottom', 'Avada'), 'Left' => esc_html__('Left', 'Avada'), 'None' => esc_html__('None', 'Avada'))), 'header_social_links_color_type' => array('label' => esc_html__('Header Social Icon Color Type', 'Avada'), 'description' => esc_html__('Custom colors allow you to choose a color for icons and boxes. Brand colors will use the exact brand color of each network for the icons or boxes.', 'Avada'), 'id' => 'header_social_links_color_type', 'default' => 'custom', 'type' => 'radio-buttonset', 'choices' => array('custom' => esc_html__('Custom Colors', 'Avada'), 'brand' => esc_html__('Brand Colors', 'Avada'))), 'header_social_links_icon_color' => array('label' => esc_html__('Header Social Icon Color', 'Avada'), 'description' => esc_html__('Controls the color of the header social icons. This color will be used for all social icons in the header.', 'Avada'), 'id' => 'header_social_links_icon_color', 'default' => '#bebdbd', 'type' => 'color-alpha', 'required' => array(array('setting' => 'header_social_links_color_type', 'operator' => '==', 'value' => 'custom'))), 'header_social_links_boxed' => array('label' => esc_html__('Header Social Icons Boxed', 'Avada'), 'description' => esc_html__('Controls if each icon is displayed in a small box.', 'Avada'), 'id' => 'header_social_links_boxed', 'default' => '0', 'type' => 'switch'), 'header_social_links_box_color' => array('label' => esc_html__('Header Social Icon Box Color', 'Avada'), 'description' => esc_html__('Controls the color of the social icon box.', 'Avada'), 'id' => 'header_social_links_box_color', 'default' => '#e8e8e8', 'type' => 'color-alpha', 'required' => array(array('setting' => 'header_social_links_boxed', 'operator' => '==', 'value' => '1'), array('setting' => 'header_social_links_color_type', 'operator' => '==', 'value' => 'custom'))), 'header_social_links_boxed_radius' => array('label' => esc_html__('Header Social Icon Boxed Radius', 'Avada'), 'description' => esc_html__('Controls the box radius', 'Avada'), 'id' => 'header_social_links_boxed_radius', 'default' => '4px', 'type' => 'dimension', 'required' => array(array('setting' => 'header_social_links_boxed', 'operator' => '==', 'value' => '1'))), 'header_social_links_boxed_padding' => array('label' => esc_html__('Header Social Icon Boxed Padding', 'Avada'), 'description' => esc_html__('Controls the interior padding of the box.', 'Avada'), 'id' => 'header_social_links_boxed_padding', 'default' => '8px', 'type' => 'dimension', 'required' => array(array('setting' => 'header_social_links_boxed', 'operator' => '==', 'value' => '1'))))), 'footer_social_icons_options' => array('label' => esc_html__('Footer Social Icons', 'Avada'), 'description' => '', 'id' => 'footer_social_icons_options', 'default' => '', 'icon' => true, 'type' => 'sub-section', 'fields' => array('icons_footer' => array('label' => esc_html__('Display Social Icons In The Footer', 'Avada'), 'description' => esc_html__('Turn on to display social icons in the footer copyright bar.', 'Avada'), 'id' => 'icons_footer', 'default' => '1', 'type' => 'switch'), 'footer_social_links_font_size' => array('label' => esc_html__('Footer Social Icon Font Size', 'Avada'), 'description' => esc_html__('Controls the font size of the footer social icons.', 'Avada'), 'id' => 'footer_social_links_font_size', 'default' => '16px', 'type' => 'dimension', 'required' => array(array('setting' => 'icons_footer', 'operator' => '==', 'value' => '1'))), 'footer_social_links_tooltip_placement' => array('label' => esc_html__('Footer Social Icon Tooltip Position', 'Avada'), 'description' => esc_html__('Controls the tooltip position of the footer social icons.', 'Avada'), 'id' => 'footer_social_links_tooltip_placement', 'default' => 'Top', 'type' => 'radio-buttonset', 'choices' => array('Top' => esc_html__('Top', 'Avada'), 'Right' => esc_html__('Right', 'Avada'), 'Bottom' => esc_html__('Bottom', 'Avada'), 'Left' => esc_html__('Left', 'Avada'), 'None' => esc_html__('None', 'Avada')), 'required' => array(array('setting' => 'icons_footer', 'operator' => '==', 'value' => '1'))), 'footer_social_links_color_type' => array('label' => esc_html__('Footer Social Icon Color Type', 'Avada'), 'description' => esc_html__('Custom colors allow you to choose a color for icons and boxes. Brand colors will use the exact brand color of each network for the icons or boxes.', 'Avada'), 'id' => 'footer_social_links_color_type', 'default' => 'custom', 'type' => 'radio-buttonset', 'choices' => array('custom' => esc_html__('Custom Colors', 'Avada'), 'brand' => esc_html__('Brand Colors', 'Avada')), 'required' => array(array('setting' => 'icons_footer', 'operator' => '==', 'value' => '1'))), 'footer_social_links_icon_color' => array('label' => esc_html__('Footer Social Icon Color', 'Avada'), 'description' => esc_html__('Controls the color of the footer social icons. This color will be used for all social icons in the footer.', 'Avada'), 'id' => 'footer_social_links_icon_color', 'type' => 'color-alpha', 'default' => '#46494a', 'required' => array(array('setting' => 'icons_footer', 'operator' => '==', 'value' => '1'), array('setting' => 'footer_social_links_color_type', 'operator' => '==', 'value' => 'custom'))), 'footer_social_links_boxed' => array('label' => esc_html__('Footer Social Icons Boxed', 'Avada'), 'description' => esc_html__('Controls if each icon is displayed in a small box.', 'Avada'), 'id' => 'footer_social_links_boxed', 'default' => '0', 'type' => 'switch', 'required' => array(array('setting' => 'icons_footer', 'operator' => '==', 'value' => '1'))), 'footer_social_links_box_color' => array('label' => esc_html__('Footer Social Icon Box Color', 'Avada'), 'description' => esc_html__('Controls the color of the social icon box.', 'Avada'), 'id' => 'footer_social_links_box_color', 'default' => '#222222', 'type' => 'color-alpha', 'required' => array(array('setting' => 'icons_footer', 'operator' => '==', 'value' => '1'), array('setting' => 'footer_social_links_boxed', 'operator' => '==', 'value' => '1'), array('setting' => 'footer_social_links_color_type', 'operator' => '==', 'value' => 'custom'))), 'footer_social_links_boxed_radius' => array('label' => esc_html__('Footer Social Icon Boxed Radius', 'Avada'), 'description' => esc_html__('Controls the box radius.', 'Avada'), 'id' => 'footer_social_links_boxed_radius', 'default' => '4px', 'type' => 'dimension', 'required' => array(array('setting' => 'icons_footer', 'operator' => '==', 'value' => '1'), array('setting' => 'footer_social_links_boxed', 'operator' => '==', 'value' => '1'))), 'footer_social_links_boxed_padding' => array('label' => esc_html__('Footer Social Icon Boxed Padding', 'Avada'), 'description' => esc_html__('Controls the interior padding of the box.', 'Avada'), 'id' => 'footer_social_links_boxed_padding', 'default' => '8px', 'type' => 'dimension', 'required' => array(array('setting' => 'icons_footer', 'operator' => '==', 'value' => '1'), array('setting' => 'footer_social_links_boxed', 'operator' => '==', 'value' => '1'))))), 'heading_social_sharing_box' => array('label' => esc_html__('Social Sharing Box', 'Avada'), 'id' => 'heading_social_sharing_box', 'icon' => true, 'type' => 'sub-section', 'fields' => array('sharing_social_tagline' => array('label' => esc_html__('Sharing Box Tagline', 'Avada'), 'description' => esc_html__('Insert a tagline for the social sharing boxes.', 'Avada'), 'id' => 'sharing_social_tagline', 'default' => esc_html__('Share This Story, Choose Your Platform!', 'Avada'), 'type' => 'text'), 'sharing_box_tagline_text_color' => array('label' => esc_html__('Sharing Box Tagline Text Color', 'Avada'), 'description' => esc_html__('Controls the color of the tagline text in the social sharing boxes.', 'Avada'), 'id' => 'sharing_box_tagline_text_color', 'default' => '#333333', 'type' => 'color'), 'social_bg_color' => array('label' => esc_html__('Sharing Box Background Color', 'Avada'), 'description' => esc_html__('Controls the background color of the social sharing boxes.', 'Avada'), 'id' => 'social_bg_color', 'default' => '#f6f6f6', 'type' => 'color-alpha'), 'social_share_box_icon_info' => array('label' => esc_html__('Social Sharing Box Icons', 'Avada'), 'description' => '', 'id' => 'social_share_box_icon_info', 'icon' => true, 'type' => 'info'), 'sharing_social_links_font_size' => array('label' => esc_html__('Sharing Box Icon Font Size', 'Avada'), 'description' => esc_html__('Controls the font size of the social icons in the social sharing boxes.', 'Avada'), 'id' => 'sharing_social_links_font_size', 'default' => '16px', 'type' => 'dimension'), 'sharing_social_links_tooltip_placement' => array('label' => esc_html__('Sharing Box Icons Tooltip Position', 'Avada'), 'description' => esc_html__('Controls the tooltip position of the social icons in the social sharing boxes.', 'Avada'), 'id' => 'sharing_social_links_tooltip_placement', 'default' => 'Top', 'type' => 'radio-buttonset', 'choices' => array('Top' => esc_html__('Top', 'Avada'), 'Right' => esc_html__('Right', 'Avada'), 'Bottom' => esc_html__('Bottom', 'Avada'), 'Left' => esc_html__('Left', 'Avada'), 'None' => esc_html__('None', 'Avada'))), 'sharing_social_links_color_type' => array('label' => esc_html__('Sharing Box Icon Color Type', 'Avada'), 'description' => esc_html__('Custom colors allow you to choose a color for icons and boxes. Brand colors will use the exact brand color of each network for the icons or boxes.', 'Avada'), 'id' => 'sharing_social_links_color_type', 'default' => 'custom', 'type' => 'radio-buttonset', 'choices' => array('custom' => esc_html__('Custom Colors', 'Avada'), 'brand' => esc_html__('Brand Colors', 'Avada'))), 'sharing_social_links_icon_color' => array('label' => esc_html__('Sharing Box Icon Color', 'Avada'), 'description' => esc_html__('Controls the color of the social icons in the social sharing boxes. This color will be used for all social icons.', 'Avada'), 'id' => 'sharing_social_links_icon_color', 'default' => '#bebdbd', 'type' => 'color', 'required' => array(array('setting' => 'sharing_social_links_color_type', 'operator' => '==', 'value' => 'custom'))), 'sharing_social_links_boxed' => array('label' => esc_html__('Sharing Box Icons Boxed', 'Avada'), 'description' => esc_html__('Controls if each social icon is displayed in a small box.', 'Avada'), 'id' => 'sharing_social_links_boxed', 'default' => '0', 'type' => 'switch'), 'sharing_social_links_box_color' => array('label' => esc_html__('Sharing Box Icon Box Color', 'Avada'), 'description' => esc_html__('Controls the color of the social icon box.', 'Avada'), 'id' => 'sharing_social_links_box_color', 'default' => '#e8e8e8', 'type' => 'color-alpha', 'required' => array(array('setting' => 'sharing_social_links_boxed', 'operator' => '==', 'value' => '1'), array('setting' => 'sharing_social_links_color_type', 'operator' => '==', 'value' => 'custom'))), 'sharing_social_links_boxed_radius' => array('label' => esc_html__('Sharing Box Icon Boxed Radius', 'Avada'), 'description' => esc_html__('Controls the box radius of the social icon box.', 'Avada'), 'id' => 'sharing_social_links_boxed_radius', 'default' => '4px', 'type' => 'dimension', 'required' => array(array('setting' => 'sharing_social_links_boxed', 'operator' => '==', 'value' => '1'))), 'sharing_social_links_boxed_padding' => array('label' => esc_html__('Sharing Box Icons Boxed Padding', 'Avada'), 'description' => esc_html__('Controls the interior padding of the social icon box.', 'Avada'), 'id' => 'sharing_social_links_boxed_padding', 'default' => '8px', 'type' => 'dimension', 'required' => array(array('setting' => 'sharing_social_links_boxed', 'operator' => '==', 'value' => '1'))), 'social_share_box_links_title' => array('label' => esc_html__('Sharing Box Links', 'Avada'), 'description' => '', 'id' => 'social_share_box_links_title', 'icon' => true, 'type' => 'info'), 'sharing_facebook' => array('label' => esc_html__('Facebook', 'Avada'), 'description' => sprintf(esc_html__('Turn on to display %s in the social share box.', 'Avada'), esc_html__('Facebook', 'Avada')), 'id' => 'sharing_facebook', 'default' => '1', 'type' => 'toggle'), 'sharing_twitter' => array('label' => esc_html__('Twitter', 'Avada'), 'description' => sprintf(esc_html__('Turn on to display %s in the social share box.', 'Avada'), esc_html__('Twitter', 'Avada')), 'id' => 'sharing_twitter', 'default' => '1', 'type' => 'toggle'), 'sharing_reddit' => array('label' => esc_html__('Reddit', 'Avada'), 'description' => sprintf(esc_html__('Turn on to display %s in the social share box.', 'Avada'), esc_html__('Reddit', 'Avada')), 'id' => 'sharing_reddit', 'default' => '1', 'type' => 'toggle'), 'sharing_linkedin' => array('label' => esc_html__('LinkedIn', 'Avada'), 'description' => sprintf(esc_html__('Turn on to display %s in the social share box.', 'Avada'), esc_html__('LinkedIn', 'Avada')), 'id' => 'sharing_linkedin', 'default' => '1', 'type' => 'toggle'), 'sharing_google' => array('label' => esc_html__('Google+', 'Avada'), 'description' => sprintf(esc_html__('Turn on to display %s in the social share box.', 'Avada'), esc_html__('Google+', 'Avada')), 'id' => 'sharing_google', 'default' => '1', 'type' => 'toggle'), 'sharing_tumblr' => array('label' => esc_html__('Tumblr', 'Avada'), 'description' => sprintf(esc_html__('Turn on to display %s in the social share box.', 'Avada'), esc_html__('Tumblr', 'Avada')), 'id' => 'sharing_tumblr', 'default' => '1', 'type' => 'toggle'), 'sharing_pinterest' => array('label' => esc_html__('Pinterest', 'Avada'), 'description' => sprintf(esc_html__('Turn on to display %s in the social share box.', 'Avada'), esc_html__('Pinterest', 'Avada')), 'id' => 'sharing_pinterest', 'default' => '1', 'type' => 'toggle'), 'sharing_vk' => array('label' => esc_html__('VK', 'Avada'), 'description' => sprintf(esc_html__('Turn on to display %s in the social share box.', 'Avada'), esc_html__('VK', 'Avada')), 'id' => 'sharing_vk', 'default' => '1', 'type' => 'toggle'), 'sharing_email' => array('label' => esc_html__('Email', 'Avada'), 'description' => sprintf(esc_html__('Turn on to display %s in the social share box.', 'Avada'), esc_html__('Email', 'Avada')), 'id' => 'sharing_email', 'default' => '1', 'type' => 'toggle'))))); return $sections; }
/** * Renders all soical icons not belonging to shortcodes * * @since 3.5.0 * @param array $args Holding all necessarry data for social icons * @return string The HTML mark up for social icons, incl. wrapping container */ public function render_social_icons($args) { parent::$args = $args; $html = ''; $icons = ''; // Get the social networks setting $social_networks = Avada()->settings->get('social_media_icons'); // Get a list of all the available social networks $social_networks_full_array = Avada_Data::fusion_social_icons(true, true); // Count how many social icons we have $count = count($social_networks); // Get the default color values for social media depending on their location $footer_social_links_icon_color = Avada()->settings->get('footer_social_links_icon_color'); $footer_social_links_box_color = Avada()->settings->get('footer_social_links_box_color'); $header_social_links_icon_color = Avada()->settings->get('header_social_links_icon_color'); $header_social_links_box_color = Avada()->settings->get('header_social_links_box_color'); $use_brand_colors = false; if (isset(parent::$args['position'])) { if ('footer' == parent::$args['position']) { if ('brand' == Avada()->settings->get('footer_social_links_color_type')) { $use_brand_colors = true; } } else { if ('brand' == Avada()->settings->get('header_social_links_color_type')) { $use_brand_colors = true; } } } // Check that we have social networks defined before proceeding if (!empty($social_networks) && isset($social_networks['url']) && !empty($social_networks['url'])) { for ($i = 0; $i <= count($social_networks['url']) - 1; $i++) { // Get the icon's arguments $icon = isset($social_networks['icon'][$i]) ? str_replace('_link', '', $social_networks['icon'][$i]) : false; $url = isset($social_networks['url'][$i]) && !empty($social_networks['url'][$i]) ? $social_networks['url'][$i] : false; $header_box_color = isset($social_networks['header_box_color'][$i]) && !empty($social_networks['header_box_color'][$i]) ? $social_networks['header_box_color'][$i] : false; $footer_box_color = isset($social_networks['footer_box_color'][$i]) && !empty($social_networks['footer_box_color'][$i]) ? $social_networks['footer_box_color'][$i] : false; $custom_title = isset($social_networks['custom_title'][$i]) && !empty($social_networks['custom_title'][$i]) ? $social_networks['custom_title'][$i] : ''; $custom_source = isset($social_networks['custom_source'][$i]) && isset($social_networks['custom_source'][$i]['url']) && !empty($social_networks['custom_source'][$i]['url']) ? $social_networks['custom_source'][$i]['url'] : ''; $custom_source_height = isset($social_networks['custom_source'][$i]) && isset($social_networks['custom_source'][$i]['height']) && !empty($social_networks['custom_source'][$i]['height']) ? $social_networks['custom_source'][$i]['height'] : ''; $custom_source_width = isset($social_networks['custom_source'][$i]) && isset($social_networks['custom_source'][$i]['width']) && !empty($social_networks['custom_source'][$i]['width']) ? $social_networks['custom_source'][$i]['width'] : ''; // Hack for Google+ if (in_array($icon, array('google', 'gplus'))) { $icon = 'googleplus'; } // Make sure we have a URL & an icon defined if ($icon && $url) { $icon_args = array('icon' => $icon, 'url' => $url); $icon_args['icon_color'] = Avada()->settings->get('header_social_links_icon_color'); $icon_args['box_color'] = Avada()->settings->get('header_social_links_box_color'); // Use footer args when appropriate if (isset(parent::$args['position']) && 'footer' == parent::$args['position']) { $icon_args['icon_color'] = Avada()->settings->get('footer_social_links_icon_color'); $icon_args['box_color'] = Avada()->settings->get('footer_social_links_box_color'); } if ($use_brand_colors) { $brand_icon = 'googleplus' == $icon ? 'gplus' : $icon; $brand_color = $social_networks_full_array[$brand_icon]['color']; $icon_args['icon_color'] = parent::$args['icon_boxed'] ? '#ffffff' : $social_networks_full_array[$brand_icon]['color']; $icon_args['box_color'] = parent::$args['icon_boxed'] ? $social_networks_full_array[$brand_icon]['color'] : 'transparent'; } // Check if are on the last social icon $icon_args['last'] = $count == $i ? true : false; // Custom icons if ('custom' == $icon && !empty($custom_source)) { $icon_args['custom_source'] = $custom_source; $icon_args['custom_source_height'] = $custom_source_height; $icon_args['custom_source_width'] = $custom_source_width; $icon_args['custom_title'] = $custom_title; } $icons .= parent::get_markup($icon_args); } } } if (!empty($icons)) { $attr = array('class' => 'fusion-social-networks'); if (parent::$args['icon_boxed']) { $attr['class'] .= ' boxed-icons'; } $html = '<div ' . fusion_attr('social-icons-class-social-networks', $attr) . '><div ' . fusion_attr('fusion-social-networks-wrapper') . '>' . $icons; if (isset(parent::$args['position']) && ('header' == parent::$args['position'] || 'footer' == parent::$args['position'])) { $html .= '</div></div>'; } else { $html .= '<div class="fusion-clearfix"></div></div></div>'; } } return $html; }
/** * Font-Awesome icon handler. * Adds compatibility with order versions of FA icon names. */ function avada_font_awesome_name_handler($icon) { $old_icons = Avada_Data::old_icons(); if ('icon-' == substr($icon, 0, 5) || 'fa=' != substr($icon, 0, 3)) { // Replace old prefix with new one $icon = str_replace('icon-', 'fa-', $icon); if (array_key_exists(str_replace('fa-', '', $icon), $old_icons)) { $fa_icon = 'fa-' . $old_icons[str_replace('fa-', '', $icon)]; } else { $fa_icon = 'fa-' != substr($icon, 0, 3) ? 'fa-' . $icon : $icon; } } else { $fa_icon = 'fa-' != substr($icon, 0, 3) ? 'fa-' . $icon : $icon; } return $fa_icon; }
/** * Convert a field */ public function create_field($field, $section_id = null) { $args = array(); $args['section_id'] = $section_id; $args['title'] = isset($field['label']) ? $field['label'] : ''; $args['subtitle'] = isset($field['description']) ? $field['description'] : ''; $args['description'] = isset($field['help']) ? $field['help'] : ''; $args['class'] = isset($field['class']) ? $field['class'] . ' avada_options' : 'avada_options'; $args['options'] = isset($field['choices']) ? $field['choices'] : array(); $args['required'] = array(); if (isset($field['required']) && is_array($field['required']) && !empty($field['required'])) { foreach ($field['required'] as $requirement) { $requirement['operator'] = '==' == $requirement['operator'] ? '=' : $requirement['operator']; $args['required'][] = array($requirement['setting'], $requirement['operator'], $requirement['value']); } } elseif (isset($args['required'])) { unset($args['required']); } // This will allow us to have an 'options_mode' setting. // We can have 'simple', 'advanced' etc there, and options will be shown depending on our selection. if (isset($field['option_mode'])) { if (!isset($args['required'])) { $args['required'] = array(); } $args['required'][] = array('options_mode', '=', $field['option_mode']); } if (!isset($field['type'])) { return; } $font_size_dimension_fields = array('meta_font_size', 'es_title_font_size', 'es_caption_font_size', 'ec_sidew_font_size', 'image_rollover_icon_size', 'pagination_font_size', 'form_input_height', 'copyright_font_size', 'tagline_font_size', 'header_sticky_nav_font_size', 'page_title_font_size', 'page_title_subheader_font_size', 'breadcrumbs_font_size', 'content_box_title_size', 'content_box_icon_size', 'counter_box_title_size', 'counter_box_icon_size', 'counter_box_body_size', 'social_links_font_size', 'sidew_font_size', 'slider_arrow_size', 'slidingbar_font_size', 'header_social_links_font_size', 'footer_social_links_font_size', 'sharing_social_links_font_size', 'post_titles_font_size', 'post_titles_font_lh', 'post_titles_extras_font_size', 'woo_icon_font_size'); switch ($field['type']) { case 'color': if (!isset($field['transparent'])) { $args['transparent'] = false; } $args['validate_callback'] = 'avada_avadaredux_validate_color_hex'; break; case 'code': $args['type'] = 'ace_editor'; $args['mode'] = isset($args['options']) && isset($args['options']['language']) ? $args['options']['language'] : 'css'; $args['theme'] = isset($args['choices']) && isset($args['choices']['theme']) ? $args['choices']['theme'] : 'chrome'; $args['options']['minLines'] = !isset($args['options']['minLines']) ? 18 : $args['options']['minLines']; $args['options']['maxLines'] = !isset($args['options']['maxLines']) ? 30 : $args['options']['maxLines']; if ('custom_css' == $field['id']) { $args['full_width'] = true; } break; case 'radio-buttonset': $args['type'] = 'button_set'; break; case 'dimension': $args['type'] = 'text'; $args['class'] .= ' dimension'; $args['options'] = ''; $args['validate_callback'] = 'avada_avadaredux_validate_dimension'; if (in_array($field['id'], $font_size_dimension_fields)) { // $args['subtitle'] = sprintf( esc_html__( '%s Enter value including a CSS unit, ex: %s. Valid CSS units for this field are px, em, rem.', 'Avada' ), $args['subtitle'], $field['default'] ); $args['validate_callback'] = 'avada_avadaredux_validate_font_size'; $args['subtitle'] = sprintf(esc_html__('%s Enter value including CSS unit (px, em, rem), ex: %s.', 'Avada'), $args['subtitle'], $field['default']); } else { $args['subtitle'] = sprintf(esc_html__('%s Enter value including any valid CSS unit, ex: %s.', 'Avada'), $args['subtitle'], $field['default']); } break; case 'dimensions': if ('lightbox_video_dimensions' == $field['id']) { $args['subtitle'] = sprintf(esc_html__('%s In pixels, ex: %s.', 'Avada'), $args['subtitle'], implode(', ', $field['default'])); } else { $args['subtitle'] = sprintf(esc_html__('%s Enter values including any valid CSS unit, ex: %s.', 'Avada'), $args['subtitle'], implode(', ', $field['default'])); } $args['validate_callback'] = 'avada_avadaredux_validate_dimensions'; break; case 'spacing': $args['top'] = isset($field['choices']) && isset($field['choices']['top']) ? true : false; $args['bottom'] = isset($field['choices']) && isset($field['choices']['bottom']) ? true : false; $args['left'] = isset($field['choices']) && isset($field['choices']['left']) ? true : false; $args['right'] = isset($field['choices']) && isset($field['choices']['right']) ? true : false; $args['validate_callback'] = 'avada_avadaredux_validate_dimensions'; $args['subtitle'] = sprintf(esc_html__('%s Enter values including any valid CSS unit, ex: %s.', 'Avada'), $args['subtitle'], implode(', ', $field['default'])); break; case 'number': $args['type'] = 'spinner'; if (isset($field['choices']) && isset($field['choices']['min'])) { $args['min'] = $field['choices']['min']; } if (isset($field['choices']) && isset($field['choices']['max'])) { $args['max'] = $field['choices']['max']; } if (isset($field['choices']) && isset($field['choices']['step'])) { $args['step'] = $field['choices']['step']; } break; case 'select': $args['width'] = 'width:100%;'; $args['select2'] = array('minimumResultsForSearch' => '-1', 'allowClear' => false); break; case 'slider': $not_in_pixels = array('carousel_speed', 'counter_box_speed', 'testimonials_speed', 'slidingbar_widgets_columns', 'footer_widgets_columns', 'blog_grid_columns', 'excerpt_length_blog', 'excerpt_length_portfolio', 'posts_slideshow_number', 'slideshow_speed', 'tfes_interval', 'tfes_speed', 'lightbox_slideshow_speed', 'lightbox_opacity', 'map_zoom_level', 'search_results_per_page', 'number_related_posts', 'related_posts_columns', 'related_posts_speed', 'related_posts_swipe_items', 'pw_jpeg_quality', 'portfolio_items', 'woo_items', 'woocommerce_shop_page_columns', 'woocommerce_related_columns', 'woocommerce_archive_page_columns', 'typography_sensitivity', 'typography_factor'); if (!in_array($field['id'], $not_in_pixels)) { $args['subtitle'] = $args['subtitle'] . ' ' . esc_html__('In pixels.', 'Avada'); } if (isset($field['choices']) && isset($field['choices']['min'])) { $args['min'] = $field['choices']['min']; } if (isset($field['choices']) && isset($field['choices']['max'])) { $args['max'] = $field['choices']['max']; } if (isset($field['choices']) && isset($field['choices']['step'])) { $args['step'] = $field['choices']['step']; } if (isset($field['choices']['step']) && 1 > $field['choices']['step']) { $args['resolution'] = 0.1; if (0.1 > $field['choices']['step']) { $args['resolution'] = 0.01; } elseif (0.01 > $field['choices']['step']) { $args['resolution'] = 0.001; } } break; case 'switch': case 'toggle': $args['type'] = 'switch'; if (isset($field['choices']) && isset($field['choices']['on'])) { $args['on'] = $field['choices']['on']; } if (isset($field['choices']) && isset($field['choices']['off'])) { $args['off'] = $field['choices']['off']; } break; case 'color-alpha': $args['type'] = 'color_alpha'; $args['transparent'] = false; $args['validate_callback'] = 'avada_avadaredux_validate_color_rgba'; break; case 'preset': $args['type'] = 'image_select'; $args['presets'] = true; $args['options'] = array(); foreach ($field['choices'] as $choice => $choice_args) { if (is_array($choice_args)) { $args['options'][$choice] = array('alt' => $choice_args['label'], 'img' => $choice_args['image'], 'presets' => $choice_args['settings']); } } break; case 'radio-image': $args['type'] = 'image_select'; $args['options'] = array(); foreach ($field['choices'] as $id => $url) { $args['options'][$id] = array('alt' => $id, 'img' => $url); } if ('header_layout' == $field['id']) { $args['full_width'] = true; } break; case 'upload': case 'media': $args['type'] = 'media'; if (isset($field['default']) && !is_array($field['default'])) { $args['default'] = '' == $field['default'] ? array() : ($args['default'] = array('url' => $field['default'])); } break; case 'radio': $args['options'] = array(); foreach ($field['choices'] as $choice => $label) { if (is_array($label)) { $args['options'][$choice] = '<span style="font-weight: bold; font-size: 1.1em; line-height: 2.2em;">' . $label[0] . '</span><p>' . $label[1] . '<p>'; } else { $args['options'][$choice] = $label; } } break; case 'multicheck': $args['type'] = 'checkbox'; break; case 'typography': $args['default'] = array(); if (isset($field['default'])) { if (isset($field['default']['font-weight'])) { $args['default']['font-weight'] = $field['default']['font-weight']; } if (isset($field['default']['font-size'])) { $args['default']['font-size'] = $field['default']['font-size']; } if (isset($field['default']['font-family'])) { $args['default']['font-family'] = $field['default']['font-family']; $args['default']['font-backup'] = true; $args['default']['google'] = true; } if (isset($field['default']['line-height'])) { $args['default']['line-height'] = $field['default']['line-height']; } if (isset($field['default']['word-spacing'])) { $args['default']['word-spacing'] = $field['default']['word-spacing']; } if (isset($field['default']['letter-spacing'])) { $args['default']['letter-spacing'] = $field['default']['letter-spacing']; } if (isset($field['default']['color'])) { $args['default']['color'] = $field['default']['color']; } if (isset($field['default']['text-align'])) { $args['default']['text-align'] = $field['default']['text-align']; } if (isset($field['default']['text-transform'])) { $args['default']['text-transform'] = $field['default']['text-transform']; } if (isset($field['default']['margin-top'])) { $args['default']['margin-top'] = $field['default']['margin-top']; } if (isset($field['default']['margin-bottom'])) { $args['default']['margin-bottom'] = $field['default']['margin-bottom']; } } $args['fonts'] = Avada_Data::standard_fonts(); $args['font-backup'] = true; $args['font-style'] = isset($args['default']['font-style']) || isset($field['choices']['font-style']) && $field['choices']['font-style'] ? true : false; $args['font-weight'] = isset($args['default']['font-weight']) || isset($field['choices']['font-weight']) && $field['choices']['font-weight'] ? true : false; $args['font-size'] = isset($args['default']['font-size']) || isset($field['choices']['font-size']) && $field['choices']['font-size'] ? true : false; $args['font-family'] = isset($args['default']['font-family']) || isset($field['choices']['font-family']) && $field['choices']['font-family'] ? true : false; $args['subsets'] = isset($args['default']['font-family']) || isset($field['choices']['font-family']) && $field['choices']['font-family'] ? true : false; $args['line-height'] = isset($args['default']['line-height']) || isset($field['choices']['line-height']) && $field['choices']['line-height'] ? true : false; $args['word-spacing'] = isset($args['default']['word-spacing']) || isset($field['choices']['word-spacing']) && $field['choices']['word-spacing'] ? true : false; $args['letter-spacing'] = isset($args['default']['word-spacing']) || isset($field['choices']['letter-spacing']) && $field['choices']['letter-spacing'] ? true : false; $args['text-align'] = isset($args['default']['text-align']) || isset($field['choices']['text-align']) && $field['choices']['text-align'] ? true : false; $args['text-transform'] = isset($args['default']['text-transform']) || isset($field['choices']['text-transform']) && $field['choices']['text-transform'] ? true : false; $args['color'] = isset($args['default']['color']) || isset($field['choices']['color']) && $field['choices']['color'] ? true : false; $args['margin-top'] = isset($args['default']['margin-top']) || isset($field['choices']['margin-top']) && $field['choices']['margin-top'] ? true : false; $args['margin-bottom'] = isset($args['default']['margin-bottom']) || isset($field['choices']['margin-bottom']) && $field['choices']['margin-bottom'] ? true : false; $args['select2'] = array('allowClear' => false); $args['validate_callback'] = 'avada_avadaredux_validate_typography'; break; case 'repeater': $args['fields'] = array(); $args['group_values'] = true; $args['sortable'] = true; $i = 0; foreach ($field['fields'] as $repeater_field_id => $repeater_field_args) { $repeater_field_args['label'] = isset($repeater_field_args['label']) ? $repeater_field_args['label'] : ''; $args['fields'][$i] = array('id' => $repeater_field_id, 'type' => isset($repeater_field_args['type']) ? $repeater_field_args['type'] : 'text', 'title' => $repeater_field_args['label'], 'placeholder' => isset($repeater_field_args['default']) ? $repeater_field_args['default'] : $repeater_field_args['label']); if (isset($repeater_field_args['choices'])) { $args['fields'][$i]['options'] = $repeater_field_args['choices']; } if (isset($repeater_field_args['type']) && 'select' == $repeater_field_args['type']) { $args['fields'][$i]['width'] = 'width:100%;'; $args['fields'][$i]['select2'] = array('minimumResultsForSearch' => '-1'); } if (isset($repeater_field_args['type']) && 'color' == $repeater_field_args['type']) { $args['fields'][$i]['transparent'] = false; } if (isset($repeater_field_args['type']) && 'upload' == $repeater_field_args['type']) { $args['fields'][$i]['type'] = 'media'; if (isset($repeater_field_args['mode'])) { $args['fields'][$i]['mode'] = $repeater_field_args['mode']; } if (isset($repeater_field_args['preview'])) { $args['fields'][$i]['preview'] = $repeater_field_args['preview']; } } $i++; } unset($args['options']); if ('custom_fonts' == $field['id']) { $args['validate_callback'] = 'avada_avadaredux_validate_custom_fonts'; } break; case 'accordion': $args['type'] = 'accordion'; $args['title'] = $field['label']; $args['subtitle'] = isset($field['description']) ? $field['description'] : ''; unset($field['fields']); unset($field['label']); unset($field['default']); unset($field['options']); break; case 'custom': $args['type'] = 'raw'; $args['full_width'] = true; if (isset($field['style']) && $field['style'] == 'heading') { $args['content'] = '<div class="avadaredux-field-info"><p class="avadaredux-info-desc" style="font-size:13px;"><b>' . $field['description'] . '</b></p></div>'; $args['class'] .= ' custom-heading'; } else { $args['content'] = $field['description']; $args['class'] .= ' custom-info'; } $args['description'] = ''; $args['subtitle'] = ''; $args['raw_html'] = true; break; } // Add validation to the email field if (isset($field['id']) && 'email_address' == $field['id']) { $args['validate'] = 'email'; } $args = wp_parse_args($args, $field); if (class_exists('AvadaRedux')) { AvadaRedux::setField($this->key, $args); } }
/** * migrate typography fields */ public function migrate_typography_fields($typography_options) { global $wpdb; $options = get_option(Avada::get_option_name(), array()); $is_custom_font = false; if (isset($options['custom_fonts'])) { if (isset($options['custom_fonts']['woff']) && !empty($options['custom_fonts']['woff'])) { if (isset($options['custom_fonts']['woff'][0]) && isset($options['custom_fonts']['woff'][0]['id'])) { $is_custom_font = true; $woff_path = get_attached_file($options['custom_fonts']['woff'][0]['id']); $custom_font_name = str_replace('.woff', '', basename($woff_path)); $custom_font_name = str_replace(' ', '-', $custom_font_name); } } } // Get subsets from gfont_settings $subset = false; if (isset($options['gfont_settings']) && !empty($options['gfont_settings'])) { if (false !== strpos($options['gfont_settings'], 'subset')) { $gfont_settings = wp_parse_args($options['gfont_settings'], array()); } else { $all_subsets = Avada_Data::font_subsets(); $gfont_settings = array(); foreach ($all_subsets as $available_subset) { if (false !== strpos($options['gfont_settings'], $available_subset)) { $gfont_settings['subset'][] = $available_subset; } } } if (isset($gfont_settings['subset']) && !empty($gfont_settings['subset'])) { if (is_array($gfont_settings['subset'])) { $subsets = $gfont_settings['subset']; } else { if (false !== strpos($gfont_settings['subset'], ',')) { $subsets = explode(',', $gfont_settings['subset']); } else { $all_subsets = Avada_Data::font_subsets(); $subsets = array(); foreach ($all_subsets as $available_subset) { if (false !== strpos($options['gfont_settings'], $available_subset)) { $subsets[] = $available_subset; } } } } if (1 < count($subsets)) { $subset = 'latin' == $subsets[0] ? $subsets[1] : $subsets[0]; } else { $subset = $subsets[0]; } } else { $subset = isset($gfont_settings['subset']) ? $gfont_settings['subset'] : false; } } $subset = 'latin' == $subset ? false : $subset; $this->fields = Avada_Options::get_option_fields(); foreach ($this->fields as $field) { if (isset($field['type'])) { /** * Convert typography fields */ if (isset($field['id']) && array_key_exists($field['id'], $typography_options)) { $options[$field['id']] = array(); /** * font-family */ if (isset($typography_options[$field['id']]['font-family'])) { if (is_array($typography_options[$field['id']]['font-family'])) { // standard fonts if (isset($typography_options[$field['id']]['font-family']['standard']) && isset($options[$typography_options[$field['id']]['font-family']['standard']])) { if (!in_array($options[$typography_options[$field['id']]['font-family']['standard']], array('', 'None', 'none', 'Select Font'))) { $options[$field['id']]['font-family'] = $options[$typography_options[$field['id']]['font-family']['standard']]; } elseif ('body_typography' != $field['id'] && isset($options['body_typography']['font-backup'])) { $options[$field['id']]['font-backup'] = $options['body_typography']['font-backup']; } } // google fonts if (isset($typography_options[$field['id']]['font-family']['google']) && isset($options[$typography_options[$field['id']]['font-family']['google']]) && !in_array($options[$typography_options[$field['id']]['font-family']['google']], array('', 'None', 'none'))) { $options[$field['id']]['font-family'] = $options[$typography_options[$field['id']]['font-family']['google']]; $options[$field['id']]['google'] = 'true'; // use standard font as backup font if (isset($typography_options[$field['id']]['font-family']['standard']) && isset($options[$typography_options[$field['id']]['font-family']['standard']])) { if (!in_array($options[$typography_options[$field['id']]['font-family']['standard']], array('', 'None', 'none', 'Select Font'))) { $options[$field['id']]['font-backup'] = $options[$typography_options[$field['id']]['font-family']['standard']]; } else { $options[$field['id']]['font-backup'] = 'Arial, Helvetica, sans-serif'; } } } // Handle custom-fonts if (isset($custom_font_name) && isset($typography_options[$field['id']]['font-family']['custom']) && true === $typography_options[$field['id']]['font-family']['custom'] && $is_custom_font) { $options[$field['id']]['font-family'] = $custom_font_name; } } else { $options[$field['id']]['font-family'] = $options[$typography_options[$field['id']]['font-family']]; } } /** * font-size */ if (isset($typography_options[$field['id']]['font-size'])) { if (isset($options[$typography_options[$field['id']]['font-size']]) && !isset($options[$field['id']]['font-size'])) { $options[$field['id']]['font-size'] = $options[$typography_options[$field['id']]['font-size']] . 'px'; } } /** * line-height */ if (isset($typography_options[$field['id']]['line-height']) && isset($options[$typography_options[$field['id']]['line-height']])) { $font_size = intval($options[$field['id']]['font-size']); $line_height = intval($options[$typography_options[$field['id']]['line-height']]); if (4 < $line_height) { $options[$field['id']]['line-height'] = round($line_height / $font_size, 2); } } /** * font-weight */ if (isset($typography_options[$field['id']]['font-weight'])) { if (isset($options[$typography_options[$field['id']]['font-weight']])) { $options[$field['id']]['font-weight'] = (int) $options[$typography_options[$field['id']]['font-weight']]; } } /** * letter-spacing */ if (isset($typography_options[$field['id']]['letter-spacing'])) { if (isset($options[$typography_options[$field['id']]['letter-spacing']])) { $options[$field['id']]['letter-spacing'] = intval($options[$typography_options[$field['id']]['letter-spacing']]) . 'px'; } } /** * color */ if (isset($typography_options[$field['id']]['color'])) { if (isset($options[$typography_options[$field['id']]['color']])) { $options[$field['id']]['color'] = $options[$typography_options[$field['id']]['color']]; } } /** * margin-top */ if (isset($typography_options[$field['id']]['margin-top'])) { if (isset($options[$typography_options[$field['id']]['margin-top']])) { // get the previous value $options[$field['id']]['margin-top'] = $options[$typography_options[$field['id']]['margin-top']]; // figure out the units we'll be using $units = isset($typography_options[$field['id']]['margin-units']) ? $typography_options[$field['id']]['margin-units'] : 'em'; // If numeric value is the same as the whole value, then we don't have units and we'll need to add them. if ($options[$field['id']]['margin-top'] == Avada_Sanitize::number($options[$field['id']]['margin-top'])) { // format the value: numeric + units $options[$field['id']]['margin-top'] = $options[$field['id']]['margin-top'] . $units; } } } /** * margin-bottom */ if (isset($typography_options[$field['id']]['margin-bottom'])) { if (isset($options[$typography_options[$field['id']]['margin-bottom']])) { // get the previous value $options[$field['id']]['margin-bottom'] = $options[$typography_options[$field['id']]['margin-bottom']]; // figure out the units we'll be using $units = isset($typography_options[$field['id']]['margin-units']) ? $typography_options[$field['id']]['margin-units'] : 'em'; // If numeric value is the same as the whole value, then we don't have units and we'll need to add them. if ($options[$field['id']]['margin-bottom'] == Avada_Sanitize::number($options[$field['id']]['margin-bottom'])) { // format the value: numeric + units $options[$field['id']]['margin-bottom'] = $options[$field['id']]['margin-bottom'] . $units; } } } /** * Add fallbacks to default values */ if (isset($all_new_fields[$field['id']]['default']['font-family']) && !isset($options[$field['id']]['font-family'])) { $options[$field['id']]['font-family'] = $all_new_fields[$field['id']]['default']['font-family']; } if (isset($all_new_fields[$field['id']]['default']['font-size']) && !isset($options[$field['id']]['font-size'])) { $options[$field['id']]['font-size'] = $all_new_fields[$field['id']]['default']['font-size']; } if (isset($all_new_fields[$field['id']]['default']['line-height']) && !isset($options[$field['id']]['line-height'])) { $options[$field['id']]['line-height'] = $all_new_fields[$field['id']]['default']['line-height']; } if (isset($all_new_fields[$field['id']]['default']['font-weight']) && !isset($options[$field['id']]['font-weight'])) { $options[$field['id']]['font-weight'] = $all_new_fields[$field['id']]['default']['font-weight']; } if (isset($all_new_fields[$field['id']]['default']['letter-spacing']) && !isset($options[$field['id']]['letter-spacing'])) { $options[$field['id']]['letter-spacing'] = $all_new_fields[$field['id']]['default']['letter-spacing']; } if (isset($all_new_fields[$field['id']]['default']['color']) && !isset($options[$field['id']]['color'])) { $options[$field['id']]['color'] = $all_new_fields[$field['id']]['default']['color']; } // add subsets if ($subset) { $options[$field['id']]['subsets'] = $subset; } } } } // Update the options with our modifications. update_option(Avada::get_option_name(), $options); }
public function form($instance) { $defaults = array('title' => __('Get Social', 'Avada'), 'linktarget' => '', 'icons_font_size' => '16px', 'icon_color' => '', 'boxed_icon' => 'No', 'boxed_color' => '', 'color_type' => 'custom', 'boxed_icon_radius' => '4px', 'boxed_icon_padding' => '8px', 'tooltip_pos' => 'top', 'rss_link' => '', 'fb_link' => '', 'twitter_link' => '', 'dribbble_link' => '', 'google_link' => '', 'linkedin_link' => '', 'blogger_link' => '', 'tumblr_link' => '', 'reddit_link' => '', 'yahoo_link' => '', 'deviantart_link' => '', 'vimeo_link' => '', 'youtube_link' => '', 'pinterest_link' => '', 'digg_link' => '', 'flickr_link' => '', 'forrst_link' => '', 'myspace_link' => '', 'skype_link' => '', 'instagram_link' => '', 'vk_link' => '', 'xing_link' => '', 'dropbox_link' => '', 'soundcloud_link' => '', 'paypal_link' => '', 'email_link' => '', 'show_custom' => 'No'); $instance = wp_parse_args((array) $instance, $defaults); ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title:', 'Avada'); ?> </label> <input class="widefat" type="text" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " value="<?php echo $instance['title']; ?> " /> </p> <p> <label for="<?php echo $this->get_field_id('linktarget'); ?> "><?php _e('Link Target:', 'Avada'); ?> </label> <input class="widefat" type="text" id="<?php echo $this->get_field_id('linktarget'); ?> " name="<?php echo $this->get_field_name('linktarget'); ?> " value="<?php echo $instance['linktarget']; ?> " /> </p> <p> <label for="<?php echo $this->get_field_id('icons_font_size'); ?> "><?php _e('Icons Font Size:', 'Avada'); ?> </label> <input class="widefat" type="text" id="<?php echo $this->get_field_id('icons_font_size'); ?> " name="<?php echo $this->get_field_name('icons_font_size'); ?> " value="<?php echo $instance['icons_font_size']; ?> " /> </p> <p> <label for="<?php echo $this->get_field_id('color_type'); ?> "><?php _e('Icons Color Type:', 'Avada'); ?> </label> <select id="<?php echo $this->get_field_id('color_type'); ?> " name="<?php echo $this->get_field_name('color_type'); ?> " class="widefat" style="width:100%;"> <option value="custom" <?php echo 'custom' == $instance['color_type'] ? 'selected="selected"' : ''; ?> ><?php _e('Custom Color', 'Avada'); ?> </option> <option value="brand" <?php echo 'brand' == $instance['color_type'] ? 'selected="selected"' : ''; ?> ><?php _e('Brand Colors', 'Avada'); ?> </option> </select> </p> <p class="avada-widget-color-type-option-child"> <label for="<?php echo $this->get_field_id('icon_color'); ?> "><?php _e('Icons Color Hex Code:', 'Avada'); ?> </label> <input class="widefat" type="text" id="<?php echo $this->get_field_id('icon_color'); ?> " name="<?php echo $this->get_field_name('icon_color'); ?> " value="<?php echo $instance['icon_color']; ?> " /> </p> <p> <label for="<?php echo $this->get_field_id('boxed_icon'); ?> "><?php _e('Icons Boxed:', 'Avada'); ?> </label> <select id="<?php echo $this->get_field_id('boxed_icon'); ?> " name="<?php echo $this->get_field_name('boxed_icon'); ?> " class="widefat" style="width:100%;"> <option value="No" <?php echo 'No' == $instance['boxed_icon'] ? 'selected="selected"' : ''; ?> ><?php _e('No', 'Avada'); ?> </option> <option value="Yes" <?php echo 'Yes' == $instance['boxed_icon'] ? 'selected="selected"' : ''; ?> ><?php _e('Yes', 'Avada'); ?> </option> </select> </p> <p class="avada-widget-color-type-option-child avada-widget-boxed-icon-background"> <label for="<?php echo $this->get_field_id('boxed_color'); ?> "><?php _e('Boxed Icons Background Color Hex Code:', 'Avada'); ?> </label> <input class="widefat" type="text" id="<?php echo $this->get_field_id('boxed_color'); ?> " name="<?php echo $this->get_field_name('boxed_color'); ?> " value="<?php echo $instance['boxed_color']; ?> " /> </p> <p class="avada-widget-boxed-icon-option-child"> <label for="<?php echo $this->get_field_id('boxed_icon_radius'); ?> "><?php _e('Boxed Icons Radius:', 'Avada'); ?> </label> <input class="widefat" type="text" id="<?php echo $this->get_field_id('boxed_icon_radius'); ?> " name="<?php echo $this->get_field_name('boxed_icon_radius'); ?> " value="<?php echo $instance['boxed_icon_radius']; ?> " /> </p> <p class="avada-widget-boxed-icon-option-child"> <label for="<?php echo $this->get_field_id('boxed_icon_padding'); ?> "><?php _e('Boxed Icons Padding:', 'Avada'); ?> </label> <input class="widefat" type="text" id="<?php echo $this->get_field_id('boxed_icon_padding'); ?> " name="<?php echo $this->get_field_name('boxed_icon_padding'); ?> " value="<?php echo $instance['boxed_icon_padding']; ?> " /> </p> <p> <label for="<?php echo $this->get_field_id('tooltip_pos'); ?> "><?php _e('Tooltip Position:', 'Avada'); ?> </label> <select id="<?php echo $this->get_field_id('tooltip_pos'); ?> " name="<?php echo $this->get_field_name('tooltip_pos'); ?> " class="widefat" style="width:100%;"> <option value="Top" <?php echo 'Top' == $instance['tooltip_pos'] ? 'selected="selected"' : ''; ?> ><?php _e('Top', 'Avada'); ?> </option> <option value="Right" <?php echo 'Right' == $instance['tooltip_pos'] ? 'selected="selected"' : ''; ?> ><?php _e('Right', 'Avada'); ?> </option> <option value="Bottom" <?php echo 'Bottom' == $instance['tooltip_pos'] ? 'selected="selected"' : ''; ?> ><?php _e('Bottom', 'Avada'); ?> </option> <option value="Left" <?php echo 'Left' == $instance['tooltip_pos'] ? 'selected="selected"' : ''; ?> ><?php _e('Left', 'Avada'); ?> </option> <option value="None" <?php echo 'None' == $instance['tooltip_pos'] ? 'selected="selected"' : ''; ?> ><?php _e('None', 'Avada'); ?> </option> </select> </p> <p> <label for="<?php echo $this->get_field_id('show_custom'); ?> "><?php _e('Show Custom Icons:', 'Avada'); ?> </label> <select id="<?php echo $this->get_field_id('show_custom'); ?> " name="<?php echo $this->get_field_name('show_custom'); ?> " class="widefat" style="width:100%;"> <option value="No" <?php echo 'No' == $instance['show_custom'] ? 'selected="selected"' : ''; ?> ><?php _e('No', 'Avada'); ?> </option> <option value="Yes" <?php echo 'Yes' == $instance['show_custom'] ? 'selected="selected"' : ''; ?> ><?php _e('Yes', 'Avada'); ?> </option> </select> </p> <?php // Create social network fields $social_networks_full_array = Avada_Data::fusion_social_icons(false, true); foreach ($social_networks_full_array as $key => $value) { if ('facebook' == $key) { $key = 'fb'; } elseif ('gplus' == $key) { $key = 'google'; } echo '<p>'; echo '<label for="' . $this->get_field_id($key . '_link') . '">' . sprintf(__('%s Link:', 'Avada'), $value['label']) . '</label>'; echo '<input class="widefat" type="text" id="' . $this->get_field_id($key . '_link') . '" name="' . $this->get_field_name($key . '_link') . '" value="' . $instance[$key . '_link'] . '" />'; echo '</p>'; } $color_type_id = $this->get_field_id('color_type'); $boxed_icon_id = $this->get_field_id('boxed_icon'); ?> <script type="text/javascript"> jQuery(document).ready(function($){ var $color_type_field = $("#<?php echo $color_type_id; ?> "); var $boxed_icon_field = $("#<?php echo $boxed_icon_id; ?> "); function checkBoxedIcons() { var color_type = $color_type_field.val(); var boxed_icon = $boxed_icon_field.val(); if ( boxed_icon === 'No' ) { $boxed_icon_field.parent().parent().find('.avada-widget-boxed-icon-option-child').hide(); $boxed_icon_field.parent().parent().find('.avada-widget-boxed-icon-background').hide(); } else { $boxed_icon_field.parent().parent().find('.avada-widget-boxed-icon-option-child').show(); if ( color_type === 'custom' ) { $boxed_icon_field.parent().parent().find('.avada-widget-boxed-icon-background').show(); } } } function checkColorType() { var color_type = $color_type_field.val(); var boxed_icon = $boxed_icon_field.val(); if ( color_type === 'brand' ) { $color_type_field.parent().parent().find('.avada-widget-color-type-option-child').hide(); } else { $color_type_field.parent().parent().find('.avada-widget-color-type-option-child').show(); if ( boxed_icon === 'No' ) { $boxed_icon_field.parent().parent().find('.avada-widget-boxed-icon-background').hide(); } } } checkColorType(); checkBoxedIcons(); $color_type_field.on('change', function() { checkColorType(); }); $boxed_icon_field.on('change', function() { checkBoxedIcons(); }); }); </script> <?php }