setting_enabled['toggle-social']) ? $siteseo->setting_enabled['toggle-social'] : ''; $nonce = wp_create_nonce('siteseo_toggle_nonce'); $current_tab = isset($_GET['tab']) ? sanitize_key($_GET['tab']) : 'tab_knowledge_graph'; $social_subtabs = [ 'tab_knowledge_graph' => esc_html__('Knowledge Graph', 'siteseo'), 'tab_social_accounts' => esc_html__('Your social accounts', 'siteseo'), 'tab_facebook' => esc_html__('Facebook (Open Graph) ', 'siteseo'), 'tab_twitter' => esc_html__('X Card', 'siteseo') ]; echo '
'; Util::admin_header(); echo '
'; wp_nonce_field('siteseo_social_settings'); Util::render_toggle('Social Networks - SiteSEO', 'social_toggle', $social_toggle, $nonce); echo '
'; Util::submit_btn(); 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 = !empty($options['social_knowledge_type']) ? $options['social_knowledge_type'] : ''; $option_org_name = !empty($options['social_knowledge_name']) ? $options['social_knowledge_name'] : ''; $option_org_logo = !empty($options['social_knowledge_img']) ? $options['social_knowledge_img'] : ''; $option_org_number = !empty($options['social_knowledge_phone']) ? $options['social_knowledge_phone'] : ''; $option_org_contact_type = !empty($options['social_knowledge_contact_type']) ? $options['social_knowledge_contact_type'] : ''; $option_org_contact_option = !empty($options['social_knowledge_contact_option']) ? $options['social_knowledge_contact_option'] : ''; echo '

'.esc_html__('Knowledge Graph','siteseo').'

'.esc_html__('Set up Google Knowledge Graph.','siteseo').'

'.esc_html__('Person or organization','siteseo').'
'.esc_html__('Your name/organization','siteseo').'
'.esc_html__('Your photo/organization logo','siteseo').'

'.esc_html__('JPG, PNG, WebP and GIF allowed.','siteseo').'


'.esc_html__('Organizations phone number (only for Organizations)','siteseo').'
'.esc_html__('Contact type (only for Organizations)','siteseo').'
'.esc_html__('Contact option (only for Organizations)','siteseo').'
'; } 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 $facebook_acct = !empty($options['social_accounts_facebook']) ? $options['social_accounts_facebook'] : ''; $twitter_acct = !empty($options['social_accounts_twitter']) ? $options['social_accounts_twitter'] : ''; $instagram_acct = !empty($options['social_accounts_instagram']) ? $options['social_accounts_instagram'] : ''; $youtube_acct = !empty($options['social_accounts_youtube']) ? $options['social_accounts_youtube'] : ''; $pinterest_acct = !empty($options['social_accounts_pinterest']) ? $options['social_accounts_pinterest'] : ''; $additional_acct = !empty($options['social_accounts_additional']) ? implode("\n", $options['social_accounts_additional']) : ''; echo '

'.esc_html__('Your social accouts', 'siteseo').'

'.esc_html__('Facebook', 'siteseo').'
'.esc_html__('X Username', 'siteseo').'
'.esc_html__('Pinterest URL', 'siteseo').'
'.esc_html__('Instagram URL', 'siteseo').'
'.esc_html__('YouTube URL', 'siteseo').'
'.esc_html__('Additional Accounts', 'siteseo').'

'.esc_html__('Enter 1 URL per line.', 'siteseo').'

'; } 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 = !empty($options['social_twitter_card']) ? $options['social_twitter_card'] : ''; $options_og_card = !empty($options['social_twitter_card_og']) ? $options['social_twitter_card_og'] : ''; $option_image_size = !empty($options['social_twitter_card_img_size']) ? $options['social_twitter_card_img_size'] : ''; $option_twitter_img = !empty($options['social_twitter_card_img']) ? $options['social_twitter_card_img'] : ''; echo '

'.esc_html__('X Card','siteseo').'

'.esc_html__('Manage your X card','siteseo').'

