<?php
// -- Where to display buttons
$where_to_display = 'where';

if (class_exists('ESSBControlCenter')) {
	ESSBControlCenter::register_sidebar_section_menu($where_to_display, 'posts', esc_html__('Post Types', 'essb'));
	ESSBControlCenter::register_sidebar_section_menu($where_to_display, 'positions', esc_html__('Positions', 'essb'));
	ESSBControlCenter::register_sidebar_section_menu_sub($where_to_display, 'positions', 'positions_title', array('type' => 'title', 'value' => esc_html__('Share Button Positions', 'essb')));
	ESSBControlCenter::register_sidebar_section_menu_sub($where_to_display, 'positions', 'positions_menu', array('type' => 'menu', 'value' => array('positions' => esc_html__('Positions', 'essb'), 'positions_posttype' => esc_html__('Different Positions by Post Type', 'essb'))));
	ESSBControlCenter::register_sidebar_section_menu_sub($where_to_display, 'positions', 'positions_menu_split1', array('type' => 'splitter', 'value' => 'Position Settings', 'class' => ''));
	ESSBControlCenter::register_sidebar_section_menu_sub($where_to_display, 'positions', 'positions_desc1', array('type' => 'description', 'value' => esc_html('Configure additional options for the display positions you will use on your site.', 'essb')));


	$position_setup_list = array();
	$position_setup_list['display-4'] = esc_html__('Content Top', 'essb');
	$position_setup_list['display-5'] = esc_html__('Content Bottom', 'essb');

	if (!essb_options_bool_value('deactivate_method_float')) {
		$position_setup_list['display-6'] = esc_html__('Float From Top', 'essb');
	}

	if (!essb_options_bool_value('deactivate_method_followme')) {
		$position_setup_list['display-18'] = esc_html__('Follow me Share Bar', 'essb');
	}

	if (!essb_options_bool_value('deactivate_method_corner')) {
		$position_setup_list['display-19'] = esc_html__('Corner Bar', 'essb');
	}

	if (!essb_options_bool_value('deactivate_method_booster')) {
		$position_setup_list['display-20'] = esc_html__('Share Booster', 'essb');
	}

	if (!essb_options_bool_value('deactivate_method_sharebutton')) {
		$position_setup_list['display-21'] = esc_html__('Share Button', 'essb');
	}

	if (!essb_options_bool_value('deactivate_method_postfloat')) {
		$position_setup_list['display-7'] = esc_html__('Post Vertical Float', 'essb');
	}

	if (!essb_options_bool_value('deactivate_method_sidebar')) {
		$position_setup_list['display-8'] = esc_html__('Sidebar', 'essb');
	}

	if (!essb_options_bool_value('deactivate_method_topbar')) {
		$position_setup_list['display-9'] = esc_html__('Top Bar', 'essb');
	}

	if (!essb_options_bool_value('deactivate_method_bottombar')) {
		$position_setup_list['display-10'] = esc_html__('Bottom Bar', 'essb');
	}

	if (!essb_options_bool_value('deactivate_method_popup')) {
		$position_setup_list['display-11'] = esc_html__('Pop up', 'essb');
	}

	if (!essb_options_bool_value('deactivate_method_flyin')) {
		$position_setup_list['display-12'] = esc_html__('Fly in', 'essb');
	}

	if (!essb_option_bool_value('deactivate_method_image')) {
		$position_setup_list['display-13'] = esc_html__('On media', 'essb');
	}

	if (!essb_options_bool_value('deactivate_method_heroshare')) {
		$position_setup_list['display-14'] = esc_html__('Full Screen Hero Share', 'essb');
	}

	if (!essb_options_bool_value('deactivate_method_postbar')) {
		$position_setup_list['display-15'] = esc_html__('Post Share Bar', 'essb');
	}

	if (!essb_options_bool_value('deactivate_method_point')) {
		$position_setup_list['display-16'] = esc_html__('Point', 'essb');
	}

	if (!essb_option_bool_value('deactivate_method_except')) {
		$position_setup_list['display-17'] = esc_html__('Excerpt', 'essb');
	}

	if (function_exists('wc_get_product') && !essb_option_bool_value('deactivate_method_woocommerce')) {
		$position_setup_list['display-22'] = esc_html__('WooCommerce Content', 'essb');
	}

	// @since 4.1 allow usage of external display methods
	$essb_custom_methods = array();
	$essb_custom_methods = apply_filters('essb4_custom_method_list', $essb_custom_methods);
	foreach ($essb_custom_methods as $key => $title) {
		$position_setup_list[$key] = $title;
	}

	// @since 8.0 adding the mobile positions on the top
	if (!essb_options_bool_value('deactivate_method_additional_mobile')) {
		$position_setup_list['display-91'] = esc_html__('Mobile Share Bar', 'essb');
		$position_setup_list['display-92'] = esc_html__('Mobile Share Point', 'essb');
	}
	$position_setup_list['display-93'] = esc_html__('Mobile Share Buttons Bar', 'essb');

	ESSBControlCenter::register_sidebar_section_menu_sub($where_to_display, 'positions', 'positions_setup_menu', array('type' => 'menu', 'value' => $position_setup_list));

	if (!essb_option_bool_value('activate_automatic_mobile') && !essb_option_bool_value('deactivate_method_advanced_mobile')) {
		ESSBControlCenter::register_sidebar_section_menu($where_to_display, 'mobile', esc_html__('Advanced Mobile', 'essb'));

		if (essb_option_bool_value('mobile_positions') && essb_option_value('functions_mode_mobile') != 'auto' && essb_option_value('functions_mode_mobile') != 'deactivate') {

			$mobile_positions = array('bar' => esc_html__('Mobile Share Bar', 'essb'), 'point' => esc_html__('Mobile Share Point', 'essb'), 'buttons' => esc_html__('Mobile Share Buttons Bar', 'essb'), 'other' => esc_html('Customize Other Positions When Shown on Mobile', 'essb'));
			$essb_custom_methods = array();
			$essb_custom_methods = apply_filters('essb4_custom_method_list_mobile', $essb_custom_methods);
			foreach ($essb_custom_methods as $key => $title) {
				$mobile_positions[$key] = $title;
			}
			/**
			 * @since 8.0 - the mobile positions are migrated to the main position list (easier for the clients)
			 */
			$mobile_positions = array();

			ESSBControlCenter::register_sidebar_section_menu_sub($where_to_display, 'mobile', 'mobile_title', array('type' => 'title', 'value' => esc_html__('Mobile Display', 'essb')));
			ESSBControlCenter::register_sidebar_section_menu_sub($where_to_display, 'mobile', 'mobile_desc1', array('type' => 'description', 'value' => esc_html('Configure the appearance of the share buttons when a mobile display mode is active. If you are not sure about your setup than activate one of the mobile-optimized displays in combination with responsive mode.', 'essb')));
			ESSBControlCenter::register_sidebar_section_menu_sub($where_to_display, 'mobile', 'mobile_menu', array('type' => 'menu', 'value' => array('setup' => esc_html__('Setup', 'essb'), 'responsive' => esc_html__('Responsive Mode', 'essb'))));
			ESSBControlCenter::register_sidebar_section_menu_sub($where_to_display, 'mobile', 'mobile_menu_split1', array('type' => 'splitter', 'value' => '', 'class' => 'no-pt'));
			ESSBControlCenter::register_sidebar_section_menu_sub($where_to_display, 'mobile', 'mobile_desc2', array('type' => 'description', 'value' => esc_html('Configure additional visual options and network setups related to the dedicated mobile display.', 'essb')));
			ESSBControlCenter::register_sidebar_section_menu_sub($where_to_display, 'mobile', 'mobile_menu2', array('type' => 'menu', 'value' => $mobile_positions));
			ESSBControlCenter::register_sidebar_section_menu_sub($where_to_display, 'mobile', 'mobile_menu_split2', array('type' => 'splitter', 'value' => '', 'class' => 'no-pt'));
			ESSBControlCenter::register_sidebar_section_menu_sub($where_to_display, 'mobile', 'mobile_help_btn1', array('type' => 'button', 'value' => array('text' => esc_html__('How to setup responsive buttons', 'essb'), 'url' => 'https://docs.socialsharingplugin.com/knowledgebase/how-to-active-mobile-responsive-share-buttons-mode/', 'target' => '_blank')));
		}
	}

	if ((function_exists('is_amp_endpoint') || function_exists('ampforwp_is_amp_endpoint')) && essb_option_value('functions_mode') != 'light') {
		ESSBControlCenter::register_sidebar_section_menu($where_to_display, 'amp', esc_html__('AMP', 'essb'));
	}

	if (!essb_option_bool_value('deactivate_method_integrations')) {
		ESSBControlCenter::register_sidebar_section_menu($where_to_display, 'plugins', esc_html__('Plugins Integration', 'essb'));
	}

	if (!essb_option_bool_value('deactivate_custompositions')) {
		ESSBControlCenter::register_sidebar_section_menu($where_to_display, 'custom', esc_html__('Custom Positions / Displays', 'essb'));
	}

	ESSBControlCenter::register_sidebar_section_menu($where_to_display, 'deactivate', esc_html__('Deactivate Display', 'essb'));
}

ESSBOptionsStructureHelper::menu_item($where_to_display, 'posts', esc_html__('Post Types', 'essb'), ' ti-widget-alt');
ESSBOptionsStructureHelper::menu_item($where_to_display, 'positions', esc_html__('Positions', 'essb'), ' ti-widget-alt');
ESSBOptionsStructureHelper::menu_item($where_to_display, 'display', esc_html__('Position Settings', 'essb'), ' ti-layout-grid2-alt', 'activate_first', 'positions|display-4');
ESSBOptionsStructureHelper::submenu_item($where_to_display, 'positions|display-4', esc_html__('Content Top', 'essb'),  'default', 'menu');
ESSBOptionsStructureHelper::submenu_item($where_to_display, 'positions|display-5', esc_html__('Content Bottom', 'essb'),  'default', 'menu', '');
if (!essb_options_bool_value('deactivate_method_float')) {
	ESSBOptionsStructureHelper::submenu_item($where_to_display, 'display-6', esc_html__('Float from top', 'essb'),  'default', 'menu', '');
}

if (!essb_options_bool_value('deactivate_method_followme')) {
	ESSBOptionsStructureHelper::submenu_item($where_to_display, 'display-18', esc_html__('Follow me share bar', 'essb'),  'default', 'menu', '');
}

if (!essb_options_bool_value('deactivate_method_corner')) {
	ESSBOptionsStructureHelper::submenu_item($where_to_display, 'display-19', esc_html__('Corner Bar', 'essb'),  'default', 'menu', '');
}

if (!essb_options_bool_value('deactivate_method_booster')) {
	ESSBOptionsStructureHelper::submenu_item($where_to_display, 'display-20', esc_html__('Share Booster', 'essb'),  'default', 'menu', '');
}

if (!essb_options_bool_value('deactivate_method_sharebutton')) {
	ESSBOptionsStructureHelper::submenu_item($where_to_display, 'display-21', esc_html__('Share Button', 'essb'),  'default', 'menu', '');
}


if (!essb_options_bool_value('deactivate_method_postfloat')) {
	ESSBOptionsStructureHelper::submenu_item($where_to_display, 'display-7', esc_html__('Post vertical float', 'essb'),  'default', 'menu', '');
}
if (!essb_options_bool_value('deactivate_method_sidebar')) {
	ESSBOptionsStructureHelper::submenu_item($where_to_display, 'display-8', esc_html__('Sidebar', 'essb'),  'default', 'menu', '');
}
if (!essb_options_bool_value('deactivate_method_topbar')) {
	ESSBOptionsStructureHelper::submenu_item($where_to_display, 'display-9', esc_html__('Top bar', 'essb'),  'default', 'menu', '');
}
if (!essb_options_bool_value('deactivate_method_bottombar')) {
	ESSBOptionsStructureHelper::submenu_item($where_to_display, 'display-10', esc_html__('Bottom bar', 'essb'),  'default', 'menu', '');
}

if (!essb_options_bool_value('deactivate_method_popup')) {
	ESSBOptionsStructureHelper::submenu_item($where_to_display, 'display-11', esc_html__('Pop up', 'essb'),  'default', 'menu', '');
}

if (!essb_options_bool_value('deactivate_method_flyin')) {
	ESSBOptionsStructureHelper::submenu_item($where_to_display, 'display-12', esc_html__('Fly in', 'essb'),  'default', 'menu', '');
}

if (!essb_option_bool_value('deactivate_method_image')) {
	ESSBOptionsStructureHelper::submenu_item($where_to_display, 'display-13', esc_html__('On media', 'essb'),  'default', 'menu', '');
}

if (!essb_options_bool_value('deactivate_method_heroshare')) {
	ESSBOptionsStructureHelper::submenu_item($where_to_display, 'display-14', esc_html__('Full screen hero share', 'essb'),  'default', 'menu', '');
}

if (!essb_options_bool_value('deactivate_method_postbar')) {
	ESSBOptionsStructureHelper::submenu_item($where_to_display, 'display-15', esc_html__('Post share bar', 'essb'),  'default', 'menu', '');
}
if (!essb_options_bool_value('deactivate_method_point')) {
	ESSBOptionsStructureHelper::submenu_item($where_to_display, 'display-16', esc_html__('Point', 'essb'),  'default', 'menu', '');
}

if (!essb_option_bool_value('deactivate_method_except')) {
	ESSBOptionsStructureHelper::submenu_item($where_to_display, 'display-17', esc_html__('Excerpt', 'essb'),  'default', 'menu', '');
}

// @since 4.1 allow usage of external display methods
$essb_custom_methods = array();
$essb_custom_methods = apply_filters('essb4_custom_method_list', $essb_custom_methods);
foreach ($essb_custom_methods as $key => $title) {
	ESSBOptionsStructureHelper::submenu_item($where_to_display, $key, $title,  'default', 'menu', '', 'display');
}

if (!essb_option_bool_value('activate_automatic_mobile')) {
	ESSBOptionsStructureHelper::menu_item($where_to_display, 'mobile', esc_html__('Mobile', 'essb'), ' ti-mobile', 'activate_first', 'mobile-1');
	ESSBOptionsStructureHelper::submenu_item($where_to_display, 'mobile-1', esc_html__('Display Options', 'essb'));
	ESSBOptionsStructureHelper::submenu_item($where_to_display, 'mobile-2', esc_html__('Customize buttons when viewed from mobile device', 'essb'));
	ESSBOptionsStructureHelper::submenu_item($where_to_display, 'mobile-3', esc_html__('Share bar', 'essb'));
	ESSBOptionsStructureHelper::submenu_item($where_to_display, 'mobile-4', esc_html__('Share point', 'essb'));
	ESSBOptionsStructureHelper::submenu_item($where_to_display, 'mobile-5', esc_html__('Share buttons bar', 'essb'));

	$essb_custom_methods = array();
	$essb_custom_methods = apply_filters('essb4_custom_method_list_mobile', $essb_custom_methods);
	foreach ($essb_custom_methods as $key => $title) {
		ESSBOptionsStructureHelper::submenu_item($where_to_display, $key, $title);
	}
}

if ((function_exists('is_amp_endpoint') || function_exists('ampforwp_is_amp_endpoint')) && essb_option_value('functions_mode') != 'light') {
	ESSBOptionsStructureHelper::menu_item($where_to_display, 'amp', esc_html__('AMP Sharing', 'essb'), ' ti-widget-alt');
}

if (!essb_option_bool_value('deactivate_method_integrations')) {
	ESSBOptionsStructureHelper::menu_item($where_to_display, 'plugins', esc_html__('Plugin Integrations', 'essb'), ' ti-widget-alt');
}

// show or not custom positions
if (!essb_option_bool_value('deactivate_custompositions')) {
	ESSBOptionsStructureHelper::help($where_to_display, 'custom', '', '', array('Help With Settings' => 'https://docs.socialsharingplugin.com/knowledgebase/creating-custom-displays-positions-for-share-buttons-and-how-to-use-them/'));

	ESSBOptionsStructureHelper::menu_item($where_to_display, 'custom', esc_html__('Custom Positions/Displays', 'essb'), ' ti-widget-alt');
	ESSBOptionsStructureHelper::field_heading($where_to_display, 'custom', 'heading7', esc_html__('Custom Positions/Custom Share Buttons Display', 'essb'), '', 'pb0', '<i class="ti-widget-alt"></i>');
	ESSBOptionsStructureHelper::holder_start($where_to_display, 'custom', 'essb-related-heading7', '');
	ESSBOptionsStructureHelper::hint($where_to_display, 'custom', '', esc_html__('Custom positions or custom displays are a new way to include share buttons on a custom location inside your website. All created custom positions will appear in the list of share button automated displays and will contain all customization options. The only difference from the core positions is that you should place the display with a shortcode, Elementor widget, or a function call (example codes are provided). The main advantage of locations/displays is that you easily change settings like any of existing positions. And changing the design will change it anywhere you have used it before. If you temporarily need to stop a display just deactivate it from the positions menu.', 'essb'), '', 'glowhint');

	ESSBOptionsStructureHelper::field_component($where_to_display, 'custom', 'essb5_custom_positions', 'true');
	ESSBOptionsStructureHelper::holder_end($where_to_display, 'custom');
}

/*** Where to Display **/
ESSBOptionsStructureHelper::help($where_to_display, 'posts', '', '', array('Help with Settings' => 'https://docs.socialsharingplugin.com/knowledgebase/automatic-display-of-share-buttons-on-different-post-types-plugins-and-automatic-deactivate-of-display/#Selecting_Post_Types_for_Automatic_Display'));

ESSBOptionsStructureHelper::field_func($where_to_display, 'posts', 'essb3_post_type_select', esc_html__('Display on', 'essb'), esc_html__('Choose post types where you wish buttons to appear. If you are running a WooCommerce store you can choose between post type Products which will display share buttons into product description or option to display buttons below the price.', 'essb'));


