esc_html__('Image SEO', 'siteseo'), 'tab_advanced' => esc_html__('Advanced', 'siteseo'), 'tab_appearance' => esc_html__('Appearance', 'siteseo'), 'tab_security' => esc_html__('Security', 'siteseo'), 'tab_toc' => esc_html__('Table of content', 'siteseo') ]; echo '
'; Util::admin_header(); echo '
'; wp_nonce_field('siteseo_advance_settings'); $advanced_toggle = isset($siteseo->setting_enabled['toggle-advanced']) ? $siteseo->setting_enabled['toggle-advanced'] : ''; $nonce = wp_create_nonce('siteseo_toggle_nonce'); Util::render_toggle('Image SEO & Advanced settings - SiteSEO', 'advanced_toggle', $advanced_toggle, $nonce); echo '
'; Util::submit_btn(); echo '
'; } static function image_seo(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } //$options = $siteseo->$advanced_settings; $options = get_option('siteseo_advanced_option_name'); $option_attachment = isset($options['advanced_attachments']) ? $options['advanced_attachments'] : ''; $option_attachment_file = isset($options['advanced_attachments_file']) ? $options['advanced_attachments_file'] : ''; $option_clean_filename = isset($options['advanced_clean_filename']) ? $options['advanced_clean_filename'] : ''; $option_img_title = isset($options['advanced_image_auto_title_editor']) ? $options['advanced_image_auto_title_editor'] : ''; $option_img_alt = isset($options['advanced_image_auto_alt_editor']) ? $options['advanced_image_auto_alt_editor'] : ''; $option_target_key = isset($options['advanced_image_auto_alt_target_kw']) ? $options['advanced_image_auto_alt_target_kw'] : ''; $option_cap_img = isset($options['advanced_image_auto_caption_editor']) ? $options['advanced_image_auto_caption_editor'] : ''; $option_desc_img = isset($options['advanced_image_auto_desc_editor']) ? $options['advanced_image_auto_desc_editor'] : ''; echo '

'.esc_html__('Image SEO','siteseo').'

'.esc_html__('Images can drive significant traffic to your site. Be sure to always add alt text, optimize file sizes, and properly name the files, among other best practices.','siteseo').'

'.esc_html__('Redirect attachment pages to the post parent page.','siteseo').'
'.esc_html__('Redirect attachment pages to their file URL','siteseo').'

'.esc_html__('If this option is enabled, it will override the redirection of attachment pages to the post parent.','siteseo').'

'.esc_html__('Cleaning media filename','siteseo').'

'.esc_html__('e.g. "ExãMple 1 cópy!.jpg" => "example-1-copy.jpg"','siteseo').'

'.esc_html__('Automatically set the image Title','siteseo').'

'.esc_html__('We use the product title for WooCommerce items.','siteseo').'

'.esc_html__('Automatically set the image Alt txt','siteseo').'
'.esc_html__('Automatically set the image alt text using target keywords..','siteseo').'

'.esc_html__('This setting will apply only to images without alt text on the frontend. It is retroactive, meaning if you disable it, images that previously had empty alt text will revert to being empty.','siteseo').'

