';
foreach($social_subtabs as $tab_key => $tab_caption){
$active_class = ($current_tab === $tab_key) ? ' nav-tab-active' : '';
echo'
' . esc_html($tab_caption) . '';
}
echo'
';
self::knowledge_graph();
echo'
';
self::social_accouts();
echo'
';
self::facebook();
echo'
';
siteseo_submit_button(__('save changes', 'siteseo'));
echo'';
}
static function knowledge_graph(){
global $siteseo;
if(!empty($_POST['submit'])){
self::save_settings();
}
$options = get_option('siteseo_social_option_name');
//load data
$option_org_type = isset($options['social_knowledge_type']) ? $options['social_knowledge_type'] : '';
$option_org_name = isset($options['social_knowledge_name']) ? $options['social_knowledge_name'] : '';
$option_org_logo = isset($options['social_knowledge_img']) ? $options['social_knowledge_img'] : '';
$option_org_number = isset($options['social_knowledge_phone']) ? $options['social_knowledge_phone'] : '';
$option_org_contact_type = isset($options['social_knowledge_contact_type']) ? $options['social_knowledge_contact_type'] : '';
$option_org_contact_option = isset($options['social_knowledge_contact_option']) ? $options['social_knowledge_contact_option'] : '';
echo'
Knowledge Graph
Configure Google Knowledge Graph.
';
}
static function social_accouts(){
global $siteseo;
if(!empty($_POST['submit'])){
self::save_settings();
}
//$options = $siteseo->social_settings;
$options = get_option('siteseo_social_option_name');
//load settings
$options_facebook_acct = isset($options['social_accounts_facebook']) ? $options['social_accounts_facebook'] : '';
$options_twitter_acct = isset($options['social_accounts_twitter']) ? $options['social_accounts_twitter'] : '';
$options_instagram_acct = isset($options['social_accounts_instagram']) ? $options['social_accounts_instagram'] : '';
$options_youtube_acct = isset($options['social_accounts_youtube']) ? $options['social_accounts_youtube'] : '';
$options_pinterest_acct = isset($options['social_accounts_pinterest']) ? $options['social_accounts_pinterest'] : '';
echo'
Your social accouts
';
}
static function twitter(){
global $siteseo;
if(!empty($_POST['submit'])){
self::save_settings();
}
//$options = $siteseo->social_settings;
$options = get_option('siteseo_social_option_name');
//load data
$option_enable_card = isset($options['social_twitter_card']) ? $options['social_twitter_card'] : 1;
$options_og_card = isset($options['social_twitter_card_og']) ? $options['social_twitter_card_og'] : '';
$option_image_size = isset($options['social_twitter_card_img_size']) ? $options['social_twitter_card_img_size'] : '';
$option_twitter_img = isset($options['social_twitter_card_img']) ? $options['social_twitter_card_img'] : '';
echo'
Twitter (Twitter card)
Manage your Twitter card.
'.wp_kses_post(__('We generate the og:image meta in this order:', 'siteseo')).'
- '.esc_html__('Custom OG Image from SEO metabox', 'siteseo').'
- '.esc_html__('Post thumbnail / Product category thumbnail (Featured image)', 'siteseo').'
- '.esc_html__('First image of your post content', 'siteseo').'
- '.esc_html__('Global OG Image set in SEO > Social > Open Graph', 'siteseo').'
- '.esc_html__('Site icon from the Customizer', 'siteseo').'
';
}
static function facebook(){
global $siteseo;
if(!empty($_POST['submit'])){
self::save_settings();
}
// load seetings
//$options = $siteseo->social_settings;
$options = get_option('siteseo_social_option_name');
$option_fb_enable_og = isset($options['social_facebook_og']) ? $options['social_facebook_og'] : 1;
$option_fb_img = isset($options['social_facebook_img']) ? $options['social_facebook_img'] : '';
$option_fb_defult_img = isset($options['social_facebook_img_default']) ? $options['social_facebook_img_default'] : '';
$option_fb_ownership = isset($options['social_facebook_link_ownership_id']) ? $options['social_facebook_link_ownership_id'] : '';
$option_fb_admin_id = isset($options['social_facebook_admin_id']) ? $options['social_facebook_admin_id'] : '';
echo'
Facebook (Open Graph)
Manage Open Graph data. These metatags will be used by Facebook, Pinterest, LinkedIn, WhatsApp... when a user shares a link on its own social network. Increase your click-through rate by providing relevant information such as an attractive image.
'.wp_kses_post(__('We generate the twitter:image meta in this order:', 'siteseo')).'
- '.esc_html__('Custom Twitter image from SEO metabox', 'siteseo'). '
- '.esc_html__('Post thumbnail / Product category thumbnail (Featured image)', 'siteseo').'
- '.esc_html__('First image of your post content', 'siteseo').'
- '.esc_html__('Global Twitter:image set in SEO > Social > Twitter Card', 'siteseo').'
';
}
static function save_settings(){
global $siteseo;
check_admin_referer('siteseo_social_settings');
if(!current_user_can('manage_options') || !is_admin()){
return;
}
$options = [];
if(empty($_POST['siteseo_options'])){
return;
}
if(isset($_POST['siteseo_options']['knowledge_graph_tab'])){
$options['social_knowledge_type'] = isset($_POST['siteseo_options']['org_type']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['org_type'])) : '';
$options['social_knowledge_name'] = isset($_POST['siteseo_options']['org_name']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['org_name'])) : '';
$options['social_knowledge_img'] = isset($_POST['siteseo_options']['org_logo']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['org_logo'])) : '';
$options['social_knowledge_phone'] = isset($_POST['siteseo_options']['org_contact_number']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['org_contact_number'])) : '';
$options['social_knowledge_contact_type'] = isset($_POST['siteseo_options']['org_contact_type']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['org_contact_type'])) : '';
$options['social_knowledge_contact_option'] = isset($_POST['siteseo_options']['org_contact_option']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['org_contact_option'])) : '';
}
if(isset($_POST['siteseo_options']['social_account_tab'])){
$options['social_accounts_facebook'] = isset($_POST['siteseo_options']['facebook']) ? sanitize_url(wp_unslash($_POST['siteseo_options']['facebook'])) : '';
$options['social_accounts_twitter'] = isset($_POST['siteseo_options']['twitter']) ? sanitize_url(wp_unslash($_POST['siteseo_options']['twitter'])) : '';
$options['social_accounts_instagram'] = isset($_POST['siteseo_options']['instagram']) ? sanitize_url(wp_unslash($_POST['siteseo_options']['instagram'])) : '';
$options['social_accounts_youtube'] = isset($_POST['siteseo_options']['youtube']) ? sanitize_url(wp_unslash($_POST['siteseo_options']['youtube'])) : '';
$options['social_accounts_pinterest'] = isset($_POST['siteseo_options']['pinterest']) ? sanitize_url(wp_unslash($_POST['siteseo_options']['pinterest'])) : '';
}
if(isset($_POST['siteseo_options']['facebook_tab'])){
$options['social_facebook_og'] = isset($_POST['siteseo_options']['enable_fb_og']);
$options['social_facebook_img'] = isset($_POST['siteseo_options']['fb_image']) ? sanitize_url(wp_unslash($_POST['siteseo_options']['fb_image'])) : '';
$options['social_facebook_img_default'] = isset($_POST['siteseo_options']['fb_default_img']);
$options['social_facebook_link_ownership_id'] = isset($_POST['siteseo_options']['fb_owership_id']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['fb_owership_id'])) : '';
$options['social_facebook_admin_id'] = isset($_POST['siteseo_options']['fb_admin_id']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['fb_admin_id'])) : '';
}
if(isset($_POST['siteseo_options']['twitter_tab'])){
$options['social_twitter_card'] = isset($_POST['siteseo_options']['enable_twitter_card']);
$options['social_twitter_card_og'] = isset($_POST['siteseo_options']['card_og']);
$options['social_twitter_card_img'] = isset($_POST['siteseo_options']['twitter_img']) ? sanitize_url(wp_unslash($_POST['siteseo_options']['twitter_img'])) : '';
$options['social_twitter_card_img_size'] = isset($_POST['siteseo_options']['image_size']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['image_size'])) : '';
}
update_option('siteseo_social_option_name' , $options);
}
}