array( 'label' => esc_html__( 'Settings', 'google-sitemap-plugin' ) ), 'display' => array( 'label' => esc_html__( 'Structure', 'google-sitemap-plugin' ) ), 'misc' => array( 'label' => esc_html__( 'Misc', 'google-sitemap-plugin' ) ), /*pls */ 'license' => array( 'label' => esc_html__( 'License Key', 'google-sitemap-plugin' ) ) /* pls*/ ); parent::__construct( array( 'plugin_basename' => $plugin_basename, 'plugins_info' => $gglstmp_plugin_info, 'prefix' => 'gglstmp', 'default_options' => gglstmp_get_options_default(), 'options' => $gglstmp_options, 'tabs' => $tabs, /*pls */ 'wp_slug' => 'google-sitemap-plugin', 'link_key' => '28d4cf0b4ab6f56e703f46f60d34d039', 'link_pn' => '83', /* pls*/ 'doc_link' => 'https://docs.google.com/document/d/1ffd0jasAtIEWXiW6Dg81QqmqHODj8j6vqzu2CQFyaT4/', 'doc_video_link' => 'https://www.youtube.com/watch?v=hzz0_Yj4gaQ' ) ); add_action( get_parent_class( $this ) . '_additional_misc_options', array( $this, 'additional_misc_options' ) ); $this->robots = get_option( 'gglstmp_robots' ); /* Check htaccess plugin */ if ( $this->is_multisite && ! is_subdomain_install() ) { $all_plugins = get_plugins(); $this->htaccess = gglstmp_plugin_status( array( 'htaccess/htaccess.php', 'htaccess-pro/htaccess-pro.php' ), $all_plugins, false ); $this->htaccess_options = false; if ( 'actived' == $this->htaccess['status'] ) { global $htccss_options; register_htccss_settings(); $this->htaccess_options = &$htccss_options; $this->htaccess_active = true; if ( function_exists( 'htccss_check_xml_access' ) ) { $htaccess_check = htccss_check_xml_access(); if ( $htaccess_check != $this->htaccess_options['allow_xml'] ) { $this->htaccess_options['allow_xml'] = $htaccess_check; update_site_option( 'htccss_options', $this->htaccess_options ); } } } } if ( function_exists( 'curl_init' ) ) { $this->client = gglstmp_client(); $this->blog_prefix = '_' . get_current_blog_id(); if ( ! isset( $_SESSION[ 'gglstmp_authorization_code' . $this->blog_prefix ] ) && isset( $this->options['authorization_code'] ) ) { $_SESSION[ 'gglstmp_authorization_code' . $this->blog_prefix ] = $this->options['authorization_code']; } if ( isset( $_SESSION[ 'gglstmp_authorization_code' . $this->blog_prefix ] ) ) { $this->client->setAccessToken( $_SESSION[ 'gglstmp_authorization_code' . $this->blog_prefix ] ); } } $this->all_post_types = get_post_types( array( 'public' => true ), 'objects' ); unset( $this->all_post_types['attachment'] ); $this->all_taxonomies = array( 'category' => esc_html__( 'Post category', 'google-sitemap-plugin' ), 'post_tag' => esc_html__( 'Post tag', 'google-sitemap-plugin' ) ); add_filter( get_parent_class( $this ) . '_additional_restore_options', array( $this, 'additional_restore_options' ) ); add_filter( get_parent_class( $this ) . '_display_custom_messages', array( $this, 'display_custom_messages' ) ); add_filter( get_parent_class( $this ) . '_information_postbox_top', array( $this, 'information_postbox_top' ) ); } /** * Save plugin options to the database * @access public * * @param void * * @return array The action results */ public function save_options() { global $wpdb; $message = $notice = $error = ''; $sitemapcreate = $reschedule = false; if ( isset( $_POST['gglstmp_logout'] ) ) { unset( $_SESSION[ 'gglstmp_authorization_code' . $this->blog_prefix ], $this->options['authorization_code'] ); update_option( 'gglstmp_options', $this->options ); } elseif ( isset( $_POST['gglstmp_authorize'] ) && ! empty( $_POST['gglstmp_authorization_code'] ) ) { try { $this->client->authenticate( $_POST['gglstmp_authorization_code'] ); $this->options['authorization_code'] = $_SESSION[ 'gglstmp_authorization_code' . $this->blog_prefix ] = $this->client->getAccessToken(); update_option( 'gglstmp_options', $this->options ); } catch ( Exception $e ) { } } elseif ( isset( $_POST['gglstmp_menu_add'] ) || isset( $_POST['gglstmp_menu_delete'] ) || isset( $_POST['gglstmp_menu_info'] ) ) { if ( $this->client->getAccessToken() ) { $webmasters = new Google_Service_Webmasters( $this->client ); $site_verification = new Google_Service_SiteVerification( $this->client ); if ( isset( $_POST['gglstmp_menu_info'] ) ) { $this->manage_info .= gglstmp_get_site_info( $webmasters, $site_verification ); } elseif ( isset( $_POST['gglstmp_menu_add'] ) ) { $this->manage_info .= gglstmp_add_site( $webmasters, $site_verification ); } else { $this->manage_info .= gglstmp_delete_site( $webmasters, $site_verification ); } } } else { if ( $this->htaccess_active && $this->htaccess_options && function_exists( 'htccss_generate_htaccess' ) ) { $gglstmp_allow_xml = ( ! empty( $_POST['gglstmp_allow_xml'] ) ) ? 1 : 0; if ( $gglstmp_allow_xml != $this->htaccess_options['allow_xml'] ) { $this->htaccess_options['allow_xml'] = $gglstmp_allow_xml; update_site_option( 'htccss_options', $this->htaccess_options ); htccss_generate_htaccess(); } } $filter_param = apply_filters( 'gglstmp_save_frequency_options', $this->options, $sitemapcreate ); if ( ! empty( $filter_param['frequency_options'] ) && ! empty( $filter_param['sitemapcreate'] ) ) { $this->options = array_merge( $this->options, $filter_param['frequency_options'] ); $sitemapcreate = $filter_param['sitemapcreate']; } $post_types = $taxonomies = array(); if ( ! empty( $_POST['gglstmp_post_types'] ) ) { foreach ( (array)$_POST['gglstmp_post_types'] as $type ) { if ( array_key_exists( sanitize_text_field( $type ), $this->all_post_types ) ) $post_types[] = $type; } } if ( ! empty( $_POST['gglstmp_taxonomies'] ) ) { foreach ( (array)$_POST['gglstmp_taxonomies'] as $tax ) { if ( array_key_exists( sanitize_text_field( $tax ), $this->all_taxonomies ) ) $taxonomies[] = $tax; } } if ( $this->options['post_type'] != $post_types || $this->options['taxonomy'] != $taxonomies ) { $sitemapcreate = true; } $this->options['post_type'] = $post_types; $this->options['taxonomy'] = $taxonomies; if ( isset( $_POST['gglstmp_limit'] ) ) { if ( $this->options['limit'] != absint( $_POST['gglstmp_limit'] ) ) { $sitemapcreate = true; } $this->options['limit'] = ( absint( $_POST['gglstmp_limit'] ) >= 1000 && absint( $_POST['gglstmp_limit'] ) <= 50000 ) ? absint( $_POST['gglstmp_limit'] ) : 50000; } if ( ( empty( $this->options['alternate_language'] ) && isset( $_POST['gglstmp_alternate_language'] ) ) || ( ! empty( $this->options['alternate_language'] ) && ! isset( $_POST['gglstmp_alternate_language'] ) ) ) { $sitemapcreate = true; } $media_sitemap = isset( $_POST['gglstmp_media_sitemap'] ) ? 1 : 0; if ( is_plugin_active( 'wordpress-seo/wp-seo.php' ) || is_plugin_active( 'wordpress-seo-pro/wp-seo-pro.php' ) ) { if ( isset( $_POST['disable_yoast_xml_sitemap'] ) ) { WPSEO_Options::set( 'enable_xml_sitemap', false ); } else { WPSEO_Options::set( 'enable_xml_sitemap', true ); } } if ( $this->options['media_sitemap'] != $media_sitemap ) $sitemapcreate = true; $this->options['media_sitemap'] = $media_sitemap; $this->robots = isset( $_POST['gglstmp_checkbox'] ) ? 1 : 0; $this->options['alternate_language'] = isset( $_POST['gglstmp_alternate_language'] ) ? 1 : 0; update_option( 'gglstmp_robots', $this->robots ); update_option( 'gglstmp_options', $this->options ); if ( $sitemapcreate ) { gglstmp_schedule_sitemap( false, false, true); } $message = esc_html__( 'Settings saved.', 'google-sitemap-plugin' ); } return compact( 'message', 'notice', 'error' ); } /** * */ public function tab_settings() { ?>

help_phrase(); global $wp_version; if ( ! $this->all_plugins ) { if ( ! function_exists( 'get_plugins' ) ) { require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); } $this->all_plugins = get_plugins(); } ?>
is_multisite && ! is_subdomain_install() ) { $attr_checked = $attr_disabled = ''; $htaccess_plugin_notice = esc_html__( 'This option will be applied to all websites in the network.', 'google-sitemap-plugin' ); if ( 'deactivated' == $this->htaccess['status'] ) { $attr_disabled = 'disabled="disabled"'; $htaccess_plugin_notice = '' . esc_html__( 'Activate', 'google-sitemap-plugin' ) . ''; } elseif ( 'not_installed' == $this->htaccess['status'] ) { $attr_disabled = 'disabled="disabled"'; $htaccess_plugin_notice = '' . esc_html__( 'Install Now', 'google-sitemap-plugin' ) . ''; } if ( ! empty( $this->htaccess_options['allow_xml'] ) && empty( $attr_disabled ) ) { $attr_checked = 'checked="checked"'; } ?> options ); ?>
/>
Robots.txt robots, 1 ); ?> /> robots.txt' ); ?>
options['media_sitemap'], 1 ); ?>/>
type="checkbox" name="gglstmp_allow_xml" value="1"/> RewriteRule ([^/]+\.xml)$ $1 [L]' ); ?>
hide_pro_tabs ) { ?>
bws_pro_block_links(); ?>
 
client ) { esc_html_e( "This hosting does not support сURL, so you cannot add a sitemap file automatically.", 'google-sitemap-plugin' ); ?> client->getAccessToken() ) { ?>
manage_info; } else { $gglstmp_state = mt_rand(); $this->client->setState( $gglstmp_state ); $_SESSION[ 'gglstmp_state' . $this->blog_prefix ] = $this->client; $gglstmp_auth_url = $this->client->createAuthUrl(); ?>
 
all_plugins ) || array_key_exists( 'multilanguage-pro/multilanguage-pro.php', $this->all_plugins ) ) { if ( ! is_plugin_active( 'multilanguage/multilanguage.php' ) && ! is_plugin_active( 'multilanguage-pro/multilanguage-pro.php' ) ) { $disabled = ' disabled="disabled"'; $link = '' . esc_html__( 'Activate', 'google-sitemap-plugin' ) . ''; } } else { $disabled = ' disabled="disabled"'; $link = '' . esc_html__( 'Install Now', 'google-sitemap-plugin' ) . ''; } ?> options['alternate_language'] ) ?> />