'.esc_html__('Automatically set the image Caption','siteseo').'
'.esc_html__('Automatically set the image Description','siteseo').'
'; } static function advanced(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } //$options = $siteseo->advanced_settings; $options = get_option('siteseo_advanced_option_name'); $option_taxonomy_desc = isset($options['advanced_tax_desc_editor']) ? $options['advanced_tax_desc_editor'] : ''; $option_category_url = isset($options['advanced_category_url']) ? $options['advanced_category_url'] : ''; $option_noreferrer_link = isset($options['advanced_noreferrer']) ? $options['advanced_noreferrer'] : ''; $option_wp_generator = isset($options['advanced_wp_generator']) ? $options['advanced_wp_generator'] : ''; $option_hentry_post = isset($options['advanced_hentry']) ? $options['advanced_hentry'] : ''; $option_author_url = isset($options['advanced_comments_author_url']) ? $options['advanced_comments_author_url'] : ''; $option_site_fileds = isset($options['advanced_comments_website']) ? $options['advanced_comments_website'] : ''; $option_rel_attributes = isset($options['advanced_comments_form_link']) ? $options['advanced_comments_form_link'] : ''; $option_shortlink = isset($options['advanced_wp_shortlink']) ? $options['advanced_wp_shortlink'] : ''; $option_wlw_meta_tag = isset($options['advanced_wp_wlw']) ? $options['advanced_wp_wlw'] : ''; $option_rsd_meta_tag = isset($options['advanced_wp_rsd']) ? $options['advanced_wp_rsd'] : ''; $option_google_meta_value = isset($options['advanced_google']) ? $options['advanced_google'] : ''; $option_bing_meta_value = isset($options['advanced_bing']) ? $options['advanced_bing'] : ''; $option_pinterest_meta_value = isset($options['advanced_pinterest']) ? $options['advanced_pinterest'] : ''; $option_yandex_meta_value = isset($options['advanced_yandex']) ? $options['advanced_yandex'] : ''; $option_remove_wocommerce_cat_url = isset($options['advanced_product_cat_url']) ? $options['advanced_product_cat_url'] : ''; echo '

'.esc_html__('Advanced','siteseo').'

'.esc_html__('Advanced SEO options for advanced users.','siteseo').'

'.esc_html__('Add WP Editor to taxonomy description textarea','siteseo').'
'.esc_html__('Remove /category/ in URL','siteseo').'

'.esc_attr('e.g. "https://example.com/category/my-post-category/" => "https://example.com/my-post-category/"','siteseo').'

'.esc_html__('Remove category base from product permalinks','siteseo').'
'.esc_html__('Remove noreferrer link attribute in post content','siteseo').'

'.esc_html__('Useful for affiliate links (eg: Amazon)','siteseo').'

'.esc_html__('Remove WordPress meta generator tag','siteseo').'
'.esc_html('').'
'.esc_html__('Remove hentry post class','siteseo').'
'.esc_html__('Remove author URL','siteseo').'
'.esc_html__('Remove website field from comment form','siteseo').'
'.esc_html__('Add the "nofollow", "noopener", and "noreferrer" rel attributes to the links in the comment form.','siteseo').'
'.esc_url('https://www.example.com/my-blog-post/#respond').'
'.esc_html__('Remove WordPress shortlink meta tag','siteseo').'
'.esc_html('').'
'.esc_html__('Remove Windows Live Writer meta tag','siteseo').'
'.esc_html('').'
'.esc_html__('Remove RSD meta tag','siteseo').'

'.esc_html__('The WordPress Site Health feature will display an HTTPS warning if you enable this option. However, this is a false positive.','siteseo').'

' . esc_html('') . '
'.esc_html__('Google site verification','siteseo').'

'. /* translators: placeholders are just tag */ wp_kses_post(sprintf(__('If your site is already verified in %1$s Google Search Console %2$s, you can leave this field blank.', 'siteseo'), '', '')).'

'.esc_html__('Bing site verification','siteseo').'

'. /* translators: placeholders are just tag */ wp_kses_post(sprintf(__('If your site is already verified in %1$s Bing Webmaster Tools %2$s, you can leave this field blank.', 'siteseo'), '', '')).'