ESSBOptionsStructureHelper::panel_start($where_to_display, 'posts', esc_html__('Advanced display options', 'essb') . essb_generate_expert_badge(), '', 'fa21 ti-widget', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
ESSBOptionsStructureHelper::field_textbox_stretched($where_to_display, 'posts', 'display_include_on', esc_html__('Automatic display buttons on', 'essb'), esc_html__('Provide list of post/page ids where buttons will display no matter that post type is active or not. Comma seperated values: "11, 15, 125". This will eactivate automated display of buttons on selected posts/pages even if post type that they use is not marked as active.', 'essb'));

if (!essb_option_bool_value('deactivate_method_except')) {
	ESSBOptionsStructureHelper::field_component($where_to_display, 'posts', 'essb5_additional_excerpt_options', 'false');
}
ESSBOptionsStructureHelper::panel_end($where_to_display, 'posts');


ESSBOptionsStructureHelper::help($where_to_display, 'deactivate', '', '', array('Help with Settings' => 'https://docs.socialsharingplugin.com/knowledgebase/automatic-display-of-share-buttons-on-different-post-types-plugins-and-automatic-deactivate-of-display/#Deactivate_Share_Buttons_Display'));
ESSBOptionsStructureHelper::hint($where_to_display, 'deactivate', '', esc_html__('Those options refer to the share buttons only. If you are coming from an older version of the plugin the global deactivate options are now located at Advanced -> Deactivate.', 'essb'), '', 'glowhint');
ESSBOptionsStructureHelper::field_textbox_stretched($where_to_display, 'deactivate', 'display_exclude_from', esc_html__('Exclude automatic display on', 'essb'), esc_html__('Exclude buttons on posts/pages with these IDs. Comma separated: "11, 15, 125". This will deactivate automated display of buttons on selected posts/pages but you are able to use shortcode on them.', 'essb'));
ESSBOptionsStructureHelper::field_switch($where_to_display, 'deactivate', 'deactivate_homepage', esc_html__('Deactivate buttons display on homepage', 'essb'), esc_html__('Exclude display of buttons on home page.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
ESSBOptionsStructureHelper::field_switch($where_to_display, 'deactivate', 'deactivate_mobile_share', esc_html__('Deactivate share buttons on mobile', 'essb') . essb_generate_server_side_mobile_badge(), esc_html__('Deactivate display of share buttons on mobile. The option requires server-side mobile detection to work.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
ESSBOptionsStructureHelper::field_switch($where_to_display, 'deactivate', 'hide_content_archive', esc_html__('Hide content share buttons from archive pages', 'essb'), esc_html__('Fully deactivate only the content share buttons on archive pages (category, tag, author, etc.). All other display methods will continue to work.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
ESSBOptionsStructureHelper::field_switch($where_to_display, 'deactivate', 'hide_content_home', esc_html__('Hide content share buttons on the homepage', 'essb'), esc_html__('Fully deactivate only the content share buttons on the homepage. All other display methods will continue to work.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));

ESSBControlCenter::set_description_inline('url_deactivate_share');
ESSBOptionsStructureHelper::field_textarea($where_to_display, 'deactivate', 'url_deactivate_share', esc_html__('Specify URLs of pages or posts where share buttons will not appear', 'essb'), esc_html__('The option will deactivate only the share buttons. All other plugin components will continue to work. One per line without the domain name. Use (.*) wildcards to address multiple URLs under a given path. Example: /profile/(.*)', 'essb'), '10');


if (!essb_options_bool_value('deactivate_method_integrations')) {
	ESSBOptionsStructureHelper::help($where_to_display, 'plugins', '', '', array('Help with Settings' => 'https://docs.socialsharingplugin.com/knowledgebase/working-with-automatic-display-positions-for-social-share-buttons-and-plugin-integrations/#Plugin_Integrations'));

	ESSBOptionsStructureHelper::panel_start($where_to_display, 'plugins', esc_html__('WP e-Commerce', 'essb'), esc_html__('Activate specific locations related to this plugin', 'essb'), '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'plugins', 'wpec_before_desc', esc_html__('Display before product description', 'essb'), '', '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'plugins', 'wpec_after_desc', esc_html__('Display after product description', 'essb'), '', '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'plugins', 'wpec_theme_footer', esc_html__('Display at the bottom of page', 'essb'), '', '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'plugins');

	ESSBOptionsStructureHelper::panel_start($where_to_display, 'plugins', esc_html__('JigoShop', 'essb'), esc_html__('Activate specific locations related to this plugin', 'essb'), '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'plugins', 'jigoshop_top', esc_html__('JigoShop Before Product', 'essb'), '', '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'plugins', 'jigoshop_bottom', esc_html__('JigoShop After Product', 'essb'), '', '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'plugins');

	ESSBOptionsStructureHelper::panel_start($where_to_display, 'plugins', esc_html__('iThemes Exchange', 'essb'), esc_html__('Activate specific locations related to this plugin', 'essb'), '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'plugins', 'ithemes_after_title', esc_html__('Display after product title', 'essb'), '', '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'plugins', 'ithemes_before_desc', esc_html__('Display before product description', 'essb'), '', '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'plugins', 'ithemes_after_desc', esc_html__('Display after product description', 'essb'), '', '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'plugins', 'ithemes_after_product', esc_html__('Display after product advanced content (after product information)', 'essb'), '', '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'plugins', 'ithemes_after_purchase', esc_html__('Display share buttons for each product after successful purchase (when shopping cart is used)', 'essb'), '', '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'plugins');

	ESSBOptionsStructureHelper::panel_start($where_to_display, 'plugins', esc_html__('bbPress', 'essb'), esc_html__('Activate specific locations related to this plugin', 'essb'), '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'plugins', 'bbpress_forum', esc_html__('Display in forums', 'essb'), '', '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'plugins', 'bbpress_topic', esc_html__('Display in topics', 'essb'), '', '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'plugins');

	ESSBOptionsStructureHelper::panel_start($where_to_display, 'plugins', esc_html__('BuddyPress', 'essb'), esc_html__('Activate specific locations related to this plugin', 'essb'), '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'plugins', 'buddypress_activity', esc_html__('Display in activity', 'essb'), '', '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'plugins', 'buddypress_group', esc_html__('Display on group page', 'essb'), '', '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'plugins');
}

// positions
ESSBOptionsStructureHelper::help($where_to_display, 'positions|positions', '', '', array(
	'How to work with automatic display positions for social share buttons (and integrations with other plugins)?' => 'https://docs.socialsharingplugin.com/knowledgebase/working-with-automatic-display-positions-for-social-share-buttons-and-plugin-integrations/',
	'How to activate/deactivate automatic share button positions?' => 'https://docs.socialsharingplugin.com/knowledgebase/how-to-activate-deactivate-automatic-share-button-positions/',
	'How to create custom displays/positions for share buttons (and how to use them)?' => 'https://docs.socialsharingplugin.com/knowledgebase/creating-custom-displays-positions-for-share-buttons-and-how-to-use-them/',
	'Step by step guide for setting up responsive mobile share buttons' => 'https://docs.socialsharingplugin.com/knowledgebase/step-by-step-guide-for-setting-up-responsive-buttons-without-dealing-with-mobile-options/'

));

if (essb_admin_has_disabled_position() && essb_option_value('css_mode') != 'light') {
	ESSBOptionsStructureHelper::field_func($where_to_display, 'positions|positions', 'essb_admin_disabled_positions_message', '', '');
}

$position_tabs = array(
	'<i class="ti-layout-width-default"></i>' . esc_html__('Inline (Content)', 'essb'),
	'<i class="ti-layout-sidebar-left"></i>' . esc_html__('Additional (Website)', 'essb'),
	'<i class="ti-mobile"></i>' . esc_html__('Mobile', 'essb'),
);

if (function_exists('wc_get_product')) {
	if (!essb_option_bool_value('deactivate_method_woocommerce')) {
		$position_tabs[] = '<i class="ti-shopping-cart"></i>WooCommerce';
	}
}

ESSBOptionsStructureHelper::tabs_start($where_to_display, 'positions|positions', 'positions', $position_tabs, 'true', 'true');

ESSBOptionsStructureHelper::tab_start($where_to_display, 'positions|positions', 'positions-0', 'true');
ESSBOptionsStructureHelper::hint($where_to_display, 'positions|positions', esc_html__('Inline (Content)', 'essb'), esc_html__('The inline positions are those that are added to the content of a single post, page, or custom post type. If you don\'t need to show content share buttons, or you plan to add those with a shortcode or builder element choose "Manual display with shortcode only". You can select only one option from the list.', 'essb'), '', 'glowhint');
ESSBOptionsStructureHelper::field_single_position_select($where_to_display, 'positions|positions', 'content_position', essb5_available_content_positions());
ESSBOptionsStructureHelper::tab_end($where_to_display, 'positions|positions');

ESSBOptionsStructureHelper::tab_start($where_to_display, 'positions|positions', 'positions-1');
ESSBOptionsStructureHelper::hint($where_to_display, 'positions|positions', esc_html__('Additional (Website)', 'essb'), esc_html__('Most of the additional display methods are prepared to be used on the entire website. And with the exclusion of a few all they can run anywhere (including even archive pages (categories, tags, etc.) or such that does not have content created with WordPress editor. You can choose more than 1 at the same time.', 'essb'), '', 'glowhint');
ESSBOptionsStructureHelper::field_multi_position_select($where_to_display, 'positions|positions', 'button_position', essb5_available_button_positions());
ESSBOptionsStructureHelper::tab_end($where_to_display, 'positions|positions');

ESSBOptionsStructureHelper::tab_start($where_to_display, 'positions|positions', 'positions-2');
ESSBOptionsStructureHelper::hint($where_to_display, 'positions|positions', esc_html__('Mobile', 'essb'), esc_html__('Automatic mobile-optimized display methods. You can use them in combination with other display methods you have. They are in a responsive mode and will work out of the box.', 'essb'), '', 'glowhint');
ESSBOptionsStructureHelper::field_multi_position_select($where_to_display, 'positions|positions', 'functions_mode_mobile_auto_responsive', essb5_available_positions_mobile_only());
ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|positions', 'functions_mode_mobile_auto_breakpoint', esc_html__('Mobile breakpoint', 'essb'), esc_html__('Modify the default breakpoint where mobile share methods will appear. Numeric value only. The default is 768 (phones in portrait and landscape mode and most of the small screen size tablets). If you wish to include also all tablets put 1024 in the field.', 'essb'), '', 'input60', 'fa-arrows-h', 'right');
ESSBOptionsStructureHelper::tab_end($where_to_display, 'positions|positions');

/**
 * WooCommerce is running
 */
if (function_exists('wc_get_product')) {
	if (!essb_option_bool_value('deactivate_method_woocommerce')) {
		ESSBOptionsStructureHelper::tab_start($where_to_display, 'positions|positions', 'positions-3');

		ESSBOptionsStructureHelper::field_heading($where_to_display, 'positions|positions', 'heading7', 'WooCommerce Content', '', 'pb0', '<i class="ti-shopping-cart"></i>');
		ESSBOptionsStructureHelper::holder_start($where_to_display, 'positions|positions', 'essb-related-heading7', '');

		ESSBOptionsStructureHelper::hint($where_to_display, 'positions|positions', '', esc_html__('Below you can activate a list of specific WooCommerce product hooks for displaying share buttons. Using those hooks does not require to set up the Products post type for showing share buttons. You can also use all of the other integrated display methods too as long as you choose the "Products" post type.', 'essb'), '', 'glowhint');

		ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|positions', 'woocommece_share', esc_html__('After the product short description (recommended location)', 'essb'), '', '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
		ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|positions', 'woocommerce_after_add_to_cart_form', esc_html__('After adding to cart button (only on the single product page)', 'essb'), '', '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
		ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|positions', 'woocommece_beforeprod', esc_html__('Display before the product (before starting the product block)', 'essb'), '', '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
		ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|positions', 'woocommece_afterprod', esc_html__('Display after the product (after finishing the product block)', 'essb'), '', '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));

		ESSBOptionsStructureHelper::holder_end($where_to_display, 'positions|positions');


		ESSBOptionsStructureHelper::field_heading($where_to_display, 'positions|positions', 'heading7', 'WooCommerce Enhanced', '', 'pb0', '<i class="ti-shopping-cart-full"></i>');
		ESSBOptionsStructureHelper::holder_start($where_to_display, 'positions|positions', 'essb-related-heading7', '');

		if (defined('ESSB_DM_WSB_PLUGIN_ROOT')) {
			ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|positions', 'woocommece_sharebar', esc_html__('WooCommerce share bar', 'essb'), esc_html__('Display a bottom sticky bar with the product information, purchase button, and the share buttons', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
		} else {
			ESSBOptionsStructureHelper::field_func(
				$where_to_display,
				'positions|positions',
				'essb_options_function_output_missing_addon_message',
				esc_html__('WooCommerce share bar', 'essb'),
				esc_html__('Display a bottom sticky bar with the product information, purchase button, and the share buttons', 'essb')
			);
		}

		if (defined('ESSB_DM_WTB_PLUGIN_ROOT')) {
			ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|positions', 'woocommece_thankyou', esc_html__('Add share buttons on the WooCommerce thank you page', 'essb'), esc_html__('Include a list of purchased products with share buttons next to each on the order thank you page. The function may not work if you are using a thank you page customizer/builder.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
		} else {
			ESSBOptionsStructureHelper::field_func(
				$where_to_display,
				'positions|positions',
				'essb_options_function_output_missing_addon_message',
				esc_html__('Add share buttons on the WooCommerce thank you page', 'essb'),
				esc_html__('Include a list of purchased products with share buttons next to each on the order thank you page. The function may not work if you are using a thank you page customizer/builder.', 'essb')
			);
		}

		if (defined('ESSB_DM_WSC_PLUGIN_ROOT')) {
			ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|positions', 'woocommece_index', esc_html__('Product list share buttons', 'essb'), esc_html__('Include share buttons in the list of products (category, promotions, etc.)', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
		} else {
			ESSBOptionsStructureHelper::field_func(
				$where_to_display,
				'positions|positions',
				'essb_options_function_output_missing_addon_message',
				esc_html__('Product list share buttons', 'essb'),
				esc_html__('Include share buttons in the list of products (category, promotions, etc.)', 'essb')
			);
		}

		ESSBOptionsStructureHelper::holder_end($where_to_display, 'positions|positions');

		ESSBOptionsStructureHelper::tab_end($where_to_display, 'positions|positions');
	}
}

ESSBOptionsStructureHelper::tabs_end($where_to_display, 'positions|positions');


add_action('admin_init', 'essb3_register_positions_by_posttypes');

essb_prepare_location_advanced_customization($where_to_display, 'positions|display-4', 'top');
essb_prepare_location_advanced_customization($where_to_display, 'positions|display-5', 'bottom');

if (!essb_options_bool_value('deactivate_method_float')) {
	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-6', esc_html__('Floating Bar Fixed Position & Auto Hide', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));

	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-6');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-6', 'float_top', esc_html__('Top position for non logged in users', 'essb'), esc_html__('Customize default fixed position of floating bar. You may need to enter value here if your site has a fixed menu or other top fixed element (numeric value)', 'essb'), '', 'input60', 'fa-arrows-v', 'right');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-6', 'float_top_loggedin', esc_html__('Top position for logged in users', 'essb'), esc_html__('If you display WordPress admin bar for logged in users you can correct float from top position for logged in users to avoid bar to be rendered below WordPress admin bar.', 'essb'), '', 'input60', 'fa-arrows-v', 'right');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-6', 'float_top_disappear', esc_html__('Autohide after percent of content is viewed', 'essb'), esc_html__('Provide value in percent if you wish to hide float bar - for example 80 will make bar to disappear when 80% of page content is viewed from user.', 'essb'), '', 'input60', 'fa-sort-numeric-asc', 'right');
	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-6');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-6');


	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-6', esc_html__('Floating bar modifications', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-6');
	ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-6', 'float_bg', esc_html__('Choose background color', 'essb'), '', '', 'true');
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-6', 'float_full', esc_html__('Set full width of float bar', 'essb'), esc_html__('This option will make float bar to take full width of browser window.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-6', 'float_full_maxwidth', esc_html__('Max width of buttons area', 'essb'), esc_html__('Provide custom max width of buttons area when full width float bar is active. Provide number value in pixels without the px (example 960)', 'essb'), '', 'input60', 'fa-arrows-h', 'right');
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-6', 'float_remove_margin', esc_html__('Remove top space', 'essb'), esc_html__('This option will clear the blank space that may appear according to theme settings between top of window and float bar.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-6');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-6');

	essb_prepare_location_advanced_customization($where_to_display, 'positions|display-6', 'float');
}

if (!essb_options_bool_value('deactivate_method_postfloat')) {
	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-7', esc_html__('Positioning', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-7');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-7', 'postfloat_initialtop', esc_html__('Custom top position when loaded', 'essb'), esc_html__('The default top position of the bar is the start of the content. You can set your top position. A numeric value representing pixels - example: 100', 'essb'), '', 'input60', 'fa-arrows-v', 'right');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-7', 'postfloat_top', esc_html__('Custom top position when fixed', 'essb'), esc_html__('The default placement when fixed is at the top of the screen. Enter a numeric value to modify - example: 100 (means 100px).', 'essb'), '', 'input60', 'fa-arrows-v', 'right');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-7', 'postfloat_marginleft', esc_html__('Horizontal offset from content', 'essb'), esc_html__('Correct the default left positioning of the bar. Enter a positive (move right from the start of the content) or negative (move left from the start of the content) numeric value representing pixels. Example: 90 or -90', 'essb'), '', 'input60', 'fa-arrows-h', 'right');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-7', 'postfloat_margintop', esc_html__('Vertical offset from content start', 'essb'), esc_html__('Correct the default top positioning of the bar. Enter a positive (move bottom from the start of the content) or negative (move top from the start of the content) numeric value representing pixels. Example: 90 or -90', 'essb'), '', 'input60', 'fa-arrows-v', 'right');
	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-7');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-7');

	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-7', esc_html__('Automatica Appear or Disappear On', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-7');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-7', 'postfloat_percent', esc_html__('Display after page scroll', 'essb'), esc_html__('Show the floating bar when visitors scroll on the page. You can set value in percents of content (example: 40) or equal to pixels from the top of the page (example: 500px). When this setting is used the floating bar will remain hidden till the condition is completed successfully.', 'essb'), '', 'input60', 'fa-arrows-h', 'right');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-7', 'postfloat_bottom_offset', esc_html__('End of content offset', 'essb'), esc_html__('This will make buttons disappear before reaching the end of content with added the offset value. Works only if you do not activate the option to "Do not hide post vertical float at the end of content".', 'essb'), '', 'input60', 'fa-arrows-v', 'right');
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-7', 'postfloat_always_visible', esc_html__('Do not hide post vertical float at the end of content', 'essb'), esc_html__('Activate this option to make post vertical float stay on screen when end of post content is reached.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-7', 'postfloat_fix_bottom', esc_html__('Fix the floating bar at the end of the content', 'essb'), esc_html__('Only when the do not hide option is enabled and not in combination with selectors hide. This will fix the bar at the bottom and stay there.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_textbox_stretched($where_to_display, 'positions|display-7', 'postfloat_selectors', esc_html__('Hide when specific selectors are in the viewport', 'essb'), esc_html__('Fill one or more (separated with comma) selectors (optional). If one of those selectors is in the viewport the share buttons in the vertical float will disappear. The option will only work if you enable "Do not hide post vertical float at the end of content". Example: .class1, #id2', 'essb'));
	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-7');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-7');

	essb_prepare_location_advanced_customization($where_to_display, 'positions|display-7', 'postfloat');
}

if (!essb_options_bool_value('deactivate_method_sidebar')) {
	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-8', esc_html__('General', 'essb'), '', '', array("mode" => "toggle", "state" => "opened", "css_class" => "essb-auto-open1"));

	$listOfOptions = array("" => "Left", "right" => "Right");
	$sidebar_loading_animations = array("" => esc_html__("No animation", "essb"), "slide" => esc_html__("Slide", "essb"), "fade" => esc_html__("Fade", "essb"));
	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-8');
	ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|display-8', 'sidebar_pos', esc_html__('Position', 'essb'), '', $listOfOptions);
	ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|display-8', 'sidebar_entry_ani', esc_html__('Entry animation', 'essb'), esc_html__('Assign sidebar initial appearance animation - a nice way to catch visitors attention.', 'essb'), $sidebar_loading_animations);
	$listOfOptions = array('' => 'Middle', 'top' => 'Top', 'bottom' => 'Bottom', 'custom' => 'Custom');
	ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|display-8', 'sidebar_location', esc_html__('Vertical screen location', 'essb'), esc_html__('Define the vertical alignment of the bar. Choose custom to use the fields below for custom top position.', 'essb'), $listOfOptions);
	$listOfOptions = array('' => 'Default', 'medium' => 'Medium', 'large' => 'Large', 'xlarge' => 'Extra Large');
	ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|display-8', 'sidebar_icon_space', esc_html__('Button size', 'essb'), esc_html__('Use to increase the button size. The option may be overwritten if you enable to overwrite the global styles and choose a button size.', 'essb'), $listOfOptions);

	if (!essb_option_bool_value('activate_automatic_position')) {
		ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-8', 'sidebar_adaptive_style', esc_html__('Automatic sidebar styles', 'essb'), esc_html__('Add automatic styles for your sidebar. This is a basic styling over the button shape and design using the most popular configurations. You can still overwrite this with the advanced position settings.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	}
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-8', 'sidebar_fixedleft', esc_html__('Customize the left/right position of the sidebar', 'essb'), esc_html__('Enter a numeric value to the bar away from the screen edge. Example: 10', 'essb'), '', 'input60', 'fa-arrows-h', 'right');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-8', 'sidebar_fixedtop', esc_html__('Customize the top position of the sidebar', 'essb'), esc_html__('Works only if you choose Custom in Vertical screen location. You can set the value in pixels (example: 100px) or in percents (example: 15%).', 'essb'), '', 'input60', 'fa-arrows-v', 'right');

	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-8');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-8');

	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-8', esc_html__('Sidebar Appear/Disappear on Scroll and Close Sidebar Button', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-8');
	ESSBOptionsStructureHelper::field_textbox_panel($where_to_display, 'positions|display-8', 'sidebar_leftright_percent', esc_html__('Display after amount of content is viewed', 'essb'), esc_html__('If you wish to make sidebar appear after percent of content is viewed enter value here (leave blank to appear immediately after load).', 'essb'), '', 'input60', 'fa-arrows-v', 'right');
	ESSBOptionsStructureHelper::field_select_panel($where_to_display, 'positions|display-8', 'sidebar_appear_unit', esc_html__('Measuring unit of appear value', 'essb'), esc_html__('Default appearance value is % but you can change it here to px', 'essb'), array('' => '%', 'px' => 'px'));
	ESSBOptionsStructureHelper::field_textbox_panel($where_to_display, 'positions|display-8', 'sidebar_leftright_percent_hide', esc_html__('Hide after percent of content is viewed', 'essb'), esc_html__('If you wish to make sidebar disappear after percent of content is viewed enter value here (leave blank to make it always be visible).', 'essb'), '', 'input60', 'fa-arrows-v', 'right');
	ESSBOptionsStructureHelper::field_switch_panel($where_to_display, 'positions|display-8', 'sidebar_leftright_close', esc_html__('Add close sidebar button', 'essb'), esc_html__('Activate that option to add a close sidebar button.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch_panel($where_to_display, 'positions|display-8', 'sidebar_content_hide', esc_html__('Hide when static content buttons are visible', 'essb'), esc_html__('Enable the option to make your sidebar disappear from the screen when static content buttons are visible (above content or below content sharing). The option won\'t detect interactive content displays.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-8');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-8');

	essb_prepare_location_advanced_customization($where_to_display, 'positions|display-8', 'sidebar');
}