'. /* translators: placeholders are just tag */ wp_kses_post(sprintf(__('We generate the %1$s og:image %2$s meta in the following order:', 'siteseo'), '', '')).'

  1. '.esc_html__('Custom OG Image from the SEO metabox', 'siteseo').'
  2. '.esc_html__('Post thumbnail / Product category thumbnail (Featured image)', 'siteseo').'
  3. '.esc_html__('First image of your post content', 'siteseo').'
  4. '.esc_html__('Global OG Image set in SEO > Social > Open Graph', 'siteseo').'
  5. '.esc_html__('Site icon from the Customizer', 'siteseo').'
'.esc_html__('X Card','siteseo').' '.esc_html__('Manage your X Card','siteseo').'
'.esc_html__('Enable X Card','siteseo').'
'.esc_html__('Use OG if no X Cards','siteseo').'
'.esc_html__('Default X Image','siteseo').'

'.esc_html__('Minimum size: 144x144px (300x157px with large card), recommended aspect ratio 1:1 (2:1 for large card), maximum file size 5MB.','siteseo').'

'.esc_html__('X Card Image Size','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 = !empty($options['social_facebook_og']) ? $options['social_facebook_og'] : ''; $option_fb_img = !empty($options['social_facebook_img']) ? $options['social_facebook_img'] : ''; $option_fb_defult_img = !empty($options['social_facebook_img_default']) ? $options['social_facebook_img_default'] : ''; $option_fb_ownership = !empty($options['social_facebook_link_ownership_id']) ? $options['social_facebook_link_ownership_id'] : ''; $option_fb_admin_id = !empty($options['social_facebook_admin_id']) ? $options['social_facebook_admin_id'] : ''; echo '

'.esc_html__('Facebook (Open Graph)','siteseo').'

'.esc_html__('Manage Open Graph data to enhance how your links appear on platforms like Facebook, Pinterest, LinkedIn, and WhatsApp when shared. Improve your click-through rate by including relevant details, such as an attention-grabbing image.','siteseo').'

'. /* translators: placeholders are just tag */ wp_kses_post(sprintf(__('We generate the %1$s OG:image %2$s meta in the following sequence:', 'siteseo'), '', '')).'

  1. '.esc_html__('Custom OG image from the SEO metabox', 'siteseo').'
  2. '.esc_html__('Post thumbnail / Product category thumbnail (Featured image)', 'siteseo').'
  3. '.esc_html__('First image in your post content', 'siteseo').'
  4. '.esc_html__('Global OG:image set in SEO > Social > OG Card', 'siteseo').'
'.esc_html__('Enable OG date','siteseo').'
'.esc_html__('Default Image','siteseo').'

'.esc_html__('Minimum size: 200x200px, ideal ratio 1.91:1, 8MB max. (e.g., 1640x856px or 3280x1712px for retina screens).','siteseo').'

'.esc_html__('If no default image is set, we will use your site icon defined in the Customizer.','siteseo').'

'.esc_html__('Override Default Image','siteseo').'

'. /* translators: placeholders are just tag */ wp_kses_post(sprintf(__('Please define a default %1$s OG image %2$s using the field above.', 'siteseo'), '','')).'

'.esc_html__('Link Ownership ID','siteseo').'

'.esc_html__('Enter one or more Facebook Page IDs linked to a URL to enable link editing and instant article publishing.','siteseo').'

'.esc_html('').'
'.esc_html__('Admin ID','siteseo').'

'.esc_html__('The ID (or a comma-separated list for properties that support multiple IDs) of an app, user of the app, or Page Graph API object.', 'siteseo').'

'.esc_html('').'
'; } static function save_settings(){ global $siteseo; check_admin_referer('siteseo_social_settings'); if(!current_user_can('siteseo_manage') || !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_text_field(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'])) : ''; $options['social_accounts_additional'] = isset($_POST['siteseo_options']['additional']) ? explode("\n", sanitize_textarea_field(wp_unslash($_POST['siteseo_options']['additional']))) : ''; $options['social_accounts_additional'] = Util::clean_url($options['social_accounts_additional']); // We accept 1 url per line. } 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); } }