'.esc_html__('Pinterest site verification','siteseo').'
'.esc_html__('Yandex site verification','siteseo').'
'; } static function appearance(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } //$options = $siteseo->advanced_settings; $options = get_option('siteseo_advanced_option_name'); $option_enable_universal_metabox = isset($options['appearance_universal_metabox']) ? $options['appearance_universal_metabox'] : ''; $option_disable_universal_metabox = isset($options['appearance_universal_metabox_disable']) ? $options['appearance_universal_metabox_disable'] : ''; $option_content_analysis_metabox = isset($options['appearance_ca_metaboxe']) ? $options['appearance_ca_metaboxe'] : ''; $option_hide_genesis_metabox = isset($options['appearance_genesis_seo_metaboxe']) ? $options['appearance_genesis_seo_metaboxe'] : ''; $option_structured_type_metabox = isset($options['appearance_advice_schema']) ? $options['appearance_advice_schema'] : ''; $option_admin_bar = isset($options['appearance_adminbar']) ? $options['appearance_adminbar'] : ''; $option_noindex_admin_bar = isset($options['appearance_adminbar_noindex']) ? $options['appearance_adminbar_noindex'] : ''; $option_column_title = isset($options['appearance_title_col']) ? $options['appearance_title_col'] : ''; $option_column_desc = isset($options['appearance_meta_desc_col']) ? $options['appearance_meta_desc_col'] : ''; $option_column_redirect = isset($options['appearance_redirect_enable_col']) ? $options['appearance_redirect_enable_col'] : ''; $option_column_post_type = isset($options['appearance_redirect_url_col']) ? $options['appearance_redirect_url_col'] : ''; $option_column_canonical_post_ty = isset($options['appearance_canonical']) ? $options['appearance_canonical'] : ''; $option_column_target_key = isset($options['appearance_target_kw_col']) ? $options['appearance_target_kw_col'] : ''; $option_column_noindex = isset($options['appearance_noindex_col']) ? $options['appearance_noindex_col'] : ''; $option_column_nofollow = isset($options['appearance_nofollow_col']) ? $options['appearance_nofollow_col'] : ''; $option_column_words_no = isset($options['appearance_words_col']) ? $options['appearance_words_col'] : ''; $option_column_score = isset($options['appearance_score_col']) ? $options['appearance_score_col'] : ''; $option_misc_genesis_metabox = isset($options['appearance_genesis_seo_menu']) ? $options['appearance_genesis_seo_menu'] : ''; $appearance_fields =[ 'metaboxes'=>'Metaboxes', 'Admin-bar'=>'Admin bar', 'Columns' => 'Columns', 'Misc' =>'Misc', ]; echo '
'; $is_first = true; foreach($appearance_fields as $post_key => $post_val){ $active_class = $is_first ? 'active' : ''; echo ''.esc_html($post_val).''; $is_first = false; } echo '

'.esc_html__('Appearance','siteseo').'

'.esc_html__('Customize the plugin to fit your needs','siteseo').'

'.esc_html__('Metaboxes','siteseo').'

'.esc_html__('Edit your SEO metadata directly from your favorite page builder.','siteseo').'

'.esc_html__('Universal Metabox (Gutenberg)','siteseo').'
'.esc_html__('Disable Universal Metabox','siteseo').' '.esc_html__('Disable the universal SEO metabox','siteseo').'
'.esc_html__('Remove Content Analysis Metabox','siteseo').'

'.esc_html__('By checking this option, we will no longer track the significant keywords','siteseo').'

'.esc_html__('Hide Genesis SEO Metabox','siteseo').'
'.esc_html__('Hide advice in Structured Data Types metabox','siteseo').'

'.esc_html__('Admin bar','siteseo').'

'.esc_html__('The admin bar appears on the top of your pages when logged in to your WP admin','siteseo').'

'.esc_html__('SEO in admin bar','siteseo').'
'.esc_html__('Noindex in admin bar','siteseo').'

'.esc_html__('Columns','siteseo').'

'.esc_html__('Customize the SEO columns displayed in the posts/pages list.','siteseo').'

'.esc_html__('Show Title tag column in post types','siteseo').'
'.esc_html__('Show Meta description column in post types','siteseo').'
'.esc_html__('Show Redirection Enable column in post types','siteseo').'
'.esc_html__('Show Redirect URL column in post types','siteseo').'
'.esc_html__('Show canonical URL column in post types','siteseo').'
'.esc_html__('Show Target Keyword column in post types','siteseo').'
'.esc_html__('Show noindex column in post types','siteseo').'
'.esc_html__('Show nofollow column in post types','siteseo').'
'.esc_html__('Show total number of words column in post types','siteseo').'
'.esc_html__('Show content analysis score column in post types','siteseo').'