if (!essb_options_bool_value('deactivate_method_topbar')) {
	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-9', esc_html__('Top Bar Appearance & Position', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-9');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-9', 'topbar_top', esc_html__('Top position for non logged in users', 'essb'), esc_html__('The bar has a default initial position but if your site has a fixed top element you can use this field to change the initial top position and avoid bar appear before/above that fixed element', 'essb'), '', 'input60', 'fa-arrows-v', 'right');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-9', 'topbar_top_loggedin', esc_html__('Top position for logged in users', 'essb'), esc_html__('If you display WordPress admin bar for logged in users you can correct float from top position for logged in users to avoid bar to be rendered below WordPress admin bar.', 'essb'), '', 'input60', 'fa-arrows-v', 'right');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-9', 'topbar_top_onscroll', esc_html__('Appear after percent of content is viewed', 'essb'), esc_html__('If you wish top bar to appear when user starts scrolling fill here percent of conent after is viewed it will be visible.', 'essb'), '', 'input60', 'fa-arrows-v', 'right');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-9', 'topbar_hide', esc_html__('Hide after percent of content is viewed', 'essb'), esc_html__('Provide value in percent if you wish to hide float bar - for example 80 will make bar to disappear when 80% of page content is viewed from user.', 'essb'), '', 'input60', 'fa-sort-numeric-asc', 'right');
	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-9');

	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-9');
	ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-9', 'topbar_bg', esc_html__('Choose background color', 'essb'), '', '', 'true');
	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-9');

	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-9');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-9', 'topbar_height', esc_html__('Height of top bar content area', 'essb'), esc_html__('Provide custom height of content area. Provide number value in pixels without the px (example 40). Leave blank for default height.', 'essb'), '', 'input60', 'fa-arrows-v', 'right');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-9', 'topbar_maxwidth', esc_html__('Max width of content area', 'essb'), esc_html__('Provide custom max width of content area. Provide number value in pixels without the px (example 960). Leave blank for full width.', 'essb'), '', 'input60', 'fa-arrows-h', 'right');
	$listOfOptions = array("" => "Left", "center" => "Center", "right" => "Right");
	ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|display-9', 'topbar_buttons_align', esc_html__('Align buttons', 'essb'), esc_html__('Choose your button alignment', 'essb'), $listOfOptions);
	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-9');

	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-9');

	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-9', esc_html__('Custom Content', 'essb'), '', '', array("mode" => "switch", 'switch_id' => 'topbar_contentarea', 'switch_on' => esc_html__('Yes', 'essb'), 'switch_off' => esc_html__('No', 'essb')));
	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-9');
	$listOfOptions = array("left" => "Left", "right" => "Right");
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-9', 'topbar_contentarea_width', esc_html__('Custom content area % width', 'essb'), esc_html__('Provide custom width of content area (default value if nothing is filled is 30 which means 30%). Fill number value without % mark - example 40.', 'essb'), '', 'input60', 'fa-arrows-h', 'right');
	ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|display-9', 'topbar_contentarea_pos', esc_html__('Custom content area position', 'essb'), esc_html__('Choose your content area alignment', 'essb'), $listOfOptions);
	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-9');

	ESSBControlCenter::set_description_inline('topbar_usercontent');
	ESSBOptionsStructureHelper::field_wpeditor($where_to_display, 'positions|display-9', 'topbar_usercontent', esc_html__('Custom content', 'essb'), 'The following variables can be used to display the current post details: %%title%% (post title), %%url%% (post URL - link only), %%image%% (featured image  - URL only), %%excerpt%% (post excerpt), %%picture%% (featured image HTML code)', 'htmlmixed');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-9');
	essb_prepare_location_advanced_customization($where_to_display, 'positions|display-9', 'topbar');
}

if (!essb_options_bool_value('deactivate_method_bottombar')) {

	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-10', esc_html__('Bottom Bar Appearance & Position', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-10');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-10', 'bottombar_top_onscroll', esc_html__('Appear after percent of content is viewed', 'essb'), esc_html__('If you wish bottom bar to appear when user starts scrolling fill here percent of conent after is viewed it will be visible.', 'essb'), '', 'input60', 'fa-arrows-v', 'right');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-10', 'bottombar_hide', esc_html__('Hide after percent of content is viewed', 'essb'), esc_html__('Provide value in percent if you wish to hide float bar - for example 80 will make bar to disappear when 80% of page content is viewed from user.', 'essb'), '', 'input60', 'fa-sort-numeric-asc', 'right');
	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-10');

	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-10');
	ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-10', 'bottombar_bg', esc_html__('Choose background color', 'essb'), esc_html__('Overwrite default bar background color #ffffff (white)', 'essb'), '', 'true');
	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-10');

	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-10');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-10', 'bottombar_height', esc_html__('Height of top bar content area', 'essb'), esc_html__('Provide custom height of content area. Provide number value in pixels without the px (example 40). Leave blank for default value.', 'essb'), '', 'input60', 'fa-arrows-v', 'right');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-10', 'bottombar_maxwidth', esc_html__('Max width of content area', 'essb'), esc_html__('Provide custom max width of content area. Provide number value in pixels without the px (example 960). Leave blank for full width.', 'essb'), '', 'input60', 'fa-arrows-h', 'right');
	$listOfOptions = array("" => "Left", "center" => "Center", "right" => "Right");
	ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|display-10', 'bottombar_buttons_align', esc_html__('Align buttons', 'essb'), esc_html__('Choose your content area alignment', 'essb'), $listOfOptions);
	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-10');

	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-10');

	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-10', esc_html__('Custom Content', 'essb'), '', '', array("mode" => "switch", 'switch_id' => 'bottombar_contentarea', 'switch_on' => esc_html__('Yes', 'essb'), 'switch_off' => esc_html__('No', 'essb')));
	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-10');
	$listOfOptions = array("left" => "Left", "right" => "Right");
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-10', 'bottombar_contentarea_width', esc_html__('Custom content area % width', 'essb'), esc_html__('Provide custom width of content area (default value if nothing is filled is 30 which means 30%). Fill number value without % mark - example 40.', 'essb'), '', 'input60', 'fa-arrows-h', 'right');
	ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|display-10', 'bottombar_contentarea_pos', esc_html__('Custom content area position', 'essb'), esc_html__('Choose your button alignment', 'essb'), $listOfOptions);
	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-10');

	ESSBControlCenter::set_description_inline('bottombar_usercontent');
	ESSBOptionsStructureHelper::field_wpeditor($where_to_display, 'positions|display-10', 'bottombar_usercontent', esc_html__('Custom content', 'essb'), 'The following variables can be used to display the current post details: %%title%% (post title), %%url%% (post URL - link only), %%image%% (featured image  - URL only), %%excerpt%% (post excerpt), %%picture%% (featured image HTML code)', 'htmlmixed');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-10');

	essb_prepare_location_advanced_customization($where_to_display, 'positions|display-10', 'bottombar');
}

if (!essb_options_bool_value('deactivate_method_popup')) {
	ESSBControlCenter::set_description_inline('popup_window_title');
	ESSBControlCenter::set_description_inline('popup_user_message');

	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-11', esc_html__('Pop Up Content', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_textbox_stretched($where_to_display, 'positions|display-11', 'popup_window_title', esc_html__('Pop up window title', 'essb'), esc_html__('The following variables can be used to display the current post details: %%title%% (post title), %%url%% (post URL - link only), %%image%% (featured image  - URL only), %%excerpt%% (post excerpt), %%picture%% (featured image HTML code)', 'essb'));
	ESSBOptionsStructureHelper::field_editor($where_to_display, 'positions|display-11', 'popup_user_message', esc_html__('Pop up window message', 'essb'), esc_html__('The following variables can be used to display the current post details: %%title%% (post title), %%url%% (post URL - link only), %%image%% (featured image  - URL only), %%excerpt%% (post excerpt), %%picture%% (featured image HTML code)', 'essb'), "htmlmixed");
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-11', 'popup_user_width', esc_html__('Pop up window width', 'essb'), esc_html__('Set your custom window width (default is 800 or window width - 60). Value if provided should be numeric without px symbols.', 'essb'), '', 'input60', 'fa-arrows-h', 'right');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-11');

	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-11', esc_html__('Display On The Following Events', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-11');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-11', 'popup_window_popafter', esc_html__('Display pop up window after (sec)', 'essb'), esc_html__('If you wish pop up window to appear after amount of seconds you can provide theme here. Leave blank for immediate pop up after page load.', 'essb'), '', 'input60', 'fa-clock-o', 'right');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-11', 'popup_user_percent', esc_html__('Display pop up window after percent of content is viewed', 'essb'), esc_html__('Set amount of page content after which the pop up will appear.', 'essb'), '', 'input60', 'fa-arrows-v', 'right');
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-11', 'popup_display_end', esc_html__('Display pop up at the end of content', 'essb'), esc_html__('Automatically display pop up when the content end is reached', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-11', 'popup_display_exit', esc_html__('Display pop up on exit intent', 'essb'), esc_html__('Automatically display pop up when exit intent is detected', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-11', 'popup_display_comment', esc_html__('Display pop up on user comment', 'essb'), esc_html__('Automatically display pop up when user leave a comment.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-11', 'popup_display_purchase', esc_html__('Display pop up after WooCommerce purchase', 'essb'), esc_html__('Display on Thank You page of WooCommerce after purchase', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-11', 'popup_user_manual_show', esc_html__('Manual display mode', 'essb'), esc_html__('Activating manual display mode will allow you to show window when you decide with calling following javascript function essb_popup_show();', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBControlCenter::set_extra_description('popup_user_manual_show', esc_html__('JS function: essb_popup_show();', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-11', 'popup_avoid_logged_users', esc_html__('Do not show pop up for logged in users', 'essb'), esc_html__('Activate this option to avoid display of pop up when user is logged in into site.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-11');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-11');

	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-11', esc_html__('Automatic close & do not show again', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-11');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-11', 'popup_window_close_after', esc_html__('Automatically close pop up after (sec)', 'essb'), esc_html__('You can provide seconds and after they expire window will close automatically. User can close this window manually by pressing close button.', 'essb'), '', 'input60', 'fa-arrows-h', 'right');
	ESSBOptionsStructureHelper::field_textbox_stretched($where_to_display, 'positions|display-11', 'popup_user_autoclose', esc_html__('Close up message customize', 'essb'), esc_html__('Set custom text announcement for closing the pop up. After your text there will be timer counting the seconds leaving.', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-11', 'popup_user_notshow_onclose', esc_html__('After user close window do not show it again on this page/post for him', 'essb'), esc_html__('Activating this option will set cookie that will not show again pop up message for next 7 days for user on this post/page', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-11', 'popup_user_notshow_onclose_all', esc_html__('After user close window do not show it again on the entire website for him', 'essb'), esc_html__('Activating this option will set cookie that will not show again pop up message for next 7 days for user on all posts/pages', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-11');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-11');

	essb_prepare_location_advanced_customization($where_to_display, 'positions|display-11', 'popup');
}

if (!essb_options_bool_value('deactivate_method_flyin')) {

	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-12', esc_html__('Fly in Custom content and Position', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));

	ESSBControlCenter::set_description_inline('flyin_window_title');
	ESSBControlCenter::set_description_inline('flyin_user_message');

	ESSBOptionsStructureHelper::field_textbox_stretched($where_to_display, 'positions|display-12', 'flyin_window_title', esc_html__('Fly in window title', 'essb'), 'The following variables can be used to display the current post details: %%title%% (post title), %%url%% (post URL - link only), %%image%% (featured image  - URL only), %%excerpt%% (post excerpt), %%picture%% (featured image HTML code)');
	ESSBOptionsStructureHelper::field_editor($where_to_display, 'positions|display-12', 'flyin_user_message', esc_html__('Fly in window message', 'essb'), 'The following variables can be used to display the current post details: %%title%% (post title), %%url%% (post URL - link only), %%image%% (featured image  - URL only), %%excerpt%% (post excerpt), %%picture%% (featured image HTML code)', "htmlmixed");
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-12', 'flyin_user_width', esc_html__('Fly in window width', 'essb'), esc_html__('Set your custom window width (default is 400 or window width - 60). If value is provided should be numeric without px symbols.', 'essb'), '', 'input60', 'fa-arrows-h', 'right');
	$listOfOptions = array("right" => "Right", "left" => "Left");
	ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|display-12', 'flyin_position', esc_html__('Choose fly in display position', 'essb'), '', $listOfOptions);
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-12', 'flyin_noshare', esc_html__('Do not show share buttons in fly in', 'essb'), esc_html__('Activating this you will get a fly in display without share buttons in it - only the custom content you have set.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-12');

	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-12', esc_html__('Display on the following events', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-12');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-12', 'flyin_window_popafter', esc_html__('Display fly in window after (sec)', 'essb'), esc_html__('If you wish fly in window to appear after amount of seconds you can provide them here. Leave blank for immediate pop up after page load.', 'essb'), '', 'input60', 'fa-clock-o', 'right');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-12', 'flyin_user_percent', esc_html__('Display fly in window after percent of content is viewed', 'essb'), esc_html__('Set amount of page content after which the pop up will appear.', 'essb'), '', 'input60', 'fa-arrows-v', 'right');
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-12', 'flyin_display_end', esc_html__('Display fly in at the end of content', 'essb'), esc_html__('Automatically display fly in when the content end is reached.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-12', 'flyin_display_comment', esc_html__('Display fly in on user comment', 'essb'), esc_html__('Automatically display fly in when user leaves a comment.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-12', 'flyin_user_manual_show', esc_html__('Manual fly in display mode', 'essb'), esc_html__('Activating manual display mode will allow you to show window when you decide with calling following javascript function essb_flyin_show(); or essb_flyin_manual_show();', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBControlCenter::set_extra_description('flyin_user_manual_show', esc_html__('JS function: essb_flyin_show(); or essb_flyin_manual_show();', 'essb'));
	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-12');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-12');

	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-12', esc_html__('Automatic Close & do not show again', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-12');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-12', 'flyin_window_close_after', esc_html__('Automatically close fly in after (sec)', 'essb'), esc_html__('You can provide seconds and after they expire window will close automatically. User can close this window manually by pressing close button.', 'essb'), '', 'input60', 'fa-arrows-h', 'right');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-12', 'flyin_user_autoclose', esc_html__('Close up message customize', 'essb'), esc_html__('Set custom text announcement for closing the fly in. After your text there will be timer counting the seconds leaving.', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-12', 'flyin_user_notshow_onclose', esc_html__('After user closes window do not show it again on this page/post for him', 'essb'), esc_html__('Activating this option will set cookie that will not show again pop up message for next 7 days for user on this post/page', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-12', 'flyin_user_notshow_onclose_all', esc_html__('After user close window do not show it again on all page/post for him', 'essb'), esc_html__('Activating this option will set cookie that will not show again pop up message for next 7 days for user on all posts/pages', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-12');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-12');

	essb_prepare_location_advanced_customization($where_to_display, 'positions|display-12', 'flyin');
}

