public function shortcode_icon($atts, $content = null) { extract(shortcode_atts(array('icon' => '', 'target_blank' => '1', 'link' => '#'), $atts)); static $social_icons = null; if (!$social_icons) { $social_icons = presscore_get_social_icons_data(); } if ('deviant' == $icon) { $icon = 'devian'; } elseif ('tumblr' == $icon) { $icon = 'tumbler'; } elseif ('500px' == $icon) { $icon = 'px-500'; } elseif (in_array($icon, array('youtube', 'YouTube'))) { $icon = 'you-tube'; } elseif (in_array($icon, array('tripedvisor', 'tripadvisor'))) { $icon = 'tripedvisor'; } $icon = in_array($icon, array_keys($social_icons)) ? $icon : ''; if (empty($icon)) { return ''; } $classes = array(); if (presscore_shortcode_animation_on(self::$atts['animation'])) { $classes[] = presscore_get_shortcode_animation_html_class(self::$atts['animation']); } $target_blank = apply_filters('dt_sanitize_flag', $target_blank) ? '_blank' : ''; $output = presscore_get_social_icon($icon, $link, $social_icons[$icon], $classes, $target_blank); return $output; }
function __construct() { /* Widget settings. */ $widget_ops = array('description' => _x('Contact info', 'widget', LANGUAGE_ZONE)); /* Create the widget. */ parent::__construct('presscore-contact-info-widget', DT_WIDGET_PREFIX . _x('Contact info', 'widget', LANGUAGE_ZONE), $widget_ops); if (function_exists('presscore_get_social_icons_data')) { self::$social_icons = presscore_get_social_icons_data(); } }
public function shortcode_icon($atts, $content = null) { extract(shortcode_atts(array('icon' => '', 'target_blank' => '1', 'link' => '#'), $atts)); static $social_icons = null; if (!$social_icons) { $social_icons = presscore_get_social_icons_data(); } if ('deviant' == $icon) { $icon = 'devian'; } elseif ('tumblr' == $icon) { $icon = 'tumbler'; } elseif ('500px' == $icon) { $icon = 'px-500'; } elseif (in_array($icon, array('youtube', 'YouTube'))) { $icon = 'you-tube'; } elseif (in_array($icon, array('tripedvisor', 'tripadvisor'))) { $icon = 'tripedvisor'; } $icon = in_array($icon, array_keys($social_icons)) ? $icon : ''; if (empty($icon)) { return ''; } $classes = array(); if (isset(self::$atts['animation']) && 'none' != self::$atts['animation']) { switch (self::$atts['animation']) { case 'scale': $classes[] = 'scale-up'; break; case 'fade': $classes[] = 'fade-in'; break; case 'left': $classes[] = 'right-to-left'; break; case 'right': $classes[] = 'left-to-right'; break; case 'bottom': $classes[] = 'top-to-bottom'; break; case 'top': $classes[] = 'bottom-to-top'; break; } $classes[] = 'animate-element'; } $target_blank = apply_filters('dt_sanitize_flag', $target_blank) ? '_blank' : ''; $output = presscore_get_social_icon($icon, $link, $social_icons[$icon], $classes, $target_blank); return $output; }
/** * Return links list for team post meta box. * * @return array. */ function presscore_get_team_links_array() { $team_links = array('website' => array('desc' => _x('Personal blog / website', 'team link', 'the7mk2')), 'mail' => array('desc' => _x('E-mail', 'team link', 'the7mk2'))); $common_links = presscore_get_social_icons_data(); if ($common_links) { foreach ($common_links as $key => $value) { if (isset($team_links[$key])) { continue; } $team_links[$key] = array('desc' => $value); } } return $team_links; }
/** * Display topbar social icons. Data grabbed from theme options. * */ function presscore_get_topbar_social_icons() { $saved_icons = of_get_option('header-soc_icons'); if (!is_array($saved_icons) || empty($saved_icons)) { return ''; } // reverse array coz it's have float: right and shown in front end in opposite order $saved_icons = array_reverse($saved_icons); $icons_data = presscore_get_social_icons_data(); $icons_white_list = array_keys($icons_data); $clean_icons = array(); foreach ($saved_icons as $saved_icon) { if (!is_array($saved_icon)) { continue; } if (empty($saved_icon['icon']) || !in_array($saved_icon['icon'], $icons_white_list)) { continue; } if (empty($saved_icon['url'])) { $saved_icon['url'] = '#'; } $icon = $saved_icon['icon']; $clean_icons[] = array('icon' => $icon, 'title' => $icons_data[$icon], 'link' => $saved_icon['url']); } $output = ''; if ($clean_icons) { $soc_icons_class = 'soc-ico'; if (of_get_option('top_bar-soc_icon_show_round_outlines', true)) { $soc_icons_class .= ' show-round'; } $output .= '<div class="' . $soc_icons_class . '">'; $output .= presscore_get_social_icons($clean_icons); $output .= '</div>'; } return $output; }
function presscore_theme_options_back_compatibility_check() { // top bar social icons if ( null === of_get_option( 'header-soc_icons', null ) ) { $theme_options = optionsframework_get_options(); if ( $theme_options ) { $social_icons = array(); $social_icons_data = presscore_get_social_icons_data(); $social_icons_list = array_keys($social_icons_data); foreach ( $social_icons_list as $icon ) { $icon_option_id = "top_bar-soc_ico_{$icon}"; if ( array_key_exists($icon_option_id, $theme_options) && !empty($theme_options[ $icon_option_id ]) ) { $social_icons[] = array( 'icon' => $icon, 'url' => $theme_options[ $icon_option_id ] ); } } $theme_options['header-soc_icons'] = $social_icons; update_option( optionsframework_get_options_id(), $theme_options ); } } }
/** * Return topbar social icons. Data grabbed from theme options. * * @since 1.0.0 * @return string */ function presscore_get_topbar_social_icons() { $opt_id = 'header-elements-soc_icons'; $saved_icons = of_get_option($opt_id); if (!$saved_icons || !is_array($saved_icons)) { return ''; } $icons_data = presscore_get_social_icons_data(); $icons_white_list = array_keys($icons_data); $clean_icons = array(); foreach ($saved_icons as $saved_icon) { if (!is_array($saved_icon) || empty($saved_icon['url']) || empty($saved_icon['icon']) || !in_array($saved_icon['icon'], $icons_white_list)) { continue; } $icon = $saved_icon['icon']; $clean_icons[] = array('icon' => $icon, 'title' => $icons_data[$icon], 'link' => $saved_icon['url']); } if (!$clean_icons) { return ''; } $classes = presscore_get_mini_widget_class($opt_id, 'soc-ico'); $classes[] = presscore_array_value(of_get_option("{$opt_id}-bg"), array('gradient' => 'gradient-bg', 'outline' => 'outline-style', 'accent' => 'accent-bg', 'color' => 'custom-bg', 'disabled' => 'disabled-bg')); $classes[] = presscore_array_value(of_get_option("{$opt_id}-hover-bg"), array('gradient' => 'hover-gradient-bg', 'outline' => 'outline-style-hover', 'accent' => 'hover-accent-bg', 'color' => 'hover-custom-bg', 'disabled' => 'hover-disabled-bg')); return '<div class="' . presscore_esc_implode(' ', $classes) . '">' . presscore_get_social_icons($clean_icons) . '</div>'; }
$options[] = array("name" => _x('Text', 'theme-options', 'presscore'), "id" => "top_bar-text", "std" => false, "type" => 'textarea'); $options[] = array("type" => "block_end"); /** * Social icons. */ $options[] = array("name" => _x('Social icons', 'theme-options', 'presscore'), "type" => "block_begin"); // colorpicker $options[] = array("desc" => '', "name" => _x('Color', 'theme-options', LANGUAGE_ZONE), "id" => "top_bar-soc_icon_color", "std" => "#828282", "type" => "color"); // radio $options[] = array("name" => _x('Hover', 'theme-options', LANGUAGE_ZONE), "id" => 'top_bar-soc_icon_hover', "std" => 'default', "type" => 'radio', "options" => array('default' => _x('accent color', 'theme-options', LANGUAGE_ZONE), 'custom' => _x('custom color', 'theme-options', LANGUAGE_ZONE)), 'show_hide' => array('custom' => true)); // hidden area $options[] = array('type' => 'js_hide_begin'); // colorpicker $options[] = array("name" => _x('Hover color', 'theme-options', LANGUAGE_ZONE), "id" => "top_bar-soc_icon_hover_color", "std" => "#2a83ed", "type" => "color"); $options[] = array('type' => 'js_hide_end'); // checkbox $options[] = array("name" => _x("Show round outlines", "theme-options", LANGUAGE_ZONE), "id" => "top_bar-soc_icon_show_round_outlines", "type" => "checkbox", "std" => 1); // divider $options[] = array("type" => "divider"); // fields_generator $options[] = array('id' => 'header-soc_icons', 'type' => 'fields_generator', 'std' => array(array('icon' => 'skype', 'url' => '#')), 'options' => array('fields' => array('icon' => array('type' => 'select', 'class' => 'of_fields_gen_title', 'description' => _x('Icon', 'theme-options', LANGUAGE_ZONE), 'wrap' => '<label>%2$s%1$s</label>', 'desc_wrap' => '%2$s', 'options' => presscore_get_social_icons_data()), 'url' => array('type' => 'text', 'description' => _x('Url', 'theme-options', LANGUAGE_ZONE), 'wrap' => '<label>%2$s%1$s</label>', 'desc_wrap' => '%2$s')))); $options[] = array("type" => "block_end"); if (class_exists('Woocommerce')) { /** * Woocommerce. */ $options[] = array("name" => _x('Woocommerce', 'theme-options', LANGUAGE_ZONE), "type" => "block_begin"); // radio $options[] = array("name" => _x('Show mini cart in top bar', 'theme-options', LANGUAGE_ZONE), "id" => 'general-woocommerce_show_mini_cart_in_top_bar', "std" => '1', "type" => 'checkbox'); $options[] = array("type" => "block_end"); }
$options[] = array("name" => _x('Text', 'theme-options', 'presscore'), "type" => "block_begin"); // textarea $options[] = array("desc" => _x('Text', 'theme-options', 'presscore'), "id" => "top_bar-text", "std" => false, "type" => 'textarea'); $options[] = array("type" => "block_end"); /** * Social icons. */ $options[] = array("name" => _x('Social icons', 'theme-options', 'presscore'), "type" => "block_begin"); // colorpicker $options[] = array("name" => '', "desc" => _x('Color', 'theme-options', LANGUAGE_ZONE), "id" => "top_bar-soc_icon_color", "std" => "#828282", "type" => "color"); // radio $options[] = array("desc" => _x('Hover', 'theme-options', LANGUAGE_ZONE), "id" => 'top_bar-soc_icon_hover', "std" => 'default', "type" => 'radio', "options" => array('default' => _x('accent color', 'theme-options', LANGUAGE_ZONE), 'custom' => _x('custom color', 'theme-options', LANGUAGE_ZONE)), 'show_hide' => array('custom' => true)); // hidden area $options[] = array('type' => 'js_hide_begin'); // colorpicker $options[] = array("desc" => _x('Hover color', 'theme-options', LANGUAGE_ZONE), "id" => "top_bar-soc_icon_hover_color", "std" => "#2a83ed", "type" => "color"); $options[] = array('type' => 'js_hide_end'); foreach (presscore_get_social_icons_data() as $value => $title) { // input $options[] = array("desc" => $title, "id" => "top_bar-soc_ico_{$value}", "std" => '', "type" => 'text', "sanitize" => 'url'); } $options[] = array("type" => "block_end"); if (class_exists('Woocommerce')) { /** * Woocommerce. */ $options[] = array("name" => _x('Woocommerce', 'theme-options', LANGUAGE_ZONE), "type" => "block_begin"); // radio $options[] = array("desc" => _x('Show mini cart in top bar', 'theme-options', LANGUAGE_ZONE), "id" => 'general-woocommerce_show_mini_cart_in_top_bar', "std" => '1', "type" => 'checkbox'); $options[] = array("type" => "block_end"); }
/** * Display topbar social icons. Data grabbed from theme options. * */ function presscore_get_topbar_social_icons() { $icons_data = presscore_get_social_icons_data(); $icons_white_list = array_keys($icons_data); $saved_icons = of_get_option('header-soc_icons'); $clean_icons = array(); if (!is_array($saved_icons) || empty($saved_icons)) { return ''; } foreach ($saved_icons as $saved_icon) { if (!is_array($saved_icon)) { continue; } if (empty($saved_icon['url']) || empty($saved_icon['icon']) || !in_array($saved_icon['icon'], $icons_white_list)) { continue; } $icon = $saved_icon['icon']; $clean_icons[] = array('icon' => $icon, 'title' => $icons_data[$icon], 'link' => $saved_icon['url']); } $output = ''; if ($clean_icons) { $class = ''; switch (of_get_option('header-soc_icon_bg_color_mode')) { case 'gradient': $class .= ' gradient-bg'; break; case 'outline': $class .= ' outline-style'; break; case 'accent': $class .= ' accent-bg'; break; case 'color': $class .= ' custom-bg'; break; case 'disabled': $class .= ' disabled-bg'; break; } switch (of_get_option('header-soc_icon_hover_bg_color_mode')) { case 'gradient': $class .= ' hover-gradient-bg'; break; case 'outline': $class .= ' outline-style-hover'; break; case 'accent': $class .= ' hover-accent-bg'; break; case 'color': $class .= ' hover-custom-bg'; break; case 'disabled': $class .= ' hover-disabled-bg'; break; } $output .= '<div class="soc-ico' . $class . '">'; $output .= presscore_get_social_icons($clean_icons); $output .= '</div>'; } return $output; }
/** * Display topbar social icons. Data grabbed from theme options. * */ function presscore_get_topbar_social_icons() { $icons_list = presscore_get_social_icons_data(); $icons_array = array(); foreach ($icons_list as $class => $title) { $icon_link = of_get_option("top_bar-soc_ico_{$class}"); if (!$icon_link) { continue; } $icons_array[$class] = array('title' => $title, 'link' => $icon_link); } $output = ''; if ($icons_array) { $output .= '<div class="soc-ico">'; $output .= presscore_get_social_icons($icons_array); $output .= '</div>'; } return $output; }