'.esc_html__('Misc','siteseo').'

'.esc_html__('Miscellaneous settings for the SEO plugin.','siteseo').'

'.esc_html__('Hide Genesis SEO Settings link','siteseo').'
'; } static function security(){ global $siteseo, $wp_roles, $submenu; if(!empty($_POST['submit'])){ self::save_settings(); } $options = get_option('siteseo_advanced_option_name'); $menus_check = $submenu['siteseo']; $security_fields = [ 'siteseo-metaboxes' => 'SiteSEO Metaboxes', 'siteseo-settings-pages' => 'SiteSEO setting pages', ]; wp_nonce_field('siteseo_advance_settings'); echo '
'; $is_first = true; foreach($security_fields as $post_key => $post_val){ $active_class = $is_first ? 'active' : ''; echo '' . esc_html($post_val) . ''; $is_first = false; } echo '

'.esc_html__('Security', 'siteseo').'

'.esc_html__('Control access to SEO settings and metaboxes by user roles.', 'siteseo').'

'.esc_html__('SiteSEO metaboxes', 'siteseo').'

'.esc_html__('Check a user role to prevent it from editing a specific metabox.', 'siteseo').'

'.esc_html__('Block SEO metabox to user roles', 'siteseo').' '; foreach($wp_roles->get_names() as $key => $value){ $checked = isset($options['security_metaboxe_role'][$key]) ? 'checked' : ''; echo '

'; } echo '
'.esc_html__('Block Content analysis metabox to user roles', 'siteseo').' '; foreach($wp_roles->get_names() as $key => $value){ $checked = isset($options['security_metaboxe_ca_role'][$key]) ? 'checked' : ''; echo '

'; } echo '

'.esc_html__('SiteSEO settings pages', 'siteseo').'

'.esc_html__('Check a user role to allow it to edit a specific settings page', 'siteseo').'

'; $settings_pages = [ 'titles' => esc_html__('Titles & Metas', 'siteseo'), 'xml-sitemap' => esc_html__('Sitemaps', 'siteseo'), 'social' => esc_html__('Social Networks', 'siteseo'), 'google-analytics' => esc_html__('Analytics', 'siteseo'), 'instant-indexing' => esc_html__('Instant Indexing', 'siteseo'), 'advanced' => esc_html__('Advanced', 'siteseo'), 'import-export' => esc_html__('Tools', 'siteseo') ]; foreach($settings_pages as $page_key => $page_title){ echo ''; } //Pro if(is_plugin_active('siteseo-pro/siteseo.php')){ echo ''; } echo '
' . esc_html($page_title) . ' '; foreach($wp_roles->get_names() as $role_key => $role_value){ if($role_key === 'administrator'){ continue; } $checked = isset($options['siteseo_advanced_security_metaboxe_siteseo-' . $page_key][$role_key]) ? 'checked' : ''; echo '

'; } echo '
' . esc_html__('Pro Features', 'siteseo') . ' '; foreach($wp_roles->get_names() as $key => $value){ $checked = isset($options['siteseo_advanced_security_page_pro'][$key]) ? 'checked' : ''; echo '

'; } echo '
'; } static function toc(){ global $siteseo; if(!empty($_POST['submit'])){ self::save_settings(); } $options = get_option('siteseo_advanced_option_name'); $option_toc_enable = isset($options['toc_enable']) ? $options['toc_enable'] : ''; $option_toc_label = isset($options['toc_label']) ? $options['toc_label'] : ''; $option_headings = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']; $option_list_types = [ 'ol' => __('Ordered List', 'siteseo'), 'ul' => __('Unordered List', 'siteseo') ]; echo'

'.esc_html__('Table of Contents', 'siteseo').'

'.esc_html__('A table of content works as an index section for your post or page. It helps search engines understand your page structure and users find specific sections quickly, which might help SEO, as it helps search engines better understand the structure of your content and also improves user experience.', 'siteseo').'