if (!essb_option_bool_value('deactivate_method_image')) {
	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-13', esc_html__('On media buttons appearance', 'essb'), esc_html__('Choose where you wish buttons to appear', 'essb'), 'fa21 ti-layout-grid2-alt', array("mode" => "toggle"));
	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-13');
	ESSBOptionsStructureHelper::field_textbox_panel($where_to_display, 'positions|display-13', 'sis_selector', esc_html__('Default image share selector', 'essb'), esc_html__('Provide your own custom image selector that will allow to pickup share images. Leave blank for use the default or use <b>.essbis_site img</b> to allow share of any image on site.', 'essb'));
	ESSBOptionsStructureHelper::field_textbox_panel($where_to_display, 'positions|display-13', 'sis_dontshow', esc_html__('Do not show on', 'essb'), esc_html__('Set image classes and IDs for which on media display buttons won\'t show. Separate several selectors with commas. (example: .notshow or .notshow,#notshow', 'essb'));
	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-13');

	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-13');
	ESSBOptionsStructureHelper::field_textbox_panel($where_to_display, 'positions|display-13', 'sis_minWidth', esc_html__('Minimal width', 'essb'), esc_html__('Minimum width of image for sharing. Use value without px.', 'essb'));
	ESSBOptionsStructureHelper::field_textbox_panel($where_to_display, 'positions|display-13', 'sis_minHeight', esc_html__('Minimal height', 'essb'), esc_html__('Minimum height of image for sharing. Use value without px.', 'essb'));
	ESSBOptionsStructureHelper::field_textbox_panel($where_to_display, 'positions|display-13', 'sis_minWidthMobile', esc_html__('Minimal width on Mobile', 'essb'), esc_html__('Minimum width of image for sharing. Use value without px.', 'essb'));
	ESSBOptionsStructureHelper::field_textbox_panel($where_to_display, 'positions|display-13', 'sis_minHeightMobile', esc_html__('Minimal height on Mobile', 'essb'), esc_html__('Minimum height of image for sharing. Use value without px.', 'essb'));

	ESSBOptionsStructureHelper::field_switch_panel($where_to_display, 'positions|display-13', 'sis_always_visible', esc_html__('Always visible share icons', 'essb'), esc_html__('Use this option to make on media share buttons always visible on desktop. The function may not work if you have lazy loading images.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_textbox_panel($where_to_display, 'positions|display-13', 'sis_facebookapp', esc_html__('Facebook Application ID', 'essb'), esc_html__('If you wish to make plugin selected image on Facebook you need to create application and make it public to use advanced sharing. Advanced sharing will allow to post any image on Facebook but it will allow share on personal timeline only.', 'essb'));
	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-13');

	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-13');
	ESSBOptionsStructureHelper::field_switch_panel($where_to_display, 'positions|display-13', 'sis_on_mobile', esc_html__('Enable on mobile', 'essb'), esc_html__('Enable image sharing on mobile devices', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch_panel($where_to_display, 'positions|display-13', 'sis_on_mobile_click', esc_html__('Appear on mobile with click', 'essb'), esc_html__('The on media buttons are always visible when you open site with mobile device. Use this option if you wish to make the appear with click over image.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-13');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-13');


	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-13', esc_html__('Use the following social buttons', 'essb'), esc_html__('Choose social buttons that you will use on media images', 'essb'), 'fa21 ti-layout-grid2-alt', array("mode" => "toggle"));
	$listOfNetworks = array("facebook", "twitter", "google", "linkedin", "pinterest", "tumblr", "reddit", "digg", "delicious", "vkontakte", "odnoklassniki");
	$listOfNetworksAdvanced = array("facebook" => "Facebook", "twitter" => "Twitter", "google" => "Google", "linkedin" => "LinkedIn", "pinterest" => "Pinterest", "tumblr" => "Tumblr", "reddit" => "Reddit", "digg" => "Digg", "delicious" => "Delicious", "vkontakte" => "VKontakte", "odnoklassniki" => "Odnoklassniki");
	ESSBOptionsStructureHelper::field_checkbox_list($where_to_display, 'positions|display-13', 'sis_networks', esc_html__('Activate networks', 'essb'), esc_html__('Choose active social networks', 'essb'), $listOfNetworksAdvanced);
	ESSBOptionsStructureHelper::field_simplesort($where_to_display, 'positions|display-13', 'sis_network_order', esc_html__('Display order', 'essb'), esc_html__('Arrange network appearance using drag and drop', 'essb'), $listOfNetworks);
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-13');
	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-13', esc_html__('Visual display setup', 'essb'), esc_html__('Customize look and feel of your social share buttons that appear on images', 'essb'), 'fa21 ti-layout-grid2-alt', array("mode" => "toggle"));

	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-13');

	$list_of_positions =  array(
		'top-left'      => esc_html__('Top left', 'essb'),
		'top-middle'    => esc_html__('Top middle', 'essb'),
		'top-right'     => esc_html__('Top right', 'essb'),
		'middle-left'   => esc_html__('Middle left', 'essb'),
		'middle-middle' => esc_html__('Middle', 'essb'),
		'middle-right'  => esc_html__('Middle right', 'essb'),
		'bottom-left'   => esc_html__('Bottom left', 'essb'),
		'bottom-middle' => esc_html__('Bottom middle', 'essb'),
		'bottom-right'  => esc_html__('Bottom right', 'essb')
	);

	ESSBOptionsStructureHelper::field_select_panel($where_to_display, 'positions|display-13', 'sis_position', esc_html__('Choose position of buttons on image', 'essb'), esc_html__('Select default position of buttons over image. Depends on active buttons and template select the best to fit them into images', 'essb'), $list_of_positions);

	$listOfTemplates = array("tiny" => "Tiny", "flat-small" => "Small", "flat" => "Regular", "round" => "Round");
	ESSBOptionsStructureHelper::field_select_panel($where_to_display, 'positions|display-13', 'sis_style', esc_html__('Template', 'essb'), esc_html__('Choose buttons template. You can use only build into module templates to avoid misconfiguration', 'essb'), $listOfTemplates);
	$listOfTemplates = array("" => "Default", "tiny" => "Tiny", "flat-small" => "Small", "flat" => "Regular", "round" => "Round");
	ESSBOptionsStructureHelper::field_select_panel($where_to_display, 'positions|display-13', 'sis_mobile_style', esc_html__('Template on Mobile', 'essb'), esc_html__('Choose buttons template that will be used on a mobile device. You can use only build into module templates to avoid misconfiguration', 'essb'), $listOfTemplates);
	$listOfOptions = array("horizontal" => esc_html__("Horizontal", 'essb'), "vertical" => esc_html__("Vertical", 'essb'));
	ESSBOptionsStructureHelper::field_select_panel($where_to_display, 'positions|display-13', 'sis_orientation', esc_html__('Orientation', 'essb'), esc_html__('Display buttons aligned horizontal or vertical', 'essb'), $listOfOptions);
	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-13');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-13');
}
if (!essb_options_bool_value('deactivate_method_heroshare')) {
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-14', 'heroshare_user_width', esc_html__('Custom window width', 'essb'), esc_html__('Set your custom window width (default is 960 or window width - 60). Value if provided should be numeric without px symbols.', 'essb'), '', 'input60', 'fa-arrows-h', 'right');
	ESSBOptionsStructureHelper::field_section_start($where_to_display, 'positions|display-14', esc_html__('Primary content area', 'essb'), esc_html__('Primary content area is located above post information and share details. You can use it to add custom title or message that will appear on top. Leave it blank if you do not wish to have such', 'essb'));
	ESSBOptionsStructureHelper::field_textbox_stretched($where_to_display, 'positions|display-14', 'heroshare_window_title', esc_html__('Window title', 'essb'), esc_html__('Set your custom pop up window title.', 'essb'));
	ESSBOptionsStructureHelper::field_editor($where_to_display, 'positions|display-14', 'heroshare_user_message', esc_html__('Window message', 'essb'), esc_html__('Set your custom message that will appear above buttons', 'essb'), "htmlmixed");
	ESSBOptionsStructureHelper::field_section_end($where_to_display, 'positions|display-14');

	ESSBOptionsStructureHelper::field_section_start($where_to_display, 'positions|display-14', esc_html__('Additional content area', 'essb'), esc_html__('Additional content area is located below share buttons and provide various message types. If you do not wish to display it choose data type to html message and leave field for message blank', 'essb'));
	ESSBOptionsStructureHelper::field_textbox_stretched($where_to_display, 'positions|display-14', 'heroshare_second_title', esc_html__('Title', 'essb'), esc_html__('Set your custom pop up window title for additional content area.', 'essb'));
	$listOfOptions = array("top" => "Top social posts (require build in analytics to be active)", "fans" => "Followers counter (require followers counter to be activated)", "html" => "Custom HTML message");
	ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|display-14', 'heroshare_second_type', esc_html__('Type of displayed data', 'essb'), esc_html__('Choose what you wish to be displayed into second widget area below share buttons. If you wish to leave it blank choose Custom HTML message and do not fill anything inside field for custom message.', 'essb'), $listOfOptions);
	ESSBOptionsStructureHelper::field_textbox_stretched($where_to_display, 'positions|display-14', 'heroshare_second_fans', esc_html__('Followers counter shortcode', 'essb'), esc_html__('Fill in this field you followers counter shortcode that will be used if you select in second widget area to have followers counter. Shortcode can be generated using shortcode generator.', 'essb'));
	ESSBOptionsStructureHelper::field_editor($where_to_display, 'positions|display-14', 'heroshare_second_message', esc_html__('Custom HTML message', 'essb'), esc_html__('Set your custom message (for example html code for opt-in form). This field supports shortcodes.', 'essb'), "htmlmixed");
	ESSBOptionsStructureHelper::field_section_end($where_to_display, 'positions|display-14');

	ESSBOptionsStructureHelper::field_section_start_panels($where_to_display, 'positions|display-14', esc_html__('Hero share window display', 'essb'), '');
	ESSBOptionsStructureHelper::field_textbox_panel($where_to_display, 'positions|display-14', 'heroshare_window_popafter', esc_html__('Display pop up window after (sec)', 'essb'), esc_html__('If you wish pop up window to appear after amount of seconds you can provide theme here. Leave blank for immediate pop up after page load.', 'essb'), '', 'input60', 'fa-clock-o', 'right');
	ESSBOptionsStructureHelper::field_textbox_panel($where_to_display, 'positions|display-14', 'heroshare_user_percent', esc_html__('Display pop up window after percent of content is viewed', 'essb'), esc_html__('Set amount of page content after which the pop up will appear.', 'essb'), '', 'input60', 'fa-arrows-v', 'right');
	ESSBOptionsStructureHelper::field_switch_panel($where_to_display, 'positions|display-14', 'heroshare_display_end', esc_html__('Display pop up at the end of content', 'essb'), esc_html__('Automatically display pop up when the content end is reached', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch_panel($where_to_display, 'positions|display-14', 'heroshare_display_exit', esc_html__('Display pop up on exit intent', 'essb'), esc_html__('Automatically display pop up when exit intent is detected', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch_panel($where_to_display, 'positions|display-14', 'heroshare_user_manual_show', esc_html__('Manual window display mode', 'essb'), esc_html__('Activating manual display mode will allow you to show window when you decide with calling following javascript function essb_heroshare_show();', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch_panel($where_to_display, 'positions|display-14', 'heroshare_avoid_logged_users', esc_html__('Do not show pop up for logged in users', 'essb'), esc_html__('Activate this option to avoid display of pop up when user is logged in into site.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_section_end_panels($where_to_display, 'positions|display-14');

	ESSBOptionsStructureHelper::field_section_start_panels($where_to_display, 'positions|display-14', esc_html__('Window close', 'essb'), '');
	ESSBOptionsStructureHelper::field_switch_panel($where_to_display, 'positions|display-14', 'heroshare_user_notshow_onclose', esc_html__('After user close window do not show it again on this page/post for him', 'essb'), esc_html__('Activating this option will set cookie that will not show again pop up message for next 7 days for user on this post/page', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch_panel($where_to_display, 'positions|display-14', 'heroshare_user_notshow_onclose_all', esc_html__('After user close window do not show it again on all page/post for him', 'essb'), esc_html__('Activating this option will set cookie that will not show again pop up message for next 7 days for user on all posts/pages', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_section_end_panels($where_to_display, 'positions|display-14');
	essb_prepare_location_advanced_customization($where_to_display, 'positions|display-14', 'heroshare');
}

if (!essb_options_bool_value('deactivate_method_postbar')) {
	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-15', esc_html__('Deactivate Components', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-15');
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-15', 'postbar_deactivate_prevnext', esc_html__('Deactivate previous/next articles', 'essb'), esc_html__('Activate this option if you wish to deactivate display of previous/next article buttons', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-15', 'postbar_deactivate_progress', esc_html__('Deactivate read progress bar', 'essb'), esc_html__('Activate this option if you wish to deactivate display of read progress', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-15', 'postbar_deactivate_title', esc_html__('Deactivate post title', 'essb'), esc_html__('Activate this option if you wish to deactivate display of post title', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-15', 'postbar_deactivate_share', esc_html__('Deactivate share buttons', 'essb'), esc_html__('Show post-bar without share buttons', 'essb'));
	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-15');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-15');

	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-15', esc_html__('Activate Additional Components', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-15');
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-15', 'postbar_activate_category', esc_html__('Activate display of category', 'essb'), esc_html__('Activate this option if you wish to activate display of category', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-15', 'postbar_activate_author', esc_html__('Activate display of post author', 'essb'), esc_html__('Activate this option if you wish to activate display of post author', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-15', 'postbar_activate_total', esc_html__('Activate display of total shares counter', 'essb'), esc_html__('Activate this option if you wish to activate display of total shares counter', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-15', 'postbar_activate_comments', esc_html__('Activate display of comments counter', 'essb'), esc_html__('Activate this option if you wish to activate display of comments counter', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-15', 'postbar_activate_time', esc_html__('Activate display of time to read', 'essb'), esc_html__('Activate this option if you wish to activate display of time to read', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-15', 'postbar_activate_time_words', esc_html__('Words per minuted for time to read', 'essb'), esc_html__('Customize the words per minute for time to read display', 'essb'), '', 'input60', 'fa-clock-o', 'right');
	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-15');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-15');

	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-15', esc_html__('Personalize Colors', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-15');
	ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-15', 'postbar_bgcolor', esc_html__('Change default background color', 'essb'), esc_html__('Customize the default post bar background color (#FFFFFF)', 'essb'));
	ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-15', 'postbar_color', esc_html__('Change default text color', 'essb'), esc_html__('Customize the default post bar text color (#111111)', 'essb'));
	ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-15', 'postbar_accentcolor', esc_html__('Change default accent color', 'essb'), esc_html__('Customize the default post bar accent color (#3D8EB9)', 'essb'));
	ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-15', 'postbar_altcolor', esc_html__('Change default alt text color', 'essb'), esc_html__('Customize the default post bar alt text color (#FFFFFF) which is applied to elements with accent background color', 'essb'));
	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-15');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-15');

	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-15', esc_html__('Customize Buttons Style', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	$tab_id = $where_to_display;
	$menu_id = 'positions|display-15';
	$location = 'postbar';


	ESSBOptionsStructureHelper::field_select($tab_id, $menu_id, $location . '_button_style', esc_html__('Buttons Style', 'essb'), esc_html__('Select your button display style.', 'essb'), essb_avaiable_button_style_with_recommend());
	ESSBOptionsStructureHelper::field_select($tab_id, $menu_id, $location . '_template', esc_html__('Template', 'essb'), esc_html__('Select your template for that display location.', 'essb'), essb_available_tempaltes4(true));
	ESSBOptionsStructureHelper::field_switch($tab_id, $menu_id, $location . '_nospace', esc_html__('Remove spacing between buttons', 'essb'), esc_html__('Activate this option to remove default space between share buttons.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($tab_id, $menu_id, $location . '_show_counter', esc_html__('Display counter of sharing', 'essb'), esc_html__('Activate display of share counters.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_select($tab_id, $menu_id, $location . '_counter_pos', esc_html__('Position of counters', 'essb'), esc_html__('Choose your default button counter position', 'essb'), essb_avaliable_counter_positions());

	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-15');

	essb_prepare_location_advanced_customization($where_to_display, 'positions|display-15', 'postbar');
}

if (!essb_options_bool_value('deactivate_method_point')) {

	// Point
	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-16', esc_html__('Point Appearance & Style', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-16');
	$point_positions = array("bottomright" => esc_html__('Bottom Right', 'essb'), 'bottomleft' => esc_html__('Bottom Left', 'essb'), 'topright' => esc_html__('Top Right', 'essb'), 'topleft' => esc_html__('Top Left', 'essb'));
	ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|display-16', 'point_position', esc_html__('Point will appear on', 'essb'), esc_html__('Choose where you wish sharing point to appear', 'essb'), $point_positions);
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-16', 'point_total', esc_html__('Display total counter', 'essb'), esc_html__('Activate this option if you wish to activate display of total counter on point', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	$point_open_triggers = array("no" => esc_html__("No", "essb"), "end" => esc_html__("At the end of content", "essb"), "middle" => esc_html__("After the middle of content", "essb"));
	ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|display-16', 'point_open_auto', esc_html__('Automatic share point open', 'essb'), esc_html__('Select your button display style.', 'essb'), $point_open_triggers);

	$point_display_style = array("simple" => esc_html__('Simple icons', 'essb'), 'advanced' => esc_html__('Advanced Panel', 'essb'));
	ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|display-16', 'point_style', esc_html__('Share buttons action type', 'essb'), esc_html__('Choose your share buttons action type. Simple buttons will just open share buttons when you click the point. Advanced panel allows you also to include custom texts before/after buttons into nice flyout panel', 'essb'), $point_display_style);
	$point_display_style = array("round" => esc_html__('Round', 'essb'), 'square' => esc_html__('Square', 'essb'), 'rounded' => esc_html__('Rounded edges square', 'essb'));
	ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|display-16', 'point_shape', esc_html__('Point button shape', 'essb'), esc_html__('Choose the shape of share point - default is round', 'essb'), $point_display_style);

	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-16', 'point_allowall', esc_html__('Display share point anywhere on site', 'essb'), esc_html__('Default point setup is made to appear on posts, custom post types and pages but it will not appear on lists of posts, dynamic pages activate this option.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-16', 'point_close', esc_html__('Automatic close after seconds', 'essb'), esc_html__('Enter a value if you wish to setup automated close of the point display method once it is is opened on screen (numeric value, example: 5 (5 seconds))', 'essb'), '', 'input60', 'fa-arrows-v', 'right');

	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-16');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-16');

	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-16', esc_html__('Personalize Colors', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-16');
	ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-16', 'point_bgcolor', esc_html__('Background color', 'essb'), '');
	ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-16', 'point_color', esc_html__('Text color', 'essb'), '');
	ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-16', 'point_bgcolor_hover', esc_html__('Background color on hover', 'essb'), '');
	ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-16', 'point_color_hover', esc_html__('Text color on hover', 'essb'), '');
	ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-16', 'point_accentcolor', esc_html__('Total background color', 'essb'), '');
	ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-16', 'point_altcolor', esc_html__('Total text color', 'essb'), '');
	ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-16');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-16');

	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-16', esc_html__('Customize Buttons Style', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	$tab_id = $where_to_display;
	$menu_id = 'positions|display-16';
	$location = 'point';

	/**
	 * Update to the new components
	 * @since 7.3.1
	 */
	ESSBOptionsStructureHelper::title($tab_id, $menu_id, esc_html__('Template', 'essb'), '', 'inner-row');
	ESSBOptionsStructureHelper::field_template_select($tab_id, $menu_id, $location . '_template', $location);

	ESSBOptionsStructureHelper::field_select($tab_id, $menu_id, $location . '_button_style', esc_html__('Buttons Style', 'essb'), esc_html__('Select your button display style.', 'essb'), essb_avaiable_button_style_with_recommend());
	ESSBOptionsStructureHelper::field_switch($tab_id, $menu_id, $location . '_nospace', esc_html__('Remove spacing between buttons', 'essb'), esc_html__('Activate this option to remove default space between share buttons.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($tab_id, $menu_id, $location . '_show_counter', esc_html__('Display counter of sharing', 'essb'), esc_html__('Activate display of share counters.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_select($tab_id, $menu_id, $location . '_counter_pos', esc_html__('Position of counters', 'essb'), esc_html__('Choose your default button counter position. Please note that if you use Simple icons mode all Inside positions will act like Inside - network names will not appear because of visual limitations', 'essb'), essb_avaliable_counter_positions_point());
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-16');

	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-16', esc_html__('Custom Content for Advanced Point Display', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));

	ESSBControlCenter::set_description_inline('point_top_content');
	ESSBControlCenter::set_description_inline('point_bottom_content');

	ESSBOptionsStructureHelper::field_wpeditor($where_to_display, 'positions|display-16', 'point_top_content', esc_html__('Custom content above share buttons', 'essb'), 'The following variables can be used to display the current post details: %%title%% (post title), %%url%% (post URL - link only), %%image%% (featured image  - URL only), %%excerpt%% (post excerpt), %%picture%% (featured image HTML code)', 'htmlmixed');
	ESSBOptionsStructureHelper::field_wpeditor($where_to_display, 'positions|display-16', 'point_bottom_content', esc_html__('Custom content below share buttons', 'essb'), 'The following variables can be used to display the current post details: %%title%% (post title), %%url%% (post URL - link only), %%image%% (featured image  - URL only), %%excerpt%% (post excerpt), %%picture%% (featured image HTML code)', 'htmlmixed');
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-16', 'point_articles', esc_html__('Display prev/next article', 'essb'), esc_html__('Activate this option to display prev/next article from same category', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));

	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-16');

	essb_prepare_location_advanced_customization($where_to_display, 'positions|display-16', 'point');
}

if (!essb_option_bool_value('deactivate_method_except')) {
	essb_prepare_location_advanced_customization($where_to_display, 'positions|display-17', 'excerpt');
}

if (!essb_options_bool_value('deactivate_method_followme')) {
	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-18', esc_html__('Follow me bar appearance', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-18');
	ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|display-18', 'followme_pos', esc_html__('Bar location', 'essb'), esc_html__('Choose the location of the share buttons bar appearing when the content buttons are not visible.', 'essb'), array('' => 'Bottom', 'top' => 'Top', 'left' => 'Left'));
	ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|display-18', 'followme_content', esc_html__('Static content share buttons position', 'essb'), '', array('' => 'Above & Below Content', 'above' => 'Above Content Only', 'below' => 'Below Content Only'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-18', 'followme_full', esc_html__('Stretch buttons bar on full-screen width', 'essb'), esc_html__('The bar takes the same width as buttons have inside the content. Enable this option if you wish to stretch to the full width of the screen. Only top and bottom bar locations.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-18', 'followme_top', esc_html__('Custom top position', 'essb'), esc_html__('Only when top appearance is selected. Use this field if you have a fixed top element and you wish to avoid appearance of bar over it. (numeric value, example: 50)', 'essb'), '', 'input60', 'fa-arrows-v', 'right');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-18', 'followme_top_offset', esc_html__('Offset from the top on user scroll when the bar will appear', 'essb'), esc_html__('Optionally set a numeric value (in pixels). When this value is provided the bar will appear not only when the content buttons are out the visible area, but the user should also pass that depth of scroll in pixels.', 'essb'), '', 'input60', 'fa-arrows-v', 'right');

	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-18', 'followme_nomargin', esc_html__('Remove top/bottom space', 'essb'), esc_html__('The bar has little top and bottom space added to get a better look. On some designs you may wish to remove it - if so just activate the option (or you can add your own custom code).', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-18', 'followme_noleftmargin', esc_html__('My bar does not appear centered on screen', 'essb'), esc_html__('If you experience that type of problem just activate this option to fix it.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-18', 'followme_hide', esc_html__('Hide before end of page', 'essb'), esc_html__('Set this option to yes if you wish the bar to disappear before end of page.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));


	ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-18', 'followme_bg', esc_html__('Bar background', 'essb'), esc_html__('The follow me bar has solid white color as background. If you wish to change that color use this field and set your own (alpha colors supported)', 'essb'), '', 'true');

	ESSBOptionsStructureHelper::field_section_end_panels($where_to_display, 'positions|display-18');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-18');

	essb_prepare_location_advanced_customization($where_to_display, 'positions|display-18', 'followme');
}

if (!essb_options_bool_value('deactivate_method_corner')) {
	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-19', esc_html__('Corner Bar Apperance', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-19');
	ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|display-19', 'cornerbar_pos', esc_html__('Position on screen', 'essb'), esc_html__('Choose the edge of screen where buttons will appear. Default is bottom right corner', 'essb'), array('' => 'Bottom Right', 'bottom-left' => 'Bottom Left', 'top-right' => 'Top Right', 'top-left' => 'Top Left'));
	ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|display-19', 'cornerbar_style', esc_html__('Bar style', 'essb'), esc_html__('Choose a style of bar that contains share buttons', 'essb'), array('' => 'Transparent', 'light' => 'Light', 'dark' => 'Dark', 'glow' => 'Glow'));
	ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-19', 'cornerbar_bg', esc_html__('Customize bar background', 'essb'), esc_html__('Set custom background color when you are using different style than transparent', 'essb'), '', 'true');

	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-19', 'cornerbar_width', esc_html__('Set custom max-width of bar', 'essb'), esc_html__('Bar has default max-width that can be use of 640px. Use this field to change that by entering your custom value: example: 400px, 50%', 'essb'), '', 'input60', 'fa-arrows-h', 'right');
	ESSBOptionsStructureHelper::field_section_end_panels($where_to_display, 'positions|display-19');

	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-19');
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-19', 'cornerbar_hide', esc_html__('Hide before end of page', 'essb'), esc_html__('Set this option to yes if you wish the bar to disappear before end of page.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|display-19', 'cornerbar_show', esc_html__('Visibility on screen', 'essb'), esc_html__('Choose when bar will be visible based on various conditions', 'essb'), array('' => 'Immediately after page load', 'onscroll' => 'Appear on scroll', 'onscroll50' => 'Appear on scroll when at least 50% of content is viewed', 'content' => 'Appear when content buttons are not visible (static positions for above/below content)'));
	ESSBOptionsStructureHelper::field_section_end_panels($where_to_display, 'positions|display-19');

	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-19');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-19', 'cornerbar_text', esc_html__('Custom text before share buttons', 'essb'), esc_html__('Enter custom text to engage shares. Example: Share', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-19', 'cornerbar_arrow', esc_html__('Add arrow after text', 'essb'), esc_html__('Include nice styled arrow pointing share buttons.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-19', 'cornerbar_small', esc_html__('Small size text', 'essb'), esc_html__('Text will appear by default using the theme font size. Set this option to make it looks time (12px).', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_section_end_panels($where_to_display, 'positions|display-19');

	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-19');

	essb_prepare_location_advanced_customization($where_to_display, 'positions|display-19', 'cornerbar');
}

if (!essb_options_bool_value('deactivate_method_booster')) {
	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-20', esc_html__('Booster Appearance', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-20');
	ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|display-20', 'booster_trigger', esc_html__('Appear', 'essb'), esc_html__('Choose when share booster will overtake window', 'essb'), array('' => 'Immediately', 'time' => 'Time Delayed', 'scroll' => 'On Scroll'));
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-20', 'booster_time', esc_html__('Delay in seconds', 'essb'), esc_html__('Set amount of seconds to wait before booster appear', 'essb'), '', 'input60', 'fa-clock-o', 'right');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-20', 'booster_scroll', esc_html__('Percent of content read', 'essb'), esc_html__('Set percent of content to be read before booster appear', 'essb'), '', 'input60', 'fa-arrows-v', 'right');
	ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-20', 'booster_bg', esc_html__('Overlay background color', 'essb'), esc_html__('Setup custom overlay color that will appear over content.', 'essb'), '', 'true');
	ESSBOptionsStructureHelper::field_section_end_panels($where_to_display, 'positions|display-20');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-20');

	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-20', esc_html__('Booster Disappear', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-20');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-20', 'booster_donotshow', esc_html__('Do not show again for', 'essb'), esc_html__('Set custom number of days when booster will remain inactive once appear for user', 'essb'), '', 'input60', 'fa-clock-o', 'right');
	ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|display-20', 'booster_donotshow_on', esc_html__('Do not show on', 'essb'), esc_html__('Customize hide of booster for current post/page or all posts/pages', 'essb'), array('' => 'Current post/page only', 'all' => 'All posts/pages on site'));
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-20', 'booster_autoclose', esc_html__('Automatically close if no action', 'essb'), esc_html__('Make booster overlay close automatically after amount of seconds. Leave blank to remain constantly on screen waiting for action.', 'essb'), '', 'input60', 'fa-clock-o', 'right');
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-20', 'booster_manualclose', esc_html__('Allow user manually close the screen', 'essb'), esc_html__('Set this option to Yes if you wish to allow user manually close the screen. This will not raise do not show action and this visitor will see again the booster screen when post is loaded till an action of sharing is made.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-20', 'booster_manualclose_text', esc_html__('Close link text', 'essb'), esc_html__('Set a custom close text that will change the default (only if the manual close link is active).', 'essb'));
	ESSBOptionsStructureHelper::field_section_end_panels($where_to_display, 'positions|display-20');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-20');

	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-20', esc_html__('Booster Window Content', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-20');
	ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-20', 'booster_window_bg', esc_html__('Content background', 'essb'), esc_html__('Custom content background color.', 'essb'), '', 'true');
	ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-20', 'booster_window_color', esc_html__('Content text color', 'essb'), esc_html__('Custom content text color.', 'essb'), '', 'true');
	ESSBOptionsStructureHelper::field_section_end_panels($where_to_display, 'positions|display-20');
	ESSBOptionsStructureHelper::field_textbox_stretched($where_to_display, 'positions|display-20', 'booster_title', esc_html__('Title', 'essb'), esc_html__('Set own personalized title.', 'essb'));
	ESSBOptionsStructureHelper::field_editor($where_to_display, 'positions|display-20', 'booster_message', esc_html__('Custom message', 'essb'), esc_html__('Set your custom message that will appear above buttons (shortcodes supported)', 'essb'), "htmlmixed");
	ESSBOptionsStructureHelper::field_image($where_to_display, 'positions|display-20', 'booster_bg_image', esc_html__('Background image', 'essb'), esc_html__('Set custom background image that will appear on the content screen', 'essb'), '', 'vertical1');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-20');

	essb_prepare_location_advanced_customization($where_to_display, 'positions|display-20', 'booster');
}

if (!essb_options_bool_value('deactivate_method_sharebutton')) {
	ESSBOptionsStructureHelper::hint($where_to_display, 'positions|display-21', '', esc_html__('The share button can be shown also manually with the [share-action-button] shortcode.', 'essb'), '', 'glowhint');

	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-21', esc_html__('Button Modifications', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-21');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-21', 'sharebutton_text', esc_html__('Button text', 'essb'), esc_html__('Customize the button text. Default if blank: Share', 'essb'), '', '');
	$select_values = array(
		'' => array('title' => '', 'content' => '<i class="essb_icon_share"></i>'),
		'share-alt-square' => array('title' => '', 'content' => '<i class="essb_icon_share-alt-square"></i>'),
		'share-alt' => array('title' => '', 'content' => '<i class="essb_icon_share-alt"></i>'),
		'share-tiny' => array('title' => '', 'content' => '<i class="essb_icon_share-tiny"></i>'),
		'share-outline' => array('title' => '', 'content' => '<i class="essb_icon_share-outline"></i>')
	);
	ESSBOptionsStructureHelper::field_toggle($where_to_display, 'positions|display-21', 'sharebutton_icon', esc_html__('Button icon', 'essb'), esc_html__('Modify the default used icon.', 'essb'), $select_values);
	ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-21', 'sharebutton_bg', esc_html__('Button background color', 'essb'), esc_html__('Customize button background color.', 'essb'), '', 'true');
	ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-21', 'sharebutton_color', esc_html__('Button text color', 'essb'), esc_html__('Customize button text color (also applies on icons that are not SVG).', 'essb'), '', 'true');
	ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-21', 'sharebutton_bg_hover', esc_html__('Button background color on hover', 'essb'), '', '', 'true');
	ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-21', 'sharebutton_color_hover', esc_html__('Button text color on hover', 'essb'), '', '', 'true');
	ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|display-21', 'sharebutton_style', esc_html__('Button style', 'essb'), '', array('' => 'Button with background color', 'outline' => 'Outline button', 'modern' => 'Modern button'));
	$point_positions = array("" => esc_html__('Bottom Right', 'essb'), 'bottomleft' => esc_html__('Bottom Left', 'essb'), 'topright' => esc_html__('Top Right', 'essb'), 'topleft' => esc_html__('Top Left', 'essb'), 'manual' => esc_html__('Manual window open with function call', 'essb'));
	ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|display-21', 'sharebutton_position', esc_html__('Button appearance', 'essb'), esc_html__('Position of the share button on the screen.', 'essb'), $point_positions);
	ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-21', 'sharebutton_total', esc_html__('Display total counter', 'essb'), esc_html__('Include the total counter as a badge to the share button.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
	ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-21', 'sharebutton_bg_total', esc_html__('Total block background color', 'essb'), '', '', 'true');
	ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-21', 'sharebutton_color_total', esc_html__('Total block text color', 'essb'), '', '', 'true');

	ESSBOptionsStructureHelper::field_section_end_panels($where_to_display, 'positions|display-21');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-21');

	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-21', esc_html__('Personalize Pop-up Share Window Content', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
	ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-21');

	ESSBControlCenter::set_description_inline('sharebutton_window_title');
	ESSBControlCenter::set_description_inline('sharebutton_user_message');

	ESSBOptionsStructureHelper::field_textbox_stretched($where_to_display, 'positions|display-21', 'sharebutton_window_title', esc_html__('Title', 'essb'), 'The following variables can be used to display the current post details: %%title%% (post title), %%url%% (post URL - link only), %%image%% (featured image  - URL only), %%excerpt%% (post excerpt), %%picture%% (featured image HTML code)');
	ESSBOptionsStructureHelper::field_editor($where_to_display, 'positions|display-21', 'sharebutton_user_message', 'The following variables can be used to display the current post details: %%title%% (post title), %%url%% (post URL - link only), %%image%% (featured image  - URL only), %%excerpt%% (post excerpt), %%picture%% (featured image HTML code)', "htmlmixed");
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-21', 'sharebutton_win_width', esc_html__('Custom window width', 'essb'), esc_html__('Provide a custom value in case you wish to modify the full-screen appearance. The only numeric value accepted in the field.', 'essb'), '', 'input60', 'fa-arrows-h', 'right');
	ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-21', 'sharebutton_win_height', esc_html__('Custom window height', 'essb'), esc_html__('Provide a custom value in case you wish to modify the full-screen appearance. The only numeric value accepted in the field.', 'essb'), '', 'input60', 'fa-arrows-v', 'right');

	ESSBOptionsStructureHelper::field_section_end_panels($where_to_display, 'positions|display-21');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-21');

	essb_prepare_location_advanced_customization($where_to_display, 'positions|display-21', 'sharebutton');
}

/** 
 * WooCommerce Standard Integration
 */
if (function_exists('wc_get_product') && !essb_option_bool_value('deactivate_method_woocommerce')) {
	essb_prepare_location_advanced_customization($where_to_display, 'positions|display-22', 'woocommerce_content');
}

/**
 * Mobile Share Bar
 */
ESSBOptionsStructureHelper::holder_start($where_to_display, 'positions|display-91', 'essb-panel-sharebar91', 'essb-panel-sharebar91');
ESSBOptionsStructureHelper::field_textbox_stretched($where_to_display, 'positions|display-91', 'mobile_sharebar_text', esc_html__('Text on share bar', 'essb'), esc_html__('Customize the default share bar text (default is Share).', 'essb'));
ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-91', 'mobile_sharebar_bg', esc_html__('Background color', 'essb'), '', '', 'true');
ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-91', 'mobile_sharebar_color', esc_html__('Text/icon color', 'essb'), '', '', 'true');
ESSBOptionsStructureHelper::holder_end($where_to_display, 'positions|display-91');

essb_prepare_location_advanced_customization_mobile($where_to_display, 'positions|display-91', 'sharebar');

/**
 * Mobile Share Point
 */
ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-92', 'sharepoint_bg', esc_html__('Customize background color', 'essb'), '', '', 'true');
ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-92', 'sharepoint_icon_color', esc_html__('Customize icon color', 'essb'), '', '', 'true');

essb_prepare_location_advanced_customization_mobile($where_to_display, 'positions|display-92', 'sharepoint');

/**
 * Mobile Share Buttons Bar
 */
ESSBOptionsStructureHelper::holder_start($where_to_display, 'positions|display-93', 'essb-panel-sharebuttons93', 'essb-panel-sharebuttons93');
ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-93');
$listOfOptions = array("1" => "1 Button", "2" => "2 Buttons", "3" => "3 Buttons", "4" => "4 Buttons", "5" => "5 Buttons", "6" => "6 Buttons", "7" => "7 Buttons", "8" => "8 Buttons");
ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|display-93', 'mobile_sharebuttonsbar_count', esc_html__('Number of buttons in share buttons bar', 'essb'), esc_html__('Provide number of buttons you wish to see in buttons bar. If the number of activated buttons is greater than selected here the last button will be more button which will open pop up with all active buttons.', 'essb'), $listOfOptions);
ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-93', 'mobile_sharebuttonsbar_names', esc_html__('Display network names', 'essb'), esc_html__('Activate this option to display network names (default display is icons only).', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-93', 'mobile_sharebuttonsbar_total', esc_html__('Display total counter', 'essb'), esc_html__('Activate this option to display total share counter as first button. If you activate it please keep in mind that you need to set number of columns to be with one more than buttons you except to see (total counter will act as single button)', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-93', 'mobile_sharebuttonsbar_counter', esc_html__('Display button counter', 'essb'), esc_html__('Set to Yes if you wish to show individual share counter for each button in the mobile share buttons bar.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|display-93', 'mobile_sharebuttonsbar_total_source', esc_html__('Total value source', 'essb'), esc_html__('Choose the source of total values that you will see - shares or views/reads (require views/reads extension)', 'essb'), array('' => 'Shares', 'views' => 'Views/Reads'));

ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-93');

ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-93', esc_html__('Advanced bar appearance', 'essb'), '', '', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'positions|display-93');
ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-93', 'mobile_sharebuttonsbar_showscroll', esc_html__('Show after % of content', 'essb'), esc_html__('Fill a numeric value of percent (example 10) if you wish the bar to appear on scroll.', 'essb'));
ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-93', 'mobile_sharebuttonsbar_hideend', esc_html__('Hide buttons bar before end of page', 'essb'), esc_html__('This option is made to hide buttons bar once you reach 90% of page content to allow the entire footer to be visible.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
ESSBOptionsStructureHelper::field_textbox($where_to_display, 'positions|display-93', 'mobile_sharebuttonsbar_hideend_percent', esc_html__('% of content is viewed to hide buttons bar before end of page', 'essb'), esc_html__('Customize the default percent 90 when buttons bar will hide. Enter value in percents without the % mark.', 'essb'));
$listOfOptions = array("" => "Bottom", "top" => "Top");
ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|display-93', 'mobile_sharebuttonsbar_pos', esc_html__('Bar position on screen', 'essb'), esc_html__('Default position of bar on screen is bottom but you can swap it to top using this field.', 'essb'), $listOfOptions);
ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'positions|display-93');
ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-93');


ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|display-93', esc_html__('Include Ad code / custom code', 'essb'), '', '', array("mode" => "switch", 'switch_id' => 'sharebottom_adarea', 'switch_on' => esc_html__('Yes', 'essb'), 'switch_off' => esc_html__('No', 'essb')));
ESSBOptionsStructureHelper::field_color($where_to_display, 'positions|display-93', 'sharebottom_usercontent_bg', esc_html__('Setup custom background color', 'essb'), esc_html__('Enter custom background color which will apply over the ad bar. That field is required only if you wish to set such. By default bar is transparent when you see it separate from share buttons or it will have background related to bar with buttons', 'essb'));
ESSBOptionsStructureHelper::field_switch($where_to_display, 'positions|display-93', 'sharebottom_usercontent_control', esc_html__('Apply bar appearance rules', 'essb'), esc_html__('Activate this option to make ad bar appear/disappear based on share bar rules. If option is not set bar will be always visible on screen', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
ESSBOptionsStructureHelper::field_editor($where_to_display, 'positions|display-93', 'sharebottom_usercontent', esc_html__('Ad code/custom code', 'essb'), esc_html__('Shortcodes supported', 'essb'), 'htmlmixed');
ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|display-93');

ESSBOptionsStructureHelper::holder_end($where_to_display, 'positions|display-93');

essb_prepare_location_advanced_customization_mobile($where_to_display, 'positions|display-93', 'sharebottom');


if (!essb_option_bool_value('activate_automatic_mobile')) {
	if (essb_option_bool_value('mobile_positions') && essb_option_value('functions_mode_mobile') != 'auto' && essb_option_value('functions_mode_mobile') != 'deactivate') {
		ESSBOptionsStructureHelper::help($where_to_display, 'mobile|setup', '', '', array(
			'Help with settings' => 'https://docs.socialsharingplugin.com/knowledgebase/how-to-use-the-advanced-mobile-options-and-do-you-need-to-use-them/',
			'Step by step guide for setting up responsive mobile share buttons' => 'https://docs.socialsharingplugin.com/knowledgebase/step-by-step-guide-for-setting-up-responsive-buttons-without-dealing-with-mobile-options/'
		));
		ESSBOptionsStructureHelper::panel_start($where_to_display, 'mobile|setup', esc_html__('Advanced Mobile', 'essb') . essb_generate_server_side_mobile_badge(), esc_html__('The advanced mobile options require server-side mobile detection. The server-side mobile detection won\'t run correctly if you are using a cache plugin without mobile support. With the advanced mobile options, you will be able to select the methods that will run only on a mobile. The mobile-optimized position settings are now part of the Positions menu where you can do the changes', 'essb'), 'fa21 fa fa-cogs', array("mode" => "switch", 'switch_id' => 'mobile_positions', 'switch_submit' => 'true', 'switch_on' => esc_html__('Yes', 'essb'), 'switch_off' => esc_html__('No', 'essb')));

		ESSBOptionsStructureHelper::title($where_to_display, 'mobile|setup',  esc_html__('Inline Content Share Buttons', 'essb'), '');
		ESSBOptionsStructureHelper::field_single_position_select($where_to_display, 'mobile|setup', 'content_position_mobile', essb5_available_content_positions_mobile());

		ESSBOptionsStructureHelper::title($where_to_display, 'mobile|setup',  esc_html__('Additional button display positions', 'essb'), esc_html__('Choose additional display methods that can be used to display buttons.', 'essb'));
		ESSBOptionsStructureHelper::field_multi_position_select($where_to_display, 'mobile|setup', 'button_position_mobile', essb5_available_button_positions_mobile());

		ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'mobile|setup');
		ESSBOptionsStructureHelper::field_switch_panel($where_to_display, 'mobile|setup', 'mobile_exclude_tablet', esc_html__('Do not apply mobile settings for tablets', 'essb'), esc_html__('You can avoid mobile rules for settings for tablet devices.', 'essb'), 'recommeded', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
		ESSBOptionsStructureHelper::field_switch_panel($where_to_display, 'mobile|setup', 'mobile_avoid_newwindow', esc_html__('Open sharing window in same tab', 'essb'), esc_html__('Activate this option if you wish to make sharing on mobile open in same tab. Warning! Option may lead to loose visitor as once share dialog is opened with this option user will leave your site. Use with caution..', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
		ESSBOptionsStructureHelper::field_switch_panel($where_to_display, 'mobile|setup', 'mobile_disable_woocommerce_integrations', esc_html__('Disable WooCommerce content display methods on a mobile device', 'essb'), '', '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
		ESSBOptionsStructureHelper::field_section_end_full_panels($where_to_display, 'mobile|setup');

		ESSBOptionsStructureHelper::field_heading($where_to_display, 'mobile|setup', 'heading4', esc_html__('Customize active social networks', 'essb'));
		ESSBOptionsStructureHelper::title($where_to_display, 'mobile|setup', '', esc_html__('Choose social networks you wish to see appearing when your site is opened from a mobile device. This list is optional and you can use it in case you need to set a personalized mobile network list. Otherwise leave it blank for faster update of settings.', 'essb'), 'inner-row');

		ESSBOptionsStructureHelper::field_network_select($where_to_display, 'mobile|setup', 'mobile_networks', 'mobile');


		ESSBOptionsStructureHelper::panel_end($where_to_display, 'mobile|setup');

		ESSBOptionsStructureHelper::panel_start($where_to_display, 'mobile|responsive', esc_html__('Responsive Mobile Share Buttons', 'essb'), esc_html__('Use responsive mode for your share buttons along with the mobile-specific display methods. The responsive mode will add the mobile-only displays and they will become visible when below specific resolution. The responsive mode will help to have a beautiful mobile share buttons display when you are using a cache plugin or server that does not support separate mobile caching (does not store a separate cache that allows server-side work).', 'essb'), 'fa21 fa fa-cogs', array("mode" => "switch", 'switch_id' => 'mobile_css_activate', 'switch_on' => esc_html__('Yes', 'essb'), 'switch_off' => esc_html__('No', 'essb')));
		ESSBOptionsStructureHelper::field_section_start_full_panels($where_to_display, 'mobile|responsive');
		ESSBOptionsStructureHelper::field_textbox_panel($where_to_display, 'mobile|responsive', 'mobile_css_screensize', esc_html__('Width of screen', 'essb'), esc_html__('Leave blank to use the default width of 750. In case you wish to customize it fill value in numbers (without px) and all devices that have screen width below will be marked as mobile.', 'essb'));
		ESSBOptionsStructureHelper::field_switch_panel($where_to_display, 'mobile|responsive', 'mobile_css_readblock', esc_html__('Hide read blocking methods', 'essb'), esc_html__('Activate this option to remove all read blocking methods on mobile devices. Read blocking display methods are Sidebar and Post Vertical Float', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
		ESSBOptionsStructureHelper::field_switch_panel($where_to_display, 'mobile|responsive', 'mobile_css_all', esc_html__('Hide all share buttons on mobile', 'essb'), esc_html__('Activate this option to hide all share buttons on mobile devices including those made with shortcodes.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
		ESSBOptionsStructureHelper::field_switch_panel($where_to_display, 'mobile|responsive', 'mobile_css_optimized', esc_html__('Control mobile optimized display methods', 'essb'), esc_html__('Activate this option to display mobile optimized display methods when resolution meets the mobile size that is defined. Methods that are controlled with this option include: Share Buttons Bar, Share Bar and Share Point. At least one of those methods should be selected in the settings above for additional display methods.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
		ESSBOptionsStructureHelper::field_section_end_panels($where_to_display, 'mobile|responsive');
		ESSBOptionsStructureHelper::panel_end($where_to_display, 'mobile|responsive');


		essb_prepare_location_advanced_customization($where_to_display, 'mobile|other', 'mobile');
		essb_prepare_location_advanced_customization_mobile($where_to_display, 'mobile|bar', 'sharebar');
		essb_prepare_location_advanced_customization_mobile($where_to_display, 'mobile|point', 'sharepoint');
		essb_prepare_location_advanced_customization_mobile($where_to_display, 'mobile|buttons', 'sharebottom');
	} else {
		ESSBOptionsStructureHelper::help($where_to_display, 'mobile', '', '', array('Help With Settings' => 'https://docs.socialsharingplugin.com/knowledgebase/configure-share-buttons-for-mobile/', 'Step By Step Guide For Setting Up Responsive Buttons Without Dealing With Mobile Options' => 'https://docs.socialsharingplugin.com/knowledgebase/step-by-step-guide-for-setting-up-responsive-buttons-without-dealing-with-mobile-options/'));
		ESSBOptionsStructureHelper::hint($where_to_display, 'mobile', esc_html__('Advanced Mobile', 'essb') . essb_generate_server_side_mobile_badge(), esc_html__('The advanced mobile options require server-side mobile detection. The server-side mobile detection won\'t run correctly if you are using a cache plugin without mobile support. With the advanced mobile options, you will be able to select the methods that will run only on a mobile.', 'essb'), '', 'glowhint');
		ESSBOptionsStructureHelper::field_component($where_to_display, 'mobile', 'essb5_advanced_mobile_activate_options', 'false');
	}
}

if ((function_exists('is_amp_endpoint') || function_exists('ampforwp_is_amp_endpoint')) && essb_option_value('functions_mode') != 'light') {
	ESSBOptionsStructureHelper::panel_start($where_to_display, 'amp', esc_html__('Enable static share buttons on AMP posts or pages', 'essb'), '', 'fa21 fa fa-cogs', array("mode" => "switch", 'switch_id' => 'amp_positions', 'switch_on' => esc_html__('Yes', 'essb'), 'switch_off' => esc_html__('No', 'essb')));

	ESSBOptionsStructureHelper::title($where_to_display, 'amp',  esc_html__('Primary content display position', 'essb'), esc_html__('Choose default method that will be used to render buttons inside content', 'essb'));
	ESSBOptionsStructureHelper::field_single_position_select($where_to_display, 'amp', 'content_position_amp', essb_avaliable_content_positions_amp());

	ESSBOptionsStructureHelper::field_heading($where_to_display, 'amp', 'heading4', esc_html__('Customize active social networks', 'essb'));
	ESSBOptionsStructureHelper::title($where_to_display, 'amp', '', esc_html__('Choose social networks you wish to see appearing when your site is opened from a mobile device. This list is optional and you can use it in case you need to set a personalized mobile network list. Otherwise leave it blank for faster update of settings.', 'essb'), 'inner-row');

	ESSBOptionsStructureHelper::field_network_select($where_to_display, 'amp', 'amp_networks', 'amp');
	ESSBOptionsStructureHelper::panel_end($where_to_display, 'amp');
}


function essb_prepare_location_advanced_customization($tab_id, $menu_id, $location = '', $post_type = false, $heading = '')
{
	global $essb_networks, $essb_options;

	if ($heading != '') {
		ESSBOptionsStructureHelper::field_heading($tab_id, $menu_id, 'heading5', $heading);
	}

	$essb_networks = essb_available_social_networks();

	$checkbox_list_networks = array();
	foreach ($essb_networks as $key => $object) {
		$checkbox_list_networks[$key] = $object['name'];
	}

	if ($location != 'mobile') {
		if (!$post_type) {
			//ESSBOptionsStructureHelper::help($tab_id, $menu_id, '', '', array('Help With Settings' => 'https://docs.socialsharingplugin.com/knowledgebase/additional-display-options-for-the-automatic-share-button-positions/'));

			ESSBOptionsStructureHelper::panel_start($tab_id, $menu_id, esc_html__('Responsive Appearance', 'essb'), '', 'ti-mobile essb-icon21', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));

			ESSBOptionsStructureHelper::field_section_start_full_panels($tab_id, $menu_id);

			ESSBOptionsStructureHelper::field_switch($tab_id, $menu_id, $location . '_mobile_deactivate', esc_html__('Do not show on mobile', 'essb'), '', '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
			ESSBOptionsStructureHelper::field_switch($tab_id, $menu_id, $location . '_tablet_deactivate', esc_html__('Do not show on tablet', 'essb'), '', '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
			ESSBOptionsStructureHelper::field_switch($tab_id, $menu_id, $location . '_desktop_deactivate', esc_html__('Do not show on desktop', 'essb'), '', '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));

			if ($location != 'postbar' && $location != 'point') {
				if (essb_option_bool_value('native_active')) {
					ESSBOptionsStructureHelper::field_switch($tab_id, $menu_id, $location . '_native_deactivate', esc_html__('Deactivate native buttons', 'essb'), esc_html__('Activate this option if you wish to deactivate native buttons for that display method.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
				}

				if (!$post_type) {
					if (!essb_option_bool_value('deactivate_module_message')) {
						ESSBOptionsStructureHelper::field_switch($tab_id, $menu_id, $location . '_text_deactivate', esc_html__('Hide message above, before', 'essb'), esc_html__('Enable the option to hide the global call-to-action message you have set in the settings.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
					}
				}
			}
			ESSBOptionsStructureHelper::field_section_end_full_panels($tab_id, $menu_id);
			ESSBOptionsStructureHelper::panel_end($tab_id, $menu_id);
		}
	}

	/**
	 * Adaptive styles are running. Switching off the location settings if so
	 */
	if (essb_option_bool_value('activate_automatic_position')) {
		return;
	}

	$panel_title = "";
	if (!$post_type) {
		$panel_title = esc_html__('Personalize buttons on that display position', 'essb');
	} else {
		$panel_title = esc_html__('Personalize buttons for that post type', 'essb');
	}

	if ($location == 'mobile') {
		$panel_title = esc_html__('Personalize buttons that are displayed on mobile device', 'essb');
	}

	/**
	 * Including the style manager inside settings menu. This will allow to save the style
	 * or install a saved style from the library with just a single click
	 */
	essb5_stylemanager_include_menu($tab_id, $menu_id, $location, essb_option_bool_value($location . '_activate') ? 'true' : '');

	if (!$post_type) {

		if (essb_options_bool_value('activate_customcode_share_methods')) {

			ESSBOptionsStructureHelper::panel_start($tab_id, $menu_id, esc_html__('Custom Code for The Display Method'), '', 'essb-icon21 fa fa-terminal', array("mode" => "switch", 'switch_id' => $location . '_code', 'switch_on' => esc_html__('Yes', 'essb'), 'switch_off' => esc_html__('No', 'essb'), 'switch_submit' => 'true'));
			if (essb_option_bool_value($location . '_code')) {
				ESSBOptionsStructureHelper::hint($tab_id, $menu_id, '', esc_html__('The custom code fields supports HTML, shortcode, custom CSS (wrapped in styles tag). If you wish to write a specific custom CSS code working for this display only, you can use the {instance_class} variable - example: ', 'essb') . '<code>&lt;style type="text/css"&gt;{instance_class} li a { color: red !important; }</style></code>');
				ESSBOptionsStructureHelper::field_editor($tab_id, $menu_id, $location . '_code_before', esc_html__('Before Display', 'essb'), '', 'htmlmixed');
				ESSBOptionsStructureHelper::field_editor($tab_id, $menu_id, $location . '_code_after', esc_html__('After Display', 'essb'), '', 'htmlmixed');
			}
			ESSBOptionsStructureHelper::panel_end($tab_id, $menu_id);

			ESSBOptionsStructureHelper::panel_start($tab_id, $menu_id, esc_html__('Custom CSS'), '', 'essb-icon21 fa fa-code', array("mode" => "switch", 'switch_id' => $location . '_css', 'switch_on' => esc_html__('Yes', 'essb'), 'switch_off' => esc_html__('No', 'essb'), 'switch_submit' => 'true'));
			if (essb_option_bool_value($location . '_css')) {
				ESSBOptionsStructureHelper::hint($tab_id, $menu_id, '', 'Use {selector} to target wrapper element. Examples:
<br/>
<code>{selector} {background-color: red;}</code>
<code>{selector} li a {color: red !important;}</code>');
				ESSBOptionsStructureHelper::field_editor($tab_id, $menu_id, $location . '_css_code', esc_html__('Add your own custom CSS here', 'essb'), '', 'htmlmixed');
			}
			ESSBOptionsStructureHelper::panel_end($tab_id, $menu_id);
		}
	}

	$panel_title = esc_html__('Overwrite global share button styles and networks', 'essb');
	ESSBOptionsStructureHelper::panel_start($tab_id, $menu_id, $panel_title, '', 'essb-icon21 ti-layout-accordion-list', array("mode" => "switch", 'switch_id' => $location . '_activate', 'switch_on' => esc_html__('Yes', 'essb'), 'switch_off' => esc_html__('No', 'essb'), 'switch_submit' => 'true'));

	if (essb_option_bool_value($location . '_activate')) {

		if ($location != 'postbar' && $location != 'point') {

			// Position Style Settings version 5
			ESSBOptionsStructureHelper::holder_start($tab_id, $menu_id, 'essb-advanced-location-setup');

			essb_heading_with_related_section_open($tab_id, $menu_id, esc_html__('Style', 'essb'), '');

			ESSBOptionsStructureHelper::field_template_select($tab_id, $menu_id, $location . '_template', $location, '', esc_html__('Template', 'essb'));

			ESSBOptionsStructureHelper::field_buttonstyle_select($tab_id, $menu_id, $location . '_button_style', $location, false, esc_html__('Style', 'essb'));

			//essb5_main_alignment_choose
			$select_values = array(
				'' => array('title' => 'Left', 'content' => '<i class="ti-align-left"></i>'),
				'center' => array('title' => 'Center', 'content' => '<i class="ti-align-center"></i>'),
				'right' => array('title' => 'Right', 'content' => '<i class="ti-align-right"></i>'),
				'stretched' => array('title' => 'Stetched', 'content' => '<i class="ti-layout-slider"></i>')
			);
			ESSBOptionsStructureHelper::field_toggle($tab_id, $menu_id, $location . '_button_pos', esc_html__('Align', 'essb'), '', $select_values, '', '', '', 'essb-align-selector control_essb-width-section-' . $location);

			$select_values = array(
				'' => array('title' => 'Default', 'content' => 'Default'),
				'xs' => array('title' => 'Extra Small', 'content' => 'XS'),
				's' => array('title' => 'Small', 'content' => 'S'),
				'm' => array('title' => 'Medium', 'content' => 'M'),
				'l' => array('title' => 'Large', 'content' => 'L'),
				'xl' => array('title' => 'Extra Large', 'content' => 'XL'),
				'xxl' => array('title' => 'Extra Extra Large', 'content' => 'XXL')
			);

			ESSBOptionsStructureHelper::holder_start($tab_id, $menu_id, 'essb-button-size-pickers1', 'essb-button-size-pickers1');

			ESSBOptionsStructureHelper::field_toggle($tab_id, $menu_id, $location . '_button_size', esc_html__('Size on desktop', 'essb') . essb_generate_desktop_badge(), '', $select_values, '', '', 'button_size');

			ESSBOptionsStructureHelper::field_toggle($tab_id, $menu_id, $location . '_button_size_mobile', esc_html__('Size on mobile', 'essb') . essb_generate_mobile_badge(), '', $select_values, '', '', 'button_size_mobile');
			ESSBOptionsStructureHelper::holder_end($tab_id, $menu_id);

			ESSBOptionsStructureHelper::field_switch($tab_id, $menu_id, $location . '_nospace', esc_html__('Without space between buttons', 'essb'), esc_html__('Activate this option if you wish to connect share buttons without any space between them.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'), '', '');
			//essb5_main_animation_selection
			ESSBOptionsStructureHelper::field_animation_select($tab_id, $menu_id, $location . '_css_animations', $location, esc_html__('Animate', 'essb'));


			essb_heading_with_related_section_close($tab_id, $menu_id);

			if (!essb_options_bool_value('deactivate_share_counters')) {
				essb_heading_with_related_section_open($tab_id, $menu_id, esc_html__('Counters', 'essb'), '');

				ESSBOptionsStructureHelper::field_switch($tab_id, $menu_id, $location . '_show_counter', esc_html__('Display counter of sharing', 'essb'), esc_html__('Activate display of share counters.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'), '', '');
				//essb5_main_singlecounter_selection
				ESSBOptionsStructureHelper::field_counterposition_select($tab_id, $menu_id, $location . '_counter_pos', $location, esc_html__('Single button share counter position', 'essb'));

				ESSBOptionsStructureHelper::field_totalcounterposition_select($tab_id, $menu_id, $location . '_total_counter_pos', $location, esc_html__('Total share counter position', 'essb'));
				essb_heading_with_related_section_close($tab_id, $menu_id);
			}

			essb_heading_with_related_section_open($tab_id, $menu_id, esc_html__('Width', 'essb'), '');

			$select_values = array(
				'' => array('title' => 'Automatic Width', 'content' => 'AUTO', 'isText' => true),
				'fixed' => array('title' => 'Fixed Width', 'content' => 'Fixed', 'isText' => true),
				'full' => array('title' => 'Full Width', 'content' => 'Full', 'isText' => true),
				'flex' => array('title' => 'Fluid', 'content' => 'Fluid', 'isText' => true),
				'column' => array('title' => 'Columns', 'content' => 'Columns', 'isText' => true),
			);
			ESSBOptionsStructureHelper::field_toggle($tab_id, $menu_id, $location . '_button_width', esc_html__('Button width', 'essb'), '', $select_values);


			ESSBOptionsStructureHelper::holder_start($tab_id, $menu_id, $location . '-essb-fixed-width essb-hidden-open', $location . '-essb-fixed-width');
			ESSBOptionsStructureHelper::title($tab_id, $menu_id, esc_html__('Customize fixed width display', 'essb'), esc_html__('In fixed width mode buttons will have exactly same width defined by you no matter of device or screen resolution (not responsive).', 'essb'), 'inner-row');
			ESSBOptionsStructureHelper::field_section_start_panels($tab_id, $menu_id, '', esc_html__('Customize the fixed width options', 'essb'));
			ESSBOptionsStructureHelper::field_textbox_panel($tab_id, $menu_id, $location . '_fixed_width_value', esc_html__('Custom buttons width', 'essb'), esc_html__('Provide custom width of button in pixels without the px symbol.', 'essb'), '', 'input60', 'fa-arrows-h', 'right');
			ESSBOptionsStructureHelper::field_select_panel($tab_id, $menu_id, $location . '_fixed_width_align', esc_html__('Choose alignment of network name', 'essb'), esc_html__('Provide different alignment of network name, when fixed button width is activated. When counter position is Inside or Inside name, that alignment will be applied for the counter. Default value is center.', 'essb'), array("" => "Center", "left" => "Left", "right" => "Right"));
			ESSBOptionsStructureHelper::field_section_end_panels($tab_id, $menu_id);
			ESSBOptionsStructureHelper::holder_end($tab_id, $menu_id);

			ESSBOptionsStructureHelper::holder_start($tab_id, $menu_id, $location . '-essb-full-width essb-hidden-open', $location . '-essb-full-width');
			ESSBOptionsStructureHelper::title($tab_id, $menu_id, esc_html__('Customize full width display', 'essb'), esc_html__('In full width mode buttons will distribute over the entire screen width on each device (responsive).', 'essb'), 'inner-row');
			ESSBOptionsStructureHelper::field_select_panel($tab_id, $menu_id, $location . '_fullwidth_align', esc_html__('Choose alignment of network name', 'essb'), esc_html__('Provide different alignment of network name (counter when position inside or inside name). Default value is left.', 'essb'), array("left" => "Left", "center" => "Center", "right" => "Right"));
			ESSBOptionsStructureHelper::field_section_start_panels($tab_id, $menu_id, esc_html__('Customize width of first two buttons', 'essb'), esc_html__('Provide different width for the first two buttons in the row. The width should be entered as number in percents (without the % mark). You can fill only one of the values or both values.', 'essb'), '', 'true');
			ESSBOptionsStructureHelper::field_textbox_panel($tab_id, $menu_id, $location . '_fullwidth_first_button', esc_html__('Width of first button', 'essb'), esc_html__('Provide custom width of first button when full width is active. This value is number in percents without the % symbol.', 'essb'), '', 'input60', 'fa-arrows-h', 'right');
			ESSBOptionsStructureHelper::field_textbox_panel($tab_id, $menu_id, $location . '_fullwidth_second_button', esc_html__('Width of second button', 'essb'), esc_html__('Provide custom width of second button when full width is active. This value is number in percents without the % symbol.', 'essb'), '', 'input60', 'fa-arrows-h', 'right');
			ESSBOptionsStructureHelper::field_section_end_panels($tab_id, $menu_id);

			ESSBOptionsStructureHelper::panel_start($tab_id, $menu_id, esc_html__('Fix button apperance', 'essb'), esc_html__('Full width share buttons uses formula to calculate the best width of buttons. In some cases based on other site styles you may need to personalize some of the values in here', 'essb'), '', array("mode" => "toggle", 'state' => 'closed'));
			ESSBOptionsStructureHelper::field_section_start_panels($tab_id, $menu_id, '', esc_html__('Full width option will make buttons to take the width of your post content area.', 'essb'));
			ESSBOptionsStructureHelper::field_textbox_panel($tab_id, $menu_id, $location . '_fullwidth_share_buttons_correction', esc_html__('Max width of button on desktop', 'essb'), esc_html__('Provide custom width of single button when full width is active. This value is number in percents without the % symbol.', 'essb'), '', 'input60', 'fa-arrows-h', 'right');
			ESSBOptionsStructureHelper::field_textbox_panel($tab_id, $menu_id, $location . '_fullwidth_share_buttons_correction_mobile', esc_html__('Max width of button on mobile', 'essb'), esc_html__('Provide custom width of single button when full width is active. This value is number in percents without the % symbol.', 'essb'), '', 'input60', 'fa-arrows-h', 'right');
			ESSBOptionsStructureHelper::field_textbox_panel($tab_id, $menu_id, $location . '_fullwidth_share_buttons_container', esc_html__('Max width of buttons container element', 'essb'), esc_html__('If you wish to display total counter along with full width share buttons please provide custom max width of buttons container in percent without % (example: 90). Leave this field blank for default value of 100 (100%).', 'essb'), '', 'input60', 'fa-arrows-h', 'right');
			ESSBOptionsStructureHelper::field_section_end_panels($tab_id, $menu_id);
			ESSBOptionsStructureHelper::panel_end($tab_id, $menu_id);
			ESSBOptionsStructureHelper::holder_end($tab_id, $menu_id);

			ESSBOptionsStructureHelper::holder_start($tab_id, $menu_id, $location . '-essb-column-width essb-hidden-open', $location . '-essb-column-width');
			ESSBOptionsStructureHelper::title($tab_id, $menu_id, esc_html__('Customize column display', 'essb'), esc_html__('In column mode buttons will distribute over the entire screen width on each device in the number of columns you setup (responsive).', 'essb'), 'inner-row');
			ESSBOptionsStructureHelper::field_section_start_panels($tab_id, $menu_id, '', '');
			$listOfOptions = array("1" => "1", "2" => "2", "3" => "3", "4" => "4", "5" => "5", "6" => "6", "7" => "7", "8" => "8", "9" => "9", "10" => "10");
			ESSBOptionsStructureHelper::field_select_panel($tab_id, $menu_id, $location . '_fullwidth_share_buttons_columns', esc_html__('Number of columns', 'essb'), esc_html__('Choose the number of columns that buttons will be displayed.', 'essb'), $listOfOptions);
			ESSBOptionsStructureHelper::field_select_panel($tab_id, $menu_id, $location . '_fullwidth_share_buttons_columns_align', esc_html__('Choose alignment of network name', 'essb'), esc_html__('Provide different alignment of network name (counter when position inside or inside name). Default value is left.', 'essb'), array("" => "Left", "center" => "Center", "right" => "Right"));
			ESSBOptionsStructureHelper::field_section_end_panels($tab_id, $menu_id);
			ESSBOptionsStructureHelper::holder_end($tab_id, $menu_id);

			ESSBOptionsStructureHelper::holder_start($tab_id, $menu_id, $location . '-essb-flex-width essb-hidden-open', $location . '-essb-flex-width');
			ESSBOptionsStructureHelper::title($tab_id, $menu_id, esc_html__('Customize Flex Buttons', 'essb'), esc_html__('In flexible width mode buttons will always take the full width of content area. You can customize the alignment or preserve space for the total area.', 'essb'), 'inner-row');
			ESSBOptionsStructureHelper::field_section_start_panels($tab_id, $menu_id, '', esc_html__('Customize the flex width options', 'essb'));
			ESSBOptionsStructureHelper::field_textbox_panel($tab_id, $menu_id, $location . '_flex_width_value', esc_html__('Preserve Space For Total Counter (%)', 'essb'), esc_html__('Use this field to setup custom width for the total counter area (numeric value only as a percent)', 'essb'), '', 'input60', 'fa-arrows-h', 'right');
			ESSBOptionsStructureHelper::field_textbox_panel($tab_id, $menu_id, $location . '_flex_button_value', esc_html__('Assign a Specific Button Width (%)', 'essb'), esc_html__('Use this field to setup custom width for single button (numeric value only as a percent)', 'essb'), '', 'input60', 'fa-arrows-h', 'right');
			ESSBOptionsStructureHelper::field_select_panel($tab_id, $menu_id, $location . '_flex_width_align', esc_html__('Choose alignment of network name', 'essb'), esc_html__('Provide different alignment of network name, when this button width is activated. When counter position is Inside or Inside name, that alignment will be applied for the counter. Default value is center.', 'essb'), array("" => "Left", "center" => "Center", "right" => "Right"));
			ESSBOptionsStructureHelper::field_section_end_panels($tab_id, $menu_id);
			ESSBOptionsStructureHelper::holder_end($tab_id, $menu_id);

			essb_heading_with_related_section_close($tab_id, $menu_id);

			ESSBOptionsStructureHelper::holder_end($tab_id, $menu_id);
		}

		if ($location != 'mobile' && !essb_option_bool_value('user_fixed_networks')) {

			ESSBOptionsStructureHelper::field_heading($tab_id, $menu_id, 'heading7', esc_html__('Personalize Social Networks', 'essb'), '', 'mt40 pb0', '<i class="ti-share"></i>');
			ESSBOptionsStructureHelper::holder_start($tab_id, $menu_id, 'essb-related-heading7', '');


			ESSBOptionsStructureHelper::title($tab_id, $menu_id, esc_html__('Personalize Displayed Social Networks', 'essb'), esc_html__('Choose a personalized list of social networks that will run for this display only (different than global set). Leave blank to use the global set list of social networks', 'essb'));
			ESSBOptionsStructureHelper::field_network_select($tab_id, $menu_id, $location . '_networks', $location);


			if (essb_is_active_social_network('more') && !essb_options_bool_value('more_button_global_settings')) {
				ESSBOptionsStructureHelper::panel_start($tab_id, $menu_id, esc_html__('More Button', 'essb'), '', 'fa21 essb_icon_more', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
				$more_options = array("1" => "Display all active networks after more button", "2" => "Display all social networks as pop up", "3" => "Display only active social networks as pop up", "4" => "Display all active networks after more button in popup");
				ESSBOptionsStructureHelper::field_select($tab_id, $menu_id, $location . '_more_button_func', esc_html__('More button', 'essb'), esc_html__('Select networks that you wish to appear in your list. With drag and drop you can rearrange them.', 'essb'), essb_available_more_button_commands());
				$more_options = array("plus" => "Plus icon", "dots" => "Dots icon");

				$select_values = array(
					'plus' => array('title' => 'Plus Icon', 'content' => '<i class="essb_icon_more"></i>'),
					'dots' => array('title' => 'Dots Icon', 'content' => '<i class="essb_icon_more_dots"></i>')
				);
				ESSBOptionsStructureHelper::field_toggle($tab_id, $menu_id, $location . '_more_button_icon', esc_html__('More button icon', 'essb'), esc_html__('Select more button icon style. You can choose from default + symbol or dots symbol', 'essb'), $select_values);
				ESSBOptionsStructureHelper::panel_end($tab_id, $menu_id);
			}

			if (essb_is_active_social_network('share') && !essb_option_bool_value('share_button_global_settings')) {
				ESSBOptionsStructureHelper::panel_start($tab_id, $menu_id, esc_html__('Share Button', 'essb'), '', 'fa21 essb_icon_share', array("mode" => "toggle", "state" => "closed", "css_class" => "essb-auto-open"));
				$more_options = array("1" => "Display all active networks after more button", "2" => "Display all social networks as pop up", "3" => "Display only active social networks as pop up", "4" => "Display all active networks after more button in popup");
				ESSBOptionsStructureHelper::field_select($tab_id, $menu_id, $location . '_share_button_func', esc_html__('Share button function', 'essb'), esc_html__('Select networks that you wish to appear in your list. With drag and drop you can rearrange them.', 'essb'), essb_available_more_button_commands());


				$select_values = array(
					'plus' => array('title' => '', 'content' => '<i class="essb_icon_more"></i>'),
					'dots' => array('title' => '', 'content' => '<i class="essb_icon_more_dots"></i>'),
					'share' => array('title' => '', 'content' => '<i class="essb_icon_share"></i>'),
					'share-alt-square' => array('title' => '', 'content' => '<i class="essb_icon_share-alt-square"></i>'),
					'share-alt' => array('title' => '', 'content' => '<i class="essb_icon_share-alt"></i>'),
					'share-tiny' => array('title' => '', 'content' => '<i class="essb_icon_share-tiny"></i>'),
					'share-outline' => array('title' => '', 'content' => '<i class="essb_icon_share-outline"></i>')
				);
				ESSBOptionsStructureHelper::field_toggle($tab_id, $menu_id, $location . '_share_button_icon', esc_html__('Share button icon', 'essb'), esc_html__('Choose the share button icon you will use (default is share if nothing is selected)', 'essb'), $select_values);


				$more_options = array("" => "Default from settings (like other share buttons)", "icon" => "Icon only", "button" => "Button", "text" => "Text only");
				ESSBOptionsStructureHelper::field_select($tab_id, $menu_id, $location . '_share_button_style', esc_html__('Share button style', 'essb'), esc_html__('Select more button icon style. You can choose from default + symbol or dots symbol', 'essb'), $more_options);

				$share_counter_pos = array("hidden" => "No counter", "inside" => "Inside button without text", "insidename" => "Inside button after text", "insidebeforename" => "Inside button before text", "topn" => "Top", "bottom" => "Bottom");
				ESSBOptionsStructureHelper::field_select($tab_id, $menu_id, $location . '_share_button_counter', esc_html__('Display total counter with the following position', 'essb'), esc_html__('Choose where you wish to display total counter of shares assigned with this button. <br/> To view total counter you need to have share counters active and they should not be running in real time mode. Also you need to have your share button set with style button. When you use share button with counter we highly recommend to hide total counter by setting position to be hidden - this will avoid having two set of total value on screen.', 'essb'), $share_counter_pos);

				ESSBOptionsStructureHelper::panel_end($tab_id, $menu_id);
			}


			ESSBOptionsStructureHelper::holder_end($tab_id, $menu_id);
		}
	}
	ESSBOptionsStructureHelper::panel_end($tab_id, $menu_id); // customization

}


function essb_prepare_location_advanced_customization_mobile($tab_id, $menu_id, $location = '')
{
	$panel_title = esc_html__('Overwrite global share button styles and networks', 'essb');
	ESSBOptionsStructureHelper::panel_start($tab_id, $menu_id, $panel_title, '', 'essb-icon21 ti-layout-accordion-list', array("mode" => "switch", 'switch_id' => $location . '_activate', 'switch_on' => esc_html__('Yes', 'essb'), 'switch_off' => esc_html__('No', 'essb'), 'switch_submit' => 'true'));

	if (essb_option_bool_value($location . '_activate')) {

		ESSBOptionsStructureHelper::field_heading($tab_id, $menu_id, 'heading7', esc_html__('Style', 'essb'), '', 'pb0', '<i class="ti-palette"></i>');
		ESSBOptionsStructureHelper::holder_start($tab_id, $menu_id, 'essb-related-heading7', '');

		ESSBOptionsStructureHelper::field_select($tab_id, $menu_id, $location . '_template', esc_html__('Template', 'essb'), esc_html__('Select your template for that display location.', 'essb'), essb_available_tempaltes4(true));

		if ($location != 'sharebottom') {
			ESSBOptionsStructureHelper::field_switch($tab_id, $menu_id, $location . '_nospace', esc_html__('Remove spacing between buttons', 'essb'), esc_html__('Activate this option to remove default space between share buttons.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
		}

		if ($location != 'sharebottom') {
			ESSBOptionsStructureHelper::field_switch($tab_id, $menu_id, $location . '_show_counter', esc_html__('Display counter of sharing', 'essb'), esc_html__('Activate display of share counters.', 'essb'), '', esc_html__('Yes', 'essb'), esc_html__('No', 'essb'));
			ESSBOptionsStructureHelper::field_select($tab_id, $menu_id, $location . '_counter_pos', esc_html__('Position of counters', 'essb'), esc_html__('Choose your default button counter position', 'essb'), essb_avaliable_counter_positions_mobile());
			ESSBOptionsStructureHelper::field_select($tab_id, $menu_id, $location . '_total_counter_pos', esc_html__('Position of total counter', 'essb'), esc_html__('For vertical display methods left means before buttons (top) and right means after buttons (bottom).', 'essb'), essb_avaiable_total_counter_position_mobile());
		}

		ESSBOptionsStructureHelper::holder_end($tab_id, $menu_id);

		if (!essb_option_bool_value('user_fixed_networks')) {
			ESSBOptionsStructureHelper::field_heading($tab_id, $menu_id, 'heading7', esc_html__('Personalize Social Networks', 'essb'), '', 'mt40 pb0', '<i class="ti-share"></i>');
			ESSBOptionsStructureHelper::holder_start($tab_id, $menu_id, 'essb-related-heading7', '');
			ESSBOptionsStructureHelper::field_network_select($tab_id, $menu_id, $location . '_networks', $location);
			ESSBOptionsStructureHelper::holder_end($tab_id, $menu_id);
		}
	}
	ESSBOptionsStructureHelper::panel_end($tab_id, $menu_id); // customization    
}


function essb3_register_positions_by_posttypes()
{
	global $wp_post_types, $where_to_display;
	$where_to_display = 'where';
	ESSBOptionsStructureHelper::help($where_to_display, 'positions|positions_posttype', '', '', array('Help with Settings' => 'https://docs.socialsharingplugin.com/knowledgebase/working-with-automatic-display-positions-for-social-share-buttons-and-plugin-integrations/#Different_Positions_by_Post_Types'));
	ESSBOptionsStructureHelper::panel_start($where_to_display, 'positions|positions_posttype', esc_html__('Enable different positions by post type', 'essb'), '', 'fa21 ti-layout', array("mode" => "switch", 'switch_id' => 'positions_by_pt', 'switch_on' => esc_html__('Yes', 'essb'), 'switch_off' => esc_html__('No', 'essb')));
	$pts = get_post_types(array('show_ui' => true, '_builtin' => true));
	$cpts = get_post_types(array('show_ui' => true, '_builtin' => false));
	$first_post_type = "";
	$key = 1;
	foreach ($pts as $pt) {
		ESSBOptionsStructureHelper::holder_start($where_to_display, 'positions|positions_posttype', 'essb-position-posttype mb40', 'essb-position-posttype-' . esc_attr($pt));

		ESSBOptionsStructureHelper::field_heading($where_to_display, 'positions|positions_posttype', 'heading7', $wp_post_types[$pt]->label, '', 'pb0', '<i class="ti-tag"></i>');
		ESSBOptionsStructureHelper::holder_start($where_to_display, 'positions|positions_posttype', 'essb-related-heading7', '');

		ESSBOptionsStructureHelper::structure_row_start($where_to_display, 'positions|positions_posttype');
		ESSBOptionsStructureHelper::structure_section_start($where_to_display, 'positions|positions_posttype', 'c6', esc_html__('Inline (Content)', 'essb'), '');
		ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|positions_posttype', 'content_position_' . $pt, '', '', essb_simplified_radio_check_list(essb_avaliable_content_positions(), true));
		ESSBOptionsStructureHelper::structure_section_end($where_to_display, 'positions|positions_posttype');

		ESSBOptionsStructureHelper::structure_section_start($where_to_display, 'positions|positions_posttype', 'c6', esc_html__('Additional (Website)', 'essb'), '');
		ESSBOptionsStructureHelper::field_checkbox_list($where_to_display, 'positions|positions_posttype', 'button_position_' . $pt, '', '', essb_simplified_radio_check_list(essb_available_button_positions()));
		ESSBOptionsStructureHelper::structure_section_end($where_to_display, 'positions|positions_posttype');
		ESSBOptionsStructureHelper::structure_row_end($where_to_display, 'positions|positions_posttype');
		ESSBOptionsStructureHelper::holder_end($where_to_display, 'positions|positions_posttype');
		ESSBOptionsStructureHelper::holder_end($where_to_display, 'positions|positions_posttype');
	}

	foreach ($cpts as $cpt) {
		ESSBOptionsStructureHelper::holder_start($where_to_display, 'positions|positions_posttype', 'essb-position-posttype mb40', 'essb-position-posttype-' . esc_attr($cpt));

		ESSBOptionsStructureHelper::field_heading($where_to_display, 'positions|positions_posttype', 'heading7', $wp_post_types[$cpt]->label, '', 'pb0', '<i class="ti-tag"></i>');
		ESSBOptionsStructureHelper::holder_start($where_to_display, 'positions|positions_posttype', 'essb-related-heading7', '');

		ESSBOptionsStructureHelper::structure_row_start($where_to_display, 'positions|positions_posttype');
		ESSBOptionsStructureHelper::structure_section_start($where_to_display, 'positions|positions_posttype', 'c6', esc_html__('Inline (Content)', 'essb'), '');
		ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|positions_posttype', 'content_position_' . $cpt, '', '', essb_simplified_radio_check_list(essb_avaliable_content_positions(), true));
		ESSBOptionsStructureHelper::structure_section_end($where_to_display, 'positions|positions_posttype');

		ESSBOptionsStructureHelper::structure_section_start($where_to_display, 'positions|positions_posttype', 'c6', esc_html__('Additional (Website)', 'essb'), '');
		ESSBOptionsStructureHelper::field_checkbox_list($where_to_display, 'positions|positions_posttype', 'button_position_' . $cpt, '', '', essb_simplified_radio_check_list(essb_available_button_positions()));
		ESSBOptionsStructureHelper::structure_section_end($where_to_display, 'positions|positions_posttype');
		ESSBOptionsStructureHelper::structure_row_end($where_to_display, 'positions|positions_posttype');
		ESSBOptionsStructureHelper::holder_end($where_to_display, 'positions|positions_posttype');
		ESSBOptionsStructureHelper::holder_end($where_to_display, 'positions|positions_posttype');
	}

	/**
	 * Separate settings for homepage
	 */
	$custom_pt = 'homepage';
	ESSBOptionsStructureHelper::holder_start($where_to_display, 'positions|positions_posttype', 'essb-position-posttype  mb40', 'essb-position-posttype-' . esc_attr($custom_pt));

	ESSBOptionsStructureHelper::field_heading($where_to_display, 'positions|positions_posttype', 'heading7', 'Homepage', '', 'pb0', '<i class="ti-tag"></i>');
	ESSBOptionsStructureHelper::holder_start($where_to_display, 'positions|positions_posttype', 'essb-related-heading7', '');

	ESSBOptionsStructureHelper::structure_row_start($where_to_display, 'positions|positions_posttype');
	ESSBOptionsStructureHelper::structure_section_start($where_to_display, 'positions|positions_posttype', 'c6', esc_html__('Inline (Content)', 'essb'), '');
	ESSBOptionsStructureHelper::field_select($where_to_display, 'positions|positions_posttype', 'content_position_' . $custom_pt, '', '', essb_simplified_radio_check_list(essb_avaliable_content_positions(), true));
	ESSBOptionsStructureHelper::structure_section_end($where_to_display, 'positions|positions_posttype');

	ESSBOptionsStructureHelper::structure_section_start($where_to_display, 'positions|positions_posttype', 'c6', esc_html__('Additional (Website)', 'essb'), '');
	ESSBOptionsStructureHelper::field_checkbox_list($where_to_display, 'positions|positions_posttype', 'button_position_' . $custom_pt, '', '', essb_simplified_radio_check_list(essb_available_button_positions()));
	ESSBOptionsStructureHelper::structure_section_end($where_to_display, 'positions|positions_posttype');
	ESSBOptionsStructureHelper::structure_row_end($where_to_display, 'positions|positions_posttype');
	ESSBOptionsStructureHelper::holder_end($where_to_display, 'positions|positions_posttype');
	ESSBOptionsStructureHelper::holder_end($where_to_display, 'positions|positions_posttype');

	ESSBOptionsStructureHelper::panel_end($where_to_display, 'positions|positions_posttype');
}

function essb3_post_type_select()
{
	global $essb_admin_options, $wp_post_types;

	$pts = get_post_types(array('show_ui' => true, '_builtin' => true));
	$cpts = get_post_types(array('show_ui' => true, '_builtin' => false));

	$current_posttypes = array();
	if (is_array($essb_admin_options)) {
		$current_posttypes = essb_options_value('display_in_types', array());
	}

	if (!is_array($current_posttypes)) {
		$current_posttypes = array();
	}
	echo '<ul class="essb-posttype-selection">';

	foreach ($pts as $pt) {
		$selected = in_array($pt, $current_posttypes) ? 'checked="checked"' : '';
		printf('<li><input type="checkbox" name="essb_options[display_in_types][]" id="%1$s" value="%1$s" %2$s> <label for="%1$s">%3$s</label></li>', $pt, $selected, $wp_post_types[$pt]->label);
	}

	foreach ($cpts as $pt) {
		$selected = in_array($pt, $current_posttypes) ? 'checked="checked"' : '';
		printf('<li><input type="checkbox" name="essb_options[display_in_types][]" id="%1$s" value="%1$s" %2$s> <label for="%1$s">%3$s</label></li>', $pt, $selected, $wp_post_types[$pt]->label);
	}

	$selected = in_array('all_lists', $current_posttypes) ? 'checked="checked"' : '';
	printf('<li><input type="checkbox" name="essb_options[display_in_types][]" id="%1$s" value="%1$s" %2$s> <label for="%1$s">%3$s</label></li>', 'all_lists', $selected, 'Lists of articles (blog, archives, search results, etc.)');

	$selected = in_array('homepage', $current_posttypes) ? 'checked="checked"' : '';
	printf('<li><input type="checkbox" name="essb_options[display_in_types][]" id="%1$s" value="%1$s" %2$s> <label for="%1$s">%3$s</label></li>', 'homepage', $selected, 'Homepage');

	echo '</ul>';
}

function essb5_live_preview_single_position($options)
{
	$element_options = isset($options['element_options']) ? $options['element_options'] : array();
	$position = isset($element_options['position']) ? $element_options['position'] : '';

	// if there is no position we cannot display live preview
	if ($position == '') {
		return;
	}

	// preparing actual list of social networks from general plugin section screen
	$all_networks = essb_available_social_networks(true);
	$active_networks = essb_option_value('networks');
	$r = array();
	if (!is_array($active_networks)) {
		$r[] = array('key' => 'facebook', 'name' => 'Facebook');
		$r[] = array('key' => 'twitter', 'name' => 'Twitter');
		$r[] = array('key' => 'pinterest', 'name' => 'Pinterest');
		$r[] = array('key' => 'linkedin', 'name' => 'LinkedIn');
	} else {
		foreach ($active_networks as $key) {
			$r[] = array('key' => $key, 'name' => isset($all_networks[$key]) ? $all_networks[$key]['name'] : $key);
		}
	}

	$code = '<div class="essb-component-buttons-livepreview' . (essb_using_svg_icons_sharing() ? ' essb-component-buttons-livepreview-svg' : '') . '" data-settings="essb_' . $position . '_global_preview">';
	$code .= '</div>';

	$code .= "<script type=\"text/javascript\">

	var essb_" . $position . "_global_preview = {
	'networks': " . json_encode($r) . ",
	'template': 'essb_field_" . $position . "_template',
	'button_style': 'essb_field_" . $position . "_button_style',
	'button_size': 'essb_options_" . $position . "_button_size',
	'align': 'essb_options_" . $position . "_button_pos',
	'nospace': 'essb_field_" . $position . "_nospace',
	'counter': 'essb_field_" . $position . "_show_counter',
	'counter_pos': 'essb_field_" . $position . "_counter_pos',
	'total_counter_pos': 'essb_field_" . $position . "_total_counter_pos',
	'width': 'essb_options_" . $position . "_button_width',
	'animation': 'essb_field_" . $position . "_css_animations',
	'fixed_width': 'essb_options_" . $position . "_fixed_width_value',
	'fixed_align': 'essb_options_" . $position . "_fixed_width_align',
	'columns_count': 'essb_options_" . $position . "_fullwidth_share_buttons_columns',
	'columns_align': 'essb_options_" . $position . "_fullwidth_share_buttons_columns_align',
	'full_button': 'essb_options_" . $position . "_fullwidth_share_buttons_correction',
	'full_align': 'essb_options_" . $position . "_fullwidth_align',
	'full_first': 'essb_options_" . $position . "_fullwidth_first_button',
	'full_second': 'essb_options_" . $position . "_fullwidth_second_button',
	'flex_align': 'essb_options_" . $position . "_flex_width_align',
	'flex_width': 'essb_options_" . $position . "_flex_width_value',
	'flex_button': 'essb_options_" . $position . "_flex_button_value'
	};

	</script>";

	echo $code;
}

function essb5_custom_positions($opts = array())
{
?>
	<a href="#" class="ao-new-subscribe-design ao-new-display-position"><span class="essb_icon fa fa-plus-square"></span><span><?php esc_html_e('Add New Custom Display/Position', 'essb'); ?></span></a>
	<div id="ao-custom-positions"></div>
	<script type="text/javascript">
		var ao_user_positions = <?php echo json_encode(essb5_get_custom_positions()); ?>;
		jQuery(document).ready(function($) {
			var ao_user_positions_draw = window.ao_user_positions_draw = function() {
				var r = [];

				if (ao_user_positions) {
					for (var key in ao_user_positions) {
						r.push('<div class="advancedoptions-tile" style="margin-bottom: 20px;">');
						r.push('<div class="advancedoptions-tile-head">');
						r.push('<div class="advancedoptions-tile-head-title">');
						r.push('	<h3>' + ao_user_positions[key] + '</h3>');
						r.push('	<span class="status tag" style="margin-left: 10px;">' + key + '</span>');
						r.push('</div>');
						r.push('<div class="advancedoptions-tile-head-tools">');
						r.push('<a href="#" class="essb-btn tile-deactivate ao-remove-display-position" data-position="' + key + '"><i class="fa fa-close"></i>Remove</a>');
						r.push('</div>');
						r.push('</div>'); // head
						r.push('<div class="advancedoptions-tile-body" style="overflow: hidden;">');

						r.push('<div class="label" style="background: #eff3fc;padding: 10px;border-radius: 4px;">The custom position you can add anywhere inside code using shortcode or a PHP function call. Choose the options below to get the shortcode/snippet you can set and use.</div>');

						r.push('<div style="display: flex; align-items: center;" class="customposition-generate customposition-generate-' + key + '" data-key="' + key + '">');

						r.push('<div class="block" style="margin: 10px 20px;">');
						r.push('<div class="param" data-microtip-size="large" data-microtip-position="bottom-right" role="tooltip" aria-label="Choose the implementation type of the custom position to get the sample code." style="border-bottom: 1px dotted; padding-bottom: 5px; margin-bottom: 5px;">Usage type</div>');
						r.push('<div class="value">');
						r.push('<select data-role="type" data-key="' + key + '"><option value="code">Shortcode</option><option value="php">PHP function</option></select>');
						r.push('</div>');
						r.push('</div>'); // block

						r.push('<div class="block" style="margin: 10px 20px;">');
						r.push('<div class="param" data-microtip-size="large" data-microtip-position="bottom-right" role="tooltip" aria-label="Selecting Yes the custom position will always show buttons no matter if you enable it or not from the positions menu. Keep it NO and you can control its work like other automatic positions." style="border-bottom: 1px dotted; padding-bottom: 5px; margin-bottom: 5px;">Force display</div>');
						r.push('<div class="value">');
						r.push('<select data-role="force" data-key="' + key + '"><option value="false">NO</option><option value="true">YES</option></select>');
						r.push('</div>');
						r.push('</div>'); // block

						r.push('<div class="block" style="margin: 10px 20px;">');
						r.push('<div class="param" data-microtip-size="large" data-microtip-position="bottom-right" role="tooltip" aria-label="Set to Yes if you include this code in an archive template to make it share correct information." style="border-bottom: 1px dotted; padding-bottom: 5px; margin-bottom: 5px;">Archive template</div>');
						r.push('<div class="value">');
						r.push('<select data-role="archive" data-key="' + key + '"><option value="false">NO</option><option value="true">YES</option></select>');
						r.push('</div>');
						r.push('</div>'); // block

						r.push('<div class="block" style="margin: 10px 20px;">');
						r.push('<div class="param" data-microtip-size="large" data-microtip-position="bottom-right" role="tooltip" aria-label="Set to Yes to see the possible custom share parameters you can use." style="border-bottom: 1px dotted; padding-bottom: 5px; margin-bottom: 5px;">Custom share details</div>');
						r.push('<div class="value">');
						r.push('<select data-role="custom" data-key="' + key + '"><option value="false">NO</option><option value="true">YES</option></select>');
						r.push('</div>');
						r.push('</div>'); // block


						<?php if (function_exists('jet_engine')) { ?>
							r.push('<div class="block" style="margin: 10px 20px;">');
							r.push('<div class="param" data-microtip-size="large" data-microtip-position="bottom-right" role="tooltip" aria-label="Using the custom position shortcode in the JetEngine Listing template." style="border-bottom: 1px dotted; padding-bottom: 5px; margin-bottom: 5px;">JetEngine Listing</div>');
							r.push('<div class="value">');
							r.push('<select data-role="jetengine" data-key="' + key + '"><option value="false">NO</option><option value="true">YES</option></select>');
							r.push('</div>');
							r.push('</div>'); // block
						<?php } ?>

						r.push('</div>'); // customposition-generate

						r.push('<div class="code" style="margin: 20px;"><code class="customposition-code customposition-code-' + key + '" style="padding: 12px; display: block;">[social-share-display display="' + key + '"]</code></div>')
						r.push('<div class="customshare-' + key + ' label" style="display: none; background: #eff3fc;padding: 10px;border-radius: 4px;"><b style="color: red;">Warning!</b> The customization works based on each network specifics of the sharing process. All parameters after custom are optional and you can use one or all.<br/></br>' +
							'<code>url=""</code> - this parameter can change the shared URL for the instance. <br/>' +
							'<code>message=""</code> - this parameter you can use to set custom message. This message will be used only for the networks that does not rely only on the social media optimization tags. Example: Twitter (tweet), Pinterest (description), Mobile Messaging Apps (message). <br/>' +
							'<code>image=""</code> - set URL to a custom image. The only network that support custom images is Pinterest.<br/>' +
							'<code>tweet=""</code> - set a custom tweet that will be used. If you don\'t provide the custom tweet and custom message, plugin will use what you have done as changes on the post.</div>');

						r.push('</div>'); // advancedoptions-tile-body
						r.push('</div>');
					}
				}

				document.querySelector('#ao-custom-positions').innerHTML = r.join('');

				$('.ao-remove-display-position').click(function(e) {
					e.preventDefault();

					var position = $(this).data('position') || '';
					if (!position || position == '') return;

					aoRemoveCustomPosition(position);
				});

				$('.customposition-generate select').on('change', function() {
					var key = $(this).data('key') || '',
						options = {};

					if (key == '') return;

					$('.customposition-generate-' + key + ' select').each(function() {
						var param = $(this).data('role') || '';
						options[param] = $(this).val();
					});

					ao_user_positions_code(options, key);
				});
			};

			var ao_user_positions_code = window.ao_user_positions_code = function(options, key) {
				if ((options['custom'] || '') == 'true') $('.customshare-' + key).show();
				else $('.customshare-' + key).hide();

				if ((options['type'] || '') == 'code') {
					var output = [];
					output.push('[social-share-display display="' + key + '"');

					if ((options['force'] || '') == 'true') output.push(' force="true"');
					if ((options['archive'] || '') == 'true') output.push(' archive="true"');
					if ((options['custom'] || '') == 'true') output.push(' custom="true" url="https://example.com" message="Custom share message" image="https://example.com/image.jpg" tweet="Custom tweet"');
					if ((options['jetengine'] || '') == 'true') output.push(' jetengine="true"');
					output.push(']');

					$('.customposition-code-' + key).html(output.join(''));
				} else {
					var output = [];
					if ((options['force'] || '') == 'true' || (options['archive'] || '') == 'true' || (options['custom'] || '') == 'true') {
						var custom = '';

						if ((options['custom'] || '') == 'true') {
							custom = ', array("custom" => true, "url" => "https://example.com", "message" => "Custom share message", "image" => "https://example.com/image.jpg", "tweet" => "Custom tweet")';
						}
						output.push('&lt;?php if (function_exists("essb_custom_position_draw")) { essb_custom_position_draw("' + key + '", ' + options['force'] + ', ' + options['archive'] + '' + custom + '); }  ?&gt;');
					} else {
						output.push('&lt;?php if (function_exists("essb_custom_position_draw")) { essb_custom_position_draw("' + key + '"); }  ?&gt;');
					}

					$('.customposition-code-' + key).html(output.join(''));
				}
			}

			ao_user_positions_draw();
		});
	</script>

<?php
}

function essb5_additional_excerpt_options()
{
	echo essb5_generate_code_advanced_settings_panel(
		esc_html__('Display on Post Excerpts', 'essb'),
		esc_html__('Your theme should support the excerpt display in order to use the function. If the theme does not use the excerpt display you can activate appearance on the listing pages from the post type menu.', 'essb'),
		'excerpts',
		'',
		esc_html__('Configure', 'essb'),
		'ti-settings',
		'no',
		'500'
	);
}

function essb5_additional_deactivate_options()
{
	echo essb5_generate_code_advanced_settings_panel(
		esc_html__('Advanced plugin\'s components deactivate', 'essb') . essb_generate_expert_badge(),
		'',
		'advanced-deactivate',
		'',
		esc_html__('Configure', 'essb'),
		'ti-settings',
		'no',
		'500',
		'',
		'',
		esc_html__('Advanced Deactivate', 'essb')
	);
}

function essb5_advanced_mobile_activate_options()
{
	$value = essb_sanitize_option_value('functions_mode_mobile');

	// Advanced value is used as a trigger to the mobile settings only
	if ($value == 'advanced') {
		$value = '';
		global $essb_options;
		$essb_options['functions_mode_mobile'] = '';
		ESSB_Plugin_Options::set('functions_mode_mobile', '');
	}

	$select_values = array(
		'' => array('title' => 'No specific mobile settings - using global and position rules', 'content' => '<i class="ti-panel"></i> <div class="content"><span class="title">No advanced mobile settings</span><span class="desc">Use the current settings you have made and don\'t enable the advanced mobile options.</span></div>', 'isText' => true),
		/**
		 * @deprecated 
		 * @since 8.0
		 * 'auto' => array('title' => 'Plugin will automatically setup share buttons', 'content' => '<i class="ti-star"></i><div class="content"><span class="title">Automatic Setup</span><span class="desc">The plugin will automatically setup responsive share buttons for mobile</span></div>', 'isText'=>true),
		 */
		'deactivate' => array('title' => 'Deactivate mobile settings and do not show buttons on mobile devices', 'content' => '<i class="ti-close"></i><div class="content"><span class="title">Deactivate on mobile</span><span class="desc">The plugin will not show buttons on mobile devices</span></div>', 'isText' => true),
		'advanced' => array('title' => 'Advanced Custom Mobile Display & Positions ', 'content' => '<i class="ti-mobile"></i> <div class="content"><span class="title">Enable advanced mobile options</span><span class="desc">Allow advanced mobile position and network setup. The feature runs on a server level and requires a plugin being able to detect the mobile device. If the advanced mobile is not used correctly (or you have a cache plugin without mobile support) this will produce visual glitches.</span></div>', 'isText' => true),
	);


	essb_component_options_group_select('functions_mode_mobile', $select_values, '', $value);

	ESSBOptionsFramework::draw_holder_start(array('class' => 'functions_mode_mobile_auto', 'user_id' => 'functions_mode_mobile_auto'));
	ESSBOptionsFramework::draw_heading(esc_html__('Choose mobile position', 'essb'), '4');
	ESSBOptionsFramework::draw_single_position_select('functions_mode_mobile_auto', 'essb_options', array('values' => essb5_available_positions_mobile_only()));

	// Mobile breakpoint
	echo '<div class="essb-automobile-breakpoint">';
	ESSBOptionsFramework::draw_options_row_start(esc_html('Mobile breakpoint', 'essb'), esc_html('Sets the breakpoint for mobile devices. Below this breakpoint mobile layout will appear (Default: 768px). To make the mobile methods work for tablets enter 1024.', 'essb'));
	ESSBOptionsFramework::draw_input_field('functions_mode_mobile_auto_breakpoint', false, 'essb_options', essb_sanitize_option_value('functions_mode_mobile_auto_breakpoint'));
	ESSBOptionsFramework::draw_options_row_end();
	echo '</div>';

	ESSBOptionsFramework::draw_holder_end();
}

function essb5_advanced_other_features_where_activate()
{
	$share_features = ESSBControlCenter::$features_group['display'];

	foreach ($share_features as $feature) {
		if (ESSBControlCenter::feature_is_deactivated($feature)) {
			echo essb5_generate_code_advanced_activate_panel(
				ESSBControlCenter::get_feature_title($feature),
				ESSBControlCenter::get_feature_long_description($feature),
				ESSBControlCenter::get_feature_deactivate_option($feature),
				'',
				esc_html__('Activate', 'essb'),
				'fa fa-check',
				ESSBControlCenter::get_feature_icon($feature) . ' ao-darkblue-icon',
				'ao-additional-features-activate',
				'false'
			);
		}
	}
}


function essb5_advanced_additional_sharebutton_positions()
{
	echo essb5_generate_code_advanced_settings_panel(
		esc_html__('Manage Available Share Button Displays', 'essb'),
		esc_html__('Control the available for usage automatic display positions for share buttons. Currently, you see below only those that are active. You can add more from the existing or deactivate those you do not need.', 'essb'),
		'manage-positions',
		'',
		esc_html__('Manage', 'essb'),
		'ti-layout',
		'yes',
		'500',
		'',
		'ti-layout',
		'',
		false,
		'https://docs.socialsharingplugin.com/knowledgebase/working-with-automatic-display-positions-for-social-share-buttons-and-plugin-integrations/#Manage_Available_Share_Button_Displays'
	);
}

function essb_admin_position_disable_checks()
{
	return array(
		'deactivate_method_float',
		'deactivate_method_postfloat',
		'deactivate_method_sidebar',
		'deactivate_method_topbar',
		'deactivate_method_bottombar',
		'deactivate_method_popup',
		'deactivate_method_flyin',
		'deactivate_method_heroshare',
		'deactivate_method_postbar',
		'deactivate_method_point',
		'deactivate_method_image',
		'deactivate_method_followme',
		'deactivate_method_corner',
		'deactivate_method_booster',
		'deactivate_method_sharebutton',
		'deactivate_method_except',
		'deactivate_method_widget'
	);
}

function essb_admin_has_disabled_position()
{
	$list = essb_admin_position_disable_checks();
	$r = false;

	foreach ($list as $key) {
		if (essb_option_bool_value($key)) {
			$r = true;
		}
	}

	return $r;
}

function essb_admin_disabled_positions_message()
{
	$total = 23;
	$disabled = 0;
	$list = essb_admin_position_disable_checks();

	$r = false;

	foreach ($list as $key) {
		if (essb_option_bool_value($key)) {
			$disabled++;
		}
	}

	echo '<div class="essb-usefull-hint essb-usefull-hint-positions">';
	echo '<div class="title">';
	echo sprintf(esc_html__('There are %s additional positions for automated social share buttons display which you can use on your website.', 'essb'), '<span class="small-tag">' . ($disabled) . '</span>');
	echo '<a href="#" class="essb-enable-positions">Manage Positions</a>';
	echo '</div>';
	echo '</div>'; // usefull-hint
}
