/**
  * 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;
 }
 /**
  * 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)
 {
     $this->args = $args;
     if (isset($this->args['sharingbox']) && $this->args['sharingbox'] == 'yes') {
         $social_networks = $this->get_sharingbox_social_links_array($this->args);
     } elseif (isset($this->args['authorpage']) && $this->args['authorpage'] == 'yes') {
         $social_networks = $this->get_authorpage_social_links_array($this->args);
     } else {
         $social_networks = $this->get_social_links_array();
     }
     if (Avada()->settings->get('social_sorter')) {
         $order = Avada()->settings->get('social_sorter');
         $ordered_array = explode(',', $order);
         if (isset($ordered_array) && $ordered_array && is_array($ordered_array)) {
             $social_networks_old = $social_networks;
             $social_networks = array();
             foreach ($ordered_array as $key => $field_order) {
                 $field_order_number = str_replace('social_sorter_', '', $field_order);
                 $find_the_field = Avada()->settings->get('social_sorter_' . $field_order_number);
                 $field_name = str_replace('_link', '', Avada()->settings->get('social_sorter_' . $field_order_number));
                 if ($field_name == 'google') {
                     $field_name = 'googleplus';
                 }
                 if (!isset($social_networks_old[$field_name])) {
                     continue;
                 }
                 $social_networks[$field_name] = $social_networks_old[$field_name];
             }
         }
     }
     if (isset($social_networks_old['custom']) && $social_networks_old['custom']) {
         $social_networks['custom'] = $social_networks_old['custom'];
     }
     $icon_colors = explode('|', $this->args['icon_colors']);
     $num_of_icon_colors = count($icon_colors);
     $box_colors = explode('|', $this->args['box_colors']);
     $num_of_box_colors = count($box_colors);
     $html = $icons = '';
     for ($i = 0; $i < count($social_networks); $i++) {
         if ($num_of_icon_colors == 1) {
             $icon_colors[$i] = $icon_colors[0];
         }
         if ($num_of_box_colors == 1) {
             $box_colors[$i] = $box_colors[0];
         }
     }
     $i = 0;
     $number_of_social_networks = count($social_networks);
     foreach ($social_networks as $network => $link) {
         $custom = '';
         if ($network == 'custom') {
             $custom = sprintf('<img src="%s" alt="%s" />', Avada()->settings->get('custom_icon_image'), Avada()->settings->get('custom_icon_name'));
             $network = 'custom_' . Avada()->settings->get('custom_icon_name');
         }
         $icon_options = array('social_network' => $network, 'social_link' => $link);
         if (isset($icon_colors[$i]) && $icon_colors[$i]) {
             $icon_options['icon_color'] = $icon_colors[$i];
         } else {
             $icon_options['icon_color'] = '';
         }
         if (isset($box_colors[$i]) && $box_colors[$i]) {
             $icon_options['box_color'] = $box_colors[$i];
         } else {
             $icon_options['box_color'] = '';
         }
         // Chck if are on the last social icon; $i needs to be incremented first to make it match the count() value
         $i++;
         $icon_options['last'] = FALSE;
         if ($i == $number_of_social_networks) {
             $icon_options['last'] = TRUE;
         }
         $icons .= sprintf('<a %s>%s</a>', fusion_attr('social-icons-class-icon', $icon_options), $custom);
     }
     if ($icons) {
         if (isset($this->args['position']) && ($this->args['position'] == 'header' || $this->args['position'] == 'footer')) {
             $html = sprintf('<div %s><div %s>%s</div></div>', fusion_attr('social-icons-class-social-networks'), fusion_attr('fusion-social-networks-wrapper'), $icons);
         } else {
             $html = sprintf('<div %s><div %s>%s<div class="fusion-clearfix"></div></div></div>', fusion_attr('social-icons-class-social-networks'), fusion_attr('fusion-social-networks-wrapper'), $icons);
         }
     }
     return $html;
 }
 /**
  * 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;
 }
Esempio n. 4
0
 function before_slideshow()
 {
     echo '<div ' . fusion_attr('slideshow', get_the_ID()) . '>' . "\n";
     echo '<ul class="slides">';
 }
Esempio n. 5
0
 /**
  * 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)
 {
     global $smof_data;
     $this->args = $args;
     if (isset($this->args['sharingbox']) && $this->args['sharingbox'] == 'yes') {
         $social_networks = $this->get_sharingbox_social_links_array($this->args);
     } elseif (isset($this->args['authorpage']) && $this->args['authorpage'] == 'yes') {
         $social_networks = $this->get_authorpage_social_links_array($this->args);
     } else {
         $social_networks = $this->get_social_links_array();
     }
     /*if( ! array_key_exists( 'custom', $smof_data['social_icon_ordering'] ) ) {
     			$smof_data['social_icon_ordering']['custom'] = array();
     		}*/
     //$social_networks = $this->order_array_like_array( $social_networks, $smof_data['social_icon_ordering']['custom'] );
     //
     if (isset($smof_data['social_sorter']) && $smof_data['social_sorter']) {
         $order = $smof_data['social_sorter'];
         $ordered_array = explode(',', $order);
         if (isset($ordered_array) && $ordered_array && is_array($ordered_array)) {
             $social_networks_old = $social_networks;
             $social_networks = array();
             foreach ($ordered_array as $key => $field_order) {
                 $field_order_number = str_replace('social_sorter_', '', $field_order);
                 $find_the_field = $smof_data['social_sorter_' . $field_order_number];
                 $field_name = str_replace('_link', '', $smof_data['social_sorter_' . $field_order_number]);
                 if ($field_name == 'google') {
                     $field_name = 'googleplus';
                 } elseif ($field_name == 'email') {
                     $field_name = 'mail';
                 }
                 if (!isset($social_networks_old[$field_name])) {
                     continue;
                 }
                 $social_networks[$field_name] = $social_networks_old[$field_name];
             }
         }
     }
     if (isset($social_networks_old['custom']) && $social_networks_old['custom']) {
         $social_networks['custom'] = $social_networks_old['custom'];
     }
     $icon_colors = explode('|', $this->args['icon_colors']);
     $num_of_icon_colors = count($icon_colors);
     $box_colors = explode('|', $this->args['box_colors']);
     $num_of_box_colors = count($box_colors);
     $icons = '';
     for ($i = 0; $i < count($social_networks); $i++) {
         if ($num_of_icon_colors == 1) {
             $icon_colors[$i] = $icon_colors[0];
         }
         if ($num_of_box_colors == 1) {
             $box_colors[$i] = $box_colors[0];
         }
     }
     $i = 0;
     foreach ($social_networks as $network => $link) {
         $custom = '';
         if ($network == 'custom') {
             $custom = sprintf('<img src="%s" alt="%s" />', $smof_data['custom_icon_image'], $smof_data['custom_icon_name']);
             $network = 'custom_' . $smof_data['custom_icon_name'];
         }
         $icon_options = array('social_network' => $network, 'social_link' => $link);
         if (isset($icon_colors[$i]) && $icon_colors[$i]) {
             $icon_options['icon_color'] = $icon_colors[$i];
         } else {
             $icon_options['icon_color'] = '';
         }
         if (isset($box_colors[$i]) && $box_colors[$i]) {
             $icon_options['box_color'] = $box_colors[$i];
         } else {
             $icon_options['box_color'] = '';
         }
         $icons .= sprintf('<a %s>%s</a>', fusion_attr('social-icons-class-icon', $icon_options), $custom);
         $i++;
     }
     if ($this->args['position'] == 'header' || $this->args['position'] == 'footer') {
         $html = sprintf('<div %s>%s</div>', fusion_attr('social-icons-class-social-networks'), $icons);
     } else {
         $html = sprintf('<div %s>%s<div class="fusion-clearfix"></div></div>', fusion_attr('social-icons-class-social-networks'), $icons);
     }
     return $html;
 }