'.esc_html__('To use Table of Content on your pages, you can use this shortcode', 'siteseo').' [siteseo_toc]

'.esc_html__('Enable TOC', 'siteseo').'
'.esc_html__('TOC Label', 'siteseo').'
'.esc_html__('Exclude Headings', 'siteseo').'
'; foreach($option_headings as $heading){ $checked = !empty($options) && !empty($options['toc_excluded_headings']) && is_array($options['toc_excluded_headings']) && in_array($heading, $options['toc_excluded_headings']); echo ''; } echo '
'.esc_html__('List Type', 'siteseo').'
'; } static function save_settings(){ global $siteseo; check_admin_referer('siteseo_advance_settings'); if(!current_user_can('siteseo_manage') || !is_admin()){ return; } $options = []; if(!empty($_post['siteseo_options'])){ return; } if(isset($_POST['siteseo_options']['image_seo'])){ $options['advanced_attachments'] = isset($_POST['siteseo_options']['attachment']); $options['advanced_attachments_file'] = isset($_POST['siteseo_options']['attachment_file']); $options['advanced_clean_filename'] = isset($_POST['siteseo_options']['clean_filename']); $options['advanced_image_auto_title_editor'] = isset($_POST['siteseo_options']['auto_img_title']); $options['advanced_image_auto_alt_editor'] = isset($_POST['siteseo_options']['auto_img_alt']); $options['advanced_image_auto_alt_target_kw'] = isset($_POST['siteseo_options']['auto_target_keyword']); $options['advanced_image_auto_caption_editor'] = isset($_POST['siteseo_options']['caption_image']); $options['advanced_image_auto_desc_editor'] = isset($_POST['siteseo_options']['description_img']); } if(isset($_POST['siteseo_options']['advanced_tab'])){ $options['advanced_product_cat_url'] = isset($_POST['siteseo_options']['remove_cate_woocommerce']); $options['advanced_tax_desc_editor'] = isset($_POST['siteseo_options']['taxonomy_desc']); $options['advanced_category_url'] = isset($_POST['siteseo_options']['category_url']); $options['advanced_noreferrer'] = isset($_POST['siteseo_options']['noreferrer_link']); $options['advanced_wp_generator'] = isset($_POST['siteseo_options']['wp_generator_meta']); $options['advanced_hentry'] = isset($_POST['siteseo_options']['hentry_post']); $options['advanced_comments_author_url'] = isset($_POST['siteseo_options']['comments_author_url']); $options['advanced_comments_website'] = isset($_POST['siteseo_options']['website_filed']); $options['advanced_comments_form_link'] = isset($_POST['siteseo_options']['comment_form_link']); $options['advanced_wp_shortlink'] = isset($_POST['siteseo_options']['shortlink']); $options['advanced_wp_rsd'] = isset($_POST['siteseo_options']['rsd_meta']); $options['advanced_wp_wlw'] = isset($_POST['siteseo_options']['wlw_meta']); $options['advanced_google'] = isset($_POST['siteseo_options']['google_meta_value']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['google_meta_value'])) : ''; $options['advanced_bing'] = isset($_POST['siteseo_options']['bing_meta_value']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['bing_meta_value'])) : ''; $options['advanced_pinterest'] = isset($_POST['siteseo_options']['pinterest_meta_value']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['pinterest_meta_value'])) : ''; $options['advanced_yandex'] = isset($_POST['siteseo_options']['yandex_meta_value']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['yandex_meta_value'])) : ''; } if(isset($_POST['siteseo_options']['appearance_tab'])){ $options['appearance_universal_metabox'] = isset($_POST['siteseo_options']['enable_universal_metabox']); $options['appearance_universal_metabox_disable'] = isset($_POST['siteseo_options']['disable_universal_metabox']); $options['appearance_ca_metaboxe'] = isset($_POST['siteseo_options']['remove_content_analysis']); $options['appearance_genesis_seo_metaboxe'] = isset($_POST['siteseo_options']['genesis_metabox']); $options['appearance_advice_schema'] = isset($_POST['siteseo_options']['structured_data_types_metabox']); $options['appearance_adminbar'] = isset($_POST['siteseo_options']['admin_bar']); $options['appearance_adminbar_noindex'] = isset($_POST['siteseo_options']['noindex_admin_bar']); $options['appearance_title_col'] = isset($_POST['siteseo_options']['title_post_types']); $options['appearance_meta_desc_col'] = isset($_POST['siteseo_options']['desc_post_types']); $options['appearance_redirect_enable_col'] = isset($_POST['siteseo_options']['redirect_post_types']); $options['appearance_redirect_url_col'] = isset($_POST['siteseo_options']['redirect_url_post_types']); $options['appearance_canonical'] = isset($_POST['siteseo_options']['url_column_post_types']); $options['appearance_target_kw_col'] = isset($_POST['siteseo_options']['keyword_column_post_types']); $options['appearance_noindex_col'] = isset($_POST['siteseo_options']['noindex_column_post_types']); $options['appearance_nofollow_col'] = isset($_POST['siteseo_options']['nofollow_column_post_types']); $options['appearance_words_col'] = isset($_POST['siteseo_options']['words_column_post_types']); $options['appearance_score_col'] = isset($_POST['siteseo_options']['score_column_post_types']); $options['appearance_genesis_seo_menu'] = isset($_POST['siteseo_options']['genesis_seo_settings']); } if(isset($_POST['siteseo_options']['toc_tab'])){ $options['toc_enable'] = isset($_POST['siteseo_options']['toc_enable']); $options['toc_label'] = isset($_POST['siteseo_options']['toc_label']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['toc_label'])) : ''; $options['toc_heading_type'] = isset($_POST['siteseo_options']['toc_heading_type']) ? sanitize_text_field(wp_unslash($_POST['siteseo_options']['toc_heading_type'])) : ''; //toc_excluded_headings if(isset($_POST['siteseo_options']['toc_excluded_headings'])){ $options['toc_excluded_headings'] = map_deep(wp_unslash($_POST['siteseo_options']['toc_excluded_headings']), 'sanitize_text_field'); } } if(isset($_POST['siteseo_options']['security_tab'])){ $security_sections = [ 'security_metaboxe_role' => ['administrator', 'editor','author', 'contributor', 'subscriber' ], 'security_metaboxe_ca_role' => ['administrator', 'editor', 'author', 'contributor', 'subscriber'], 'siteseo_advanced_security_metaboxe_siteseo-titles' => ['editor', 'author', 'contributor', 'subscriber'], 'siteseo_advanced_security_metaboxe_siteseo-xml-sitemap' => ['editor', 'author', 'contributor', 'subscriber'], 'siteseo_advanced_security_metaboxe_siteseo-social' => ['editor', 'author', 'contributor', 'subscriber'], 'siteseo_advanced_security_metaboxe_siteseo-google-analytics' => ['editor', 'author', 'contributor', 'subscriber'], 'siteseo_advanced_security_metaboxe_siteseo-instant-indexing' => ['editor', 'author', 'contributor', 'subscriber'], 'siteseo_advanced_security_metaboxe_siteseo-advanced' => ['editor', 'author', 'contributor', 'subscriber'], 'siteseo_advanced_security_metaboxe_siteseo-import-export' => ['editor', 'author', 'contributor', 'subscriber'] ]; $advanced_options = map_deep($_POST['siteseo_options'], function($value){ if(!empty($value)){ if(is_string($value)){ return true; } return sanitize_text_field(wp_unslash($value)); } return ''; }); $filtered_options = []; foreach($security_sections as $section => $roles){ if(isset($advanced_options[$section])){ $filtered_options[$section] = array_intersect_key( $advanced_options[$section], array_flip($roles) ); } } $options = array_merge($options, $filtered_options); } update_option('siteseo_advanced_option_name', $options); } }