';
foreach ($active_networks as $network) {
$current_network_name = isset($essb_networks[$network]) ? $essb_networks[$network]["name"] : $network;
if ($position == '') {
$user_network_name = essb_option_value('user_network_name_'.$network);
if ($user_network_name == '') {
$user_network_name = $current_network_name;
}
}
else {
$user_network_name = essb_option_value($position.'_'.$network.'_name');
}
echo '
';
if ($position != '') {
echo '';
}
else {
echo '';
}
echo '';
echo '';
echo ''.$current_network_name.'';
echo '';
if ($position != '') {
echo __('Personalize text on button:', 'essb').'
';
}
else {
echo __('Personalize text on button:', 'essb').'
';
}
echo '';
echo '';
}
$network = 'add';
echo '';
echo '';
echo ''.__('Add more networks', 'essb').'';
echo '';
echo '';
}
function essb_component_base_dummy_share() {
return array("url" => "", "title" => "", "image" => "", "description" => "", "twitter_user" => "",
"twitter_hashtags" => "", "twitter_tweet" => "", "post_id" => 0, "user_image_url" => "", "title_plain" => "",
'short_url_whatsapp' => '', 'short_url_twitter' => '', 'short_url' => '', 'pinterest_image' => "", "full_url" => "");
}
function essb_component_base_dummy_style($user_counter = false, $counter_pos = '', $total_counter_pos = '') {
$style = array("button_style" => "button", "align" => "left", "button_width" => "auto", "counters" => false);
if ($user_counter) {
$style['show_counter'] = 1;
$style['counters'] = true;
if ($counter_pos != '') {
$style['counter_pos'] = $counter_pos;
}
if ($total_counter_pos != '') {
$style['total_counter_pos'] = $total_counter_pos;
}
$style['demo_counter'] = "yes";
}
else {
$style['show_counter'] = 0;
$style['counter_pos'] = 'hidden';
$style['total_counter_pos'] = 'hidden';
}
$style['button_align'] = 'left';
$style['counter_pos'] = 'hidden';
$style['total_counter_hidden_till'] = '';
$style['nospace'] = false;
$style['full_url'] = false;
$style['message_share_buttons'] = '';
$style['message_share_before_buttons'] = '';
$style['is_mobile'] = false;
$style['amp'] = false;
$style['native'] = false;
$style['total_counter_afterbefore_text'] = '';
return $style;
}
function essb_component_template_select($position = '', $options_group = 'essb_options') {
$value_field_id = 'style';
// position
if ($position != '') {
$value_field_id = $position.'_template';
}
$value_text_id = $value_field_id.'_text';
// selected value
$selected = essb_option_value('style');
if ($position != '') {
$position_selected = essb_option_value($position.'_template');
if ($position_selected != '') {
$selected = $position_selected;
}
}
if ($selected == '') {
$selected = '32';
}
$selected_name = '';
$templates = essb_available_tempaltes4();
foreach ($templates as $key => $name) {
if ($key == $selected ) {
$selected_name = $name;
}
}
echo '';
}
function essb_component_base_template_selection($position = '', $field_id = '', $field_text_id = '') {
$list_of_templates = essb_available_tempaltes4();
$selected = essb_option_value('style');
if ($position != '') {
$position_selected = essb_option_value($position.'_template');
if ($position_selected != '') {
$selected = $position_selected;
}
}
if ($selected == '') {
$selected = '32';
}
$button_style = essb_component_base_dummy_style();
echo '';
foreach ($list_of_templates as $key => $name) {
$button_style['template'] = $key;
echo '
';
echo '
'.$name.'
';
echo '
'.ESSBButtonHelper::draw_share_buttons(essb_component_base_dummy_share(), $button_style, array("facebook","twitter"), array("facebook","twitter","google"), array("facebook" => "Facebook", "twitter" => "Twitter", "google" => "Google"), "shortcode", "1112233").'
';
echo '
';
}
echo '
';
}
function essb_component_base_button_style_selection($position = '') {
$essb_available_buttons_style = array();
$essb_available_buttons_style ['button'] = __('Regular share buttons with icon & name/text', 'essb');
$essb_available_buttons_style ['button_name'] = __('Share button with name/text only (no icon)', 'essb');
$essb_available_buttons_style ['icon'] = __('Share button with icon only', 'essb');
$essb_available_buttons_style ['icon_hover'] = __('Share button with icon and name/text appearing on hover', 'essb');
$essb_available_buttons_style ['vertical'] = __('Vertical button', 'essb');
$selected = essb_option_value('button_style');
$template = essb_option_value('style');
if ($position != '') {
$position_selected = essb_option_value($position.'_button_style');
if ($position_selected != '') {
$selected = $position_selected;
}
}
if ($selected == '') {
$selected = 'button';
}
$button_style = essb_component_base_dummy_style();
echo '';
foreach ($essb_available_buttons_style as $key => $name) {
$button_style['template'] = $template;
$button_style['button_style'] = $key;
echo '
';
echo '
'.$name.'
';
echo '
'.ESSBButtonHelper::draw_share_buttons(essb_component_base_dummy_share(), $button_style, array("facebook","twitter"), array("facebook","twitter","google"), array("facebook" => "Facebook", "twitter" => "Twitter", "google" => "Google"), "shortcode", "1112233").'
';
echo '
';
}
echo '
';
}
function essb_component_buttonstyle_select($position = '', $options_group = 'essb_options') {
$value_field_id = 'button_style';
// position
if ($position != '') {
$value_field_id = $position.'_button_style';
}
$value_text_id = $value_field_id.'_text';
// selected value
$selected = essb_option_value('button_style');
if ($position != '') {
$position_selected = essb_option_value($position.'_button_style');
if ($position_selected != '') {
$selected = $position_selected;
}
}
if ($selected == '') {
$selected = 'button';
}
$selected_name = '';
$essb_available_buttons_style = array();
$essb_available_buttons_style ['button'] = __('Regular share buttons with icon & name/text', 'essb');
$essb_available_buttons_style ['button_name'] = __('Share button with name/text only (no icon)', 'essb');
$essb_available_buttons_style ['icon'] = __('Share button with icon only', 'essb');
$essb_available_buttons_style ['icon_hover'] = __('Share button with icon and name/text appearing on hover', 'essb');
$essb_available_buttons_style ['vertical'] = __('Vertical button', 'essb');
foreach ($essb_available_buttons_style as $key => $name) {
if ($key == $selected ) {
$selected_name = $name;
}
}
echo '';
}
function essb_component_base_counter_position_selection($position = '', $field_id = '', $field_text_id = '') {
$list_of_templates = essb_avaliable_counter_positions();
$selected = essb_option_value('counter_pos');
if ($position != '') {
$position_selected = essb_option_value($position.'_counter_pos');
if ($position_selected != '') {
$selected = $position_selected;
}
}
$template = essb_option_value('style');
if ($selected == '') {
$selected = 'hidden';
}
echo '';
foreach ($list_of_templates as $key => $name) {
$button_style = essb_component_base_dummy_style(true, $key, 'hidden');
$button_style['template'] = $template;
$button_style['counter_pos'] = $key;
echo '
';
echo '
'.$name.'
';
echo '
'.ESSBButtonHelper::draw_share_buttons(essb_component_base_dummy_share(), $button_style, array("facebook","twitter"), array("facebook","twitter","google"), array("facebook" => "Facebook", "twitter" => "Twitter", "google" => "Google"), "shortcode", "1112233").'
';
echo '
';
}
echo '
';
}
function essb_component_counterpos_select($position = '', $options_group = 'essb_options') {
$value_field_id = 'counter_pos';
// position
if ($position != '') {
$value_field_id = $position.'_counter_pos';
}
$value_text_id = $value_field_id.'_text';
// selected value
$selected = essb_option_value('counter_pos');
if ($position != '') {
$position_selected = essb_option_value($position.'_counter_pos');
if ($position_selected != '') {
$selected = $position_selected;
}
}
if ($selected == '') {
$selected = 'hidden';
}
$selected_name = '';
$list = essb_avaliable_counter_positions();
foreach ($list as $key => $name) {
if ($key == $selected ) {
$selected_name = $name;
}
}
echo '';
}
// Total Counter Position
function essb_component_base_total_counter_position_selection($position = '', $field_id = '', $field_text_id = '') {
$list_of_templates = essb_avaiable_total_counter_position();
$selected = essb_option_value('total_counter_pos');
if ($position != '') {
$position_selected = essb_option_value($position.'_total_counter_pos');
if ($position_selected != '') {
$selected = $position_selected;
}
}
$template = essb_option_value('style');
if ($selected == '') {
$selected = 'hidden';
}
echo '';
foreach ($list_of_templates as $key => $name) {
$button_style = essb_component_base_dummy_style(true, $key, 'hidden');
$button_style['template'] = $template;
$button_style['total_counter_pos'] = $key;
echo '
';
echo '
'.$name.'
';
echo '
'.ESSBButtonHelper::draw_share_buttons(essb_component_base_dummy_share(), $button_style, array("facebook","twitter"), array("facebook","twitter","google"), array("facebook" => "Facebook", "twitter" => "Twitter", "google" => "Google"), "shortcode", "1112233").'
';
echo '
';
}
echo '
';
}
function essb_component_totalcounterpos_select($position = '', $options_group = 'essb_options') {
$value_field_id = 'total_counter_pos';
// position
if ($position != '') {
$value_field_id = $position.'_total_counter_pos';
}
$value_text_id = $value_field_id.'_text';
// selected value
$selected = essb_option_value('total_counter_pos');
if ($position != '') {
$position_selected = essb_option_value($position.'_total_counter_pos');
if ($position_selected != '') {
$selected = $position_selected;
}
}
if ($selected == '') {
$selected = 'hidden';
}
$selected_name = '';
$list = essb_avaiable_total_counter_position();
foreach ($list as $key => $name) {
if ($key == $selected ) {
$selected_name = $name;
}
}
echo '';
}
function essb_component_options_group_select($field = '', $values = array(), $size = '', $default_value = '', $options_group = 'essb_options') {
$value = essb_option_value($field);
if ($default_value != '' && $value == '') {
$value = $default_value;
}
if ($size != '') {
$size = ' '.$size;
}
echo '';
echo '';
foreach ($values as $key => $data) {
$title = isset($data['title']) ? $data['title'] : '';
$content = isset($data['content']) ? $data['content'] : '';
$isText = isset($data['isText']) ? true: false;
$customPadding = isset($data['padding']) ? $data['padding'] : '';
if ($customPadding != '') {
$customPadding = ' style="padding:'.$customPadding.'"';
}
if ($isText) {
$content = ''.$content.'';
}
echo '';
echo $content;
echo '';
}
echo '
';
}
function essb_component_options_group_select_multiple($field = '', $values = array(), $size = '', $default_value = array(), $options_group = 'essb_options') {
$value = essb_option_value($field);
if (!is_array($default_value)) {
$default_value = array();
}
if ($size != '') {
$size = ' '.$size;
}
echo '';
foreach ($values as $key => $data) {
$title = isset($data['title']) ? $data['title'] : '';
$content = isset($data['content']) ? $data['content'] : '';
$isText = isset($data['isText']) ? true: false;
$customPadding = isset($data['padding']) ? $data['padding'] : '';
if ($customPadding != '') {
$customPadding = ' style="padding:'.$customPadding.'"';
}
if ($isText) {
$content = ''.$content.'';
}
$isChecked = in_array($key, $default_value);
echo '';
echo $content;
echo '';
echo '';
}
echo '
';
}
// Animations
function essb_component_base_animation_selection($position = '', $field_id = '', $field_text_id = '') {
$list_of_templates = essb_available_animations(true);
$selected = essb_option_value('css_animations');
$template = essb_option_value('style');
if ($selected == '') {
$selected = '';
}
echo '';
foreach ($list_of_templates as $key => $name) {
$button_style = essb_component_base_dummy_style(false, $key, 'hidden');
$button_style['template'] = $template;
$button_style['button_animation'] = $key;
echo '
';
echo '
'.$name.'
';
echo '
'.ESSBButtonHelper::draw_share_buttons(essb_component_base_dummy_share(), $button_style, array("facebook","twitter"), array("facebook","twitter","google"), array("facebook" => "Facebook", "twitter" => "Twitter", "google" => "Google"), "shortcode", "1112233").'
';
echo '
';
}
echo '
';
}
function essb_component_animation_select($position = '', $options_group = 'essb_options') {
$value_field_id = 'css_animations';
// position
if ($position != '') {
$value_field_id = $position.'_css_animations';
}
$value_text_id = $value_field_id.'_text';
// selected value
$selected = essb_option_value('css_animations');
if ($position != '') {
$position_selected = essb_option_value($position.'_css_animations');
if ($position_selected != '') {
$selected = $position_selected;
}
}
if ($selected == '') {
$selected = '';
}
$selected_name = '';
$list = essb_available_animations(true);
foreach ($list as $key => $name) {
if ($key == $selected ) {
$selected_name = $name;
}
}
echo '';
}
function essb_component_single_position_select($positions, $field_id = '', $options_group = 'essb_options') {
//var_dump($positions);
$value = essb_option_value($field_id);
echo '';
foreach ($positions as $key => $data) {
$image = isset($data['image']) ? $data['image'] : '';
$label = isset($data['label']) ? $data['label'] : '';
$desc = isset($data['desc']) ? $data['desc'] : '';
$link = isset($data['link']) ? $data['link'] : '';
//$link = 'test';
//$desc = 'Display share buttons at the begining of post content';
$pathToImages = ESSB3_PLUGIN_URL.'/';
if (strpos($image, 'http://') !== false || strpos($image, 'https://') !== false) {
$pathToImages = '';
}
echo '
';
echo '
';
echo '
';
if ($link != '') {
$link_parts = explode('|', $link);
echo '
';
}
echo '
';
echo '
'.$label;
if ($desc != '') {
echo '
'.$desc.'
';
}
echo '
';
echo '
';
}
echo '
';
echo '
';
}
function essb_component_multi_position_select($positions, $field_id = '', $options_group = 'essb_options') {
//var_dump($positions);
$value = essb_option_value($field_id);
if (!is_array($value)) {
$value = array();
}
echo '';
foreach ($positions as $key => $data) {
$image = isset($data['image']) ? $data['image'] : '';
$label = isset($data['label']) ? $data['label'] : '';
$desc = isset($data['desc']) ? $data['desc'] : '';
$link = isset($data['link']) ? $data['link'] : '';
$active = in_array($key, $value);
//$link = 'test';
//$desc = 'Display share buttons at the begining of post content';
$pathToImages = ESSB3_PLUGIN_URL.'/';
if (strpos($image, 'http://') !== false || strpos($image, 'https://') !== false) {
$pathToImages = '';
}
echo '
';
echo '
';
echo '
';
if ($link != '') {
$link_parts = explode('|', $link);
echo '
';
}
echo '
';
echo '
'.$label;
if ($desc != '') {
echo '
'.$desc.'
';
}
echo '
';
echo '
';
echo '
';
}
//echo '
';
echo '
';
}