help_phrase(); ?>
all_post_types as $post_type => $post_type_object ) { ?>
all_taxonomies as $key => $value ) { ?>
hide_pro_tabs ) { ?>
bws_pro_block_links(); ?>
options ); } /** * Custom functions for "Restore plugin options to defaults" * @access public */ public function additional_restore_options( $default_options ) { if ( $this->is_multisite ) { $blog_id = get_current_blog_id(); $mask = "sitemap_{$blog_id}*.xml"; } else { $mask = "sitemap*.xml"; } /* remove all sitemap files */ array_map( "unlink", glob( ABSPATH . $mask ) ); /* clear robots.txt */ $this->robots = 0; update_option( 'gglstmp_robots', $this->robots ); $this->client->revokeToken(); unset( $_SESSION[ 'gglstmp_authorization_code' . $this->blog_prefix ], $this->options['authorization_code'] ); return $default_options; } /** * Custom content for metabox * @access public */ public function information_postbox_top() { if ( $this->is_multisite ) { $blog_id = get_current_blog_id(); $xml_file = 'sitemap_' . $blog_id . '.xml'; } else { $xml_file = 'sitemap.xml'; } $xml_url = home_url( '/' . $xml_file ); if ( isset( $xml_file ) && file_exists( ABSPATH . $xml_file ) ) { printf( '
%s
', sprintf( esc_html__( "Sitemap File: %s", 'google-sitemap-plugin' ), '' . $xml_file . '' ) ); if ( ! $this->is_multisite ) { $status = gglstmp_check_sitemap( home_url( "/sitemap.xml" ) ); } else { $status = gglstmp_check_sitemap( home_url( "/sitemap_{$blog_id}.xml" ) ); } if ( ! is_wp_error( $status ) && '200' != $status['code'] ) { if ( $this->is_multisite ) { $home_url = network_home_url(); $site_url = network_site_url(); } else { $home_url = home_url(); $site_url = site_url(); } $home_dir = str_replace( $home_url, '', $site_url ); if ( '' != $home_dir ) { $home_dir .= '/'; } $replace = $home_dir . '$1'; ?>

: RewriteRule ([^/]+\.xml)$ ' . $replace . ' [L]', '.htaccess', '"RewriteBase /"' ); ?>

%s', admin_url('/options-reading.php#blog_public'), _x('Reading Settings page', '...on the reading settings page.', 'google-sitemap-plugin') ) ); if (file_exists(ABSPATH . 'robots.txt')) { $tooltip_text .= "
" . esc_html__('Also, please add the following code to the beginning of your ".htaccess" file:', 'google-sitemap-plugin') . "
" . "
" .
                    "<IfModule mod_rewrite.c>
" . "RewriteEngine On
" . "RewriteBase /
" . "RewriteRule robots\.txt$ index.php?gglstmp_robots=1
" . "</IfModule>" . "
"; } if ( 1 == $this->robots && '1' != get_option( 'blog_public' ) ) { printf('

%s

', $tooltip_text); } return false; } } }