first commit

This commit is contained in:
2024-11-10 21:08:49 +01:00
commit 0d932ce5ee
14455 changed files with 2567501 additions and 0 deletions

View File

@@ -0,0 +1,574 @@
<?php
/**
* Displays the content on the plugin settings page
*/
if ( ! class_exists( 'Gglstmp_Settings_Tabs' ) ) {
class Gglstmp_Settings_Tabs extends Bws_Settings_Tabs {
public $htaccess_options = false,
$htaccess_active = false,
$robots, $htaccess, $client, $blog_prefix,
$manage_info = '',
$all_post_types, $all_taxonomies;
/**
* Constructor.
*
* @access public
*
* @see Bws_Settings_Tabs::__construct() for more information on default arguments.
*
* @param string $plugin_basename
*/
public function __construct( $plugin_basename ) {
global $gglstmp_options, $gglstmp_plugin_info;
$tabs = array(
'settings' => 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() { ?>
<h3 class="bws_tab_label"><?php esc_html_e( 'Sitemap Settings', 'google-sitemap-plugin' ); ?></h3>
<?php $this->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();
} ?>
<hr>
<table class="form-table gglstmp_settings_form">
<?php if ( is_plugin_active( 'wordpress-seo/wp-seo.php' ) || is_plugin_active( 'wordpress-seo-pro/wp-seo-pro.php' ) ) { ?>
<tr>
<th><?php _e( 'Yoast Sitemap', 'google-sitemap-plugin' ); ?></th>
<td>
<input type='checkbox' name="disable_yoast_xml_sitemap" value="1" <?php checked( WPSEO_Options::get( 'enable_xml_sitemap'), false ); ?>/>
<span class="bws_info"><?php _e( 'Enable to activate the sitemap (Yoast sitemap will be deactivated).', 'google-sitemap-plugin' ); ?></span>
</td>
</tr>
<?php } ?>
<tr>
<th>Robots.txt</th>
<td>
<input type='checkbox' name="gglstmp_checkbox" value="1" <?php checked( $this->robots, 1 ); ?> />
<span class="bws_info">
<?php printf(
_x( "Enable to add a sitemap file path to the %s file.", '%robots.txt file link%', 'google-sitemap-plugin' ),
'<a href="' . home_url( '/robots.txt' ) . '" target="_blank">robots.txt</a>'
); ?>
</span>
</td>
</tr>
<tr>
<th><?php esc_html_e( 'Media Sitemap', 'google-sitemap-plugin' ); ?></th>
<td>
<input type='checkbox' name="gglstmp_media_sitemap" value="1" <?php checked( $this->options['media_sitemap'], 1 ); ?>/>
<span class="bws_info"><?php esc_html_e( 'Enable to create separate sitemap files for images and videos.', 'google-sitemap-plugin' ); ?></span>
</td>
</tr>
<?php if ( $this->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 = '<a href="' . network_admin_url( '/plugins.php' ) . '">' . esc_html__( 'Activate', 'google-sitemap-plugin' ) . '</a>';
} elseif ( 'not_installed' == $this->htaccess['status'] ) {
$attr_disabled = 'disabled="disabled"';
$htaccess_plugin_notice = '<a href="https://bestwebsoft.com/products/wordpress/plugins/htaccess/?k=bc745b0c9d4b19ba95ae2c861418e0df&pn=106&v=' . $this->plugins_info["Version"] . '&wp_v=' . $wp_version . '">' . esc_html__( 'Install Now', 'google-sitemap-plugin' ) . '</a>';
}
if ( ! empty( $this->htaccess_options['allow_xml'] ) && empty( $attr_disabled ) ) {
$attr_checked = 'checked="checked"';
} ?>
<tr id="gglstmp_allow_xml_block">
<th><?php printf( esc_html__( '%s Plugin', 'google-sitemap-plugin' ), 'Htaccess' ); ?></th>
<td>
<input <?php printf( "%s %s", $attr_checked, $attr_disabled ); ?> type="checkbox"
name="gglstmp_allow_xml"
value="1"/> <span
class="bws_info"><?php printf( esc_html__( 'Enable to allow XML files access using %s plugin.', 'google-sitemap-plugin' ), 'Htaccess' ); ?><?php echo $htaccess_plugin_notice; ?></span>
<?php echo bws_add_help_box( esc_html__( 'The following string will be added to your .htaccess file', 'google-sitemap-plugin' ) . ': <code>RewriteRule ([^/]+\.xml)$ $1 [L]</code>' ); ?>
</td>
</tr>
<?php }
do_action( 'gglstmp_display_settings_frequency', $this->options ); ?>
<!-- pls -->
</table>
<?php if ( ! $this->hide_pro_tabs ) { ?>
<div class="bws_pro_version_bloc">
<div class="bws_pro_version_table_bloc">
<button type="submit" name="bws_hide_premium_options"
class="notice-dismiss bws_hide_premium_options"
title="<?php esc_html_e( 'Close', 'google-sitemap-plugin' ); ?>"></button>
<div class="bws_table_bg"></div>
<table class="form-table bws_pro_version">
<?php gglstmp_frequency_block(); ?>
</table>
</div>
<?php $this->bws_pro_block_links(); ?>
</div>
<?php } ?>
<table class="form-table gglstmp_settings_form">
<!-- end pls -->
<tr>
<th><?php esc_html_e( 'URLs Limit', 'google-sitemap-plugin' ); ?></th>
<td>
<input type="number" name="gglstmp_limit" min="1000" max="50000"
value="<?php echo absint( $this->options['limit'] ); ?>"/>
<div class="bws_info">
<?php esc_html_e( "A sitemap file can't contain more than 50,000 URLs and must be no larger than 50 MB uncompressed.", 'google-sitemap-plugin' ); ?>
&nbsp;<a
href="https://support.google.com/webmasters/answer/183668?ref_topic=4581190#general-guidelines"
target="_blank"><?php esc_html_e( 'Learn More', 'google-sitemap-plugin' ); ?></a><br/>
<?php esc_html_e( 'Decrease the limit if your sitemap exceeds file size limit.', 'google-sitemap-plugin' ); ?>
<?php esc_html_e( 'When the limit is reached, the sitemap will be splitted into multiple files.', 'google-sitemap-plugin' ); ?>
</div>
</td>
</tr>
<tr>
<th><?php esc_html_e( 'Google Search Console', 'google-sitemap-plugin' ); ?></th>
<td>
<?php if ( ! $this->client ) {
esc_html_e( "This hosting does not support сURL, so you cannot add a sitemap file automatically.", 'google-sitemap-plugin' ); ?>
<?php } else { ?>
<?php if ( ! isset( $_POST['gglstmp_logout'] ) && $this->client->getAccessToken() ) { ?>
<input class="button-secondary bws_no_bind_notice" name="gglstmp_logout" type="submit"
value="<?php esc_html_e( 'Logout', 'google-sitemap-plugin' ); ?>"/>
</td>
</tr>
<tr>
<th><?php esc_html_e( 'Manage Website with Google Search Console', 'google-sitemap-plugin' ); ?></th>
<td>
<input class="button-secondary bws_no_bind_notice" type='submit' name='gglstmp_menu_add'
value="<?php esc_html_e( 'Add', 'google-sitemap-plugin' ); ?>"/>
<input class="button-secondary bws_no_bind_notice" type='submit' name='gglstmp_menu_delete'
value="<?php esc_html_e( 'Delete', 'google-sitemap-plugin' ); ?>"/>
<input class="button-secondary bws_no_bind_notice" type='submit' name='gglstmp_menu_info'
value="<?php esc_html_e( 'Get Info', 'google-sitemap-plugin' ); ?>"/>
<div class="bws_info">
<?php esc_html_e( "Add, delete or get info about this website using your Google Search Console account.", 'google-sitemap-plugin' ); ?>
</div>
<?php echo $this->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(); ?>
<a id="gglstmp_authorization_button" class="button-secondary button"
href="<?php echo esc_url( $gglstmp_auth_url ); ?>" target="_blank"
onclick="window.open(this.href,'','top='+(screen.height/2-560/2)+',left='+(screen.width/2-240/2)+',width=640,height=560,resizable=0,scrollbars=0,menubar=0,toolbar=0,status=1,location=0').focus(); return false;"><?php esc_html_e( 'Open the Google Search Console', 'google-sitemap-plugin' ); ?></a>
<div id="gglstmp_authorization_form">
<input id="gglstmp_authorization_code" class="bws_no_bind_notice"
name="gglstmp_authorization_code" type="text" maxlength="100"
autocomplete="off"/>
<input id="gglstmp_authorize" class="button-secondary button bws_no_bind_notice"
name="gglstmp_authorize" type="submit"
value="<?php esc_html_e( 'Authorize', 'google-sitemap-plugin' ); ?>"/>
</div>
<?php if ( isset( $_POST['gglstmp_authorization_code'] ) && isset( $_POST['gglstmp_authorize'] ) ) { ?>
<div id="gglstmp_authorize_error"><?php esc_html_e( 'Invalid authorization code. Please try again.', 'google-sitemap-plugin' ); ?></div>
<?php }
}
} ?>
<div class="bws_info">
<?php esc_html_e( 'You can also add your sitemap to Google Search Console manually.', 'google-sitemap-plugin' ); ?>
&nbsp;<a target="_blank"
href="https://docs.google.com/document/d/1ffd0jasAtIEWXiW6Dg81QqmqHODj8j6vqzu2CQFyaT4"><?php esc_html_e( 'Read the instruction', 'google-sitemap-plugin' ); ?></a>
</div>
</td>
</tr>
<tr>
<th><?php esc_html_e( 'Alternate Language Pages', 'google-sitemap-plugin' ); ?></th>
<td>
<?php $disabled = $link = '';
if ( array_key_exists( 'multilanguage/multilanguage.php', $this->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 = '<a href="' . admin_url( 'plugins.php' ) . '">' . esc_html__( 'Activate', 'google-sitemap-plugin' ) . '</a>';
}
} else {
$disabled = ' disabled="disabled"';
$link = '<a href="https://bestwebsoft.com/products/wordpress/plugins/multilanguage/?k=84702fda886c65861801c52644d1ee11&amp;pn=83&amp;v=' . $this->plugins_info["Version"] . '&amp;wp_v=' . $wp_version . '" target="_blank">' . esc_html__( 'Install Now', 'google-sitemap-plugin' ) . '</a>';
} ?>
<input type="checkbox" name="gglstmp_alternate_language" value="1" <?php echo esc_attr( $disabled );
checked( $this->options['alternate_language'] ) ?> />
<span class="bws_info"> <?php esc_html_e( "Enable to add alternate language pages using Multilanguage plugin.", 'google-sitemap-plugin' ); ?> <?php echo $link; ?></span>
</td>
</tr>
</table>
<?php }
/**
*
*/
public function tab_display() { ?>
<h3 class="bws_tab_label"><?php esc_html_e( 'Sitemap Structure', 'google-sitemap-plugin' ); ?></h3>
<?php $this->help_phrase(); ?>
<hr>
<table class="form-table gglstmp_settings_form">
<tr>
<th><?php esc_html_e( 'Post Types', 'google-sitemap-plugin' ); ?></th>
<td>
<fieldset>
<?php foreach ( $this->all_post_types as $post_type => $post_type_object ) { ?>
<label>
<input type="checkbox" <?php if ( in_array( $post_type, $this->options['post_type'] ) ) echo 'checked="checked"'; ?> name="gglstmp_post_types[]" value="<?php echo esc_attr( $post_type ); ?>"/>
<span style="text-transform: capitalize; padding-left: 5px;"><?php echo esc_attr( $post_type_object->labels->name ); ?></span>
</label>
<br/>
<?php } ?>
</fieldset>
<span class="bws_info"><?php esc_html_e( 'Enable to add post type links to the sitemap.', 'google-sitemap-plugin' ); ?></span>
</td>
</tr>
<tr>
<th><?php esc_html_e( 'Taxonomies', 'google-sitemap-plugin' ); ?></th>
<td>
<fieldset>
<?php foreach ( $this->all_taxonomies as $key => $value ) { ?>
<label><input
type="checkbox" <?php if ( in_array( $key, $this->options['taxonomy'] ) ) {
echo 'checked="checked"';
} ?> name="gglstmp_taxonomies[]" value="<?php echo esc_attr( $key ); ?>"/><span
style="padding-left: 5px;"><?php echo esc_attr( $value ); ?></span></label><br/>
<?php } ?>
</fieldset>
<span class="bws_info"><?php esc_html_e( 'Enable to taxonomy links to the sitemap.', 'google-sitemap-plugin' ); ?></span>
</td>
</tr>
</table>
<!-- pls -->
<?php if ( ! $this->hide_pro_tabs ) { ?>
<div class="bws_pro_version_bloc">
<div class="bws_pro_version_table_bloc">
<button type="submit" name="bws_hide_premium_options"
class="notice-dismiss bws_hide_premium_options"
title="<?php esc_html_e( 'Close', 'google-sitemap-plugin' ); ?>"></button>
<div class="bws_table_bg"></div>
<?php gglstmp_extra_block(); ?>
</div>
<?php $this->bws_pro_block_links(); ?>
</div>
<?php } ?>
<!-- end pls -->
<?php }
/**
* Display custom options on the 'misc' tab
* @access public
*/
public function additional_misc_options() {
do_action( 'gglstmp_settings_page_misc_action', $this->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(
'<div class="misc-pub-section"><strong>%s</strong></div>',
sprintf(
esc_html__( "Sitemap File: %s", 'google-sitemap-plugin' ),
'<a href="' . $xml_url . '" target="_blank">' . $xml_file . '</a>'
)
);
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'; ?>
<div class="error below-h2">
<p>
<strong><?php esc_html_e( 'Error', 'google-sitemap-plugin' ); ?>:</strong> <?php
printf( esc_html__( "Can't access XML files. Try to add the following rule %s to your %s file which is located in the root of your website to resolve this error. Find the following line %s and paste the code just after it.", 'google-sitemap-plugin' ),
'<code>RewriteRule ([^/]+\.xml)$ ' . $replace . ' [L]</code>',
'<strong>.htaccess</strong>',
'<strong>"RewriteBase /"</strong>'
); ?>
</p>
</div>
<?php }
} else {
gglstmp_schedule_sitemap();
}
if ( class_exists( 'Google_Client' ) && version_compare( Google_Client::LIBVER, '1.1.3', '!=' ) ) {
/* Google Client library of some other product is used! */ ?>
<div class="updated bws-notice inline">
<p><strong><?php esc_html_e( 'Note', 'google-sitemap-plugin' ); ?>
:&nbsp;</strong><?php esc_html_e( 'Another plugin is providing Google Client functionality and may interrupt proper plugin work.', 'google-sitemap-plugin' ); ?>
</p>
</div>
<?php }
}
public function display_custom_messages() {
$tooltip_text = sprintf(
_x('The “Robots.txt” option is enabled. You should disable the “Search Engine Visibility" option on the %s.', '%reading settings page link%', 'google-sitemap-plugin'),
sprintf(
'<a href="%s" target="_blank">%s</a>',
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 .= "<br />" . esc_html__('Also, please add the following code to the beginning of your ".htaccess" file:', 'google-sitemap-plugin') . "<br />" .
"<pre><code>" .
"&lt;IfModule mod_rewrite.c&gt;<br />" .
"RewriteEngine On<br />" .
"RewriteBase /<br />" .
"RewriteRule robots\.txt$ index.php?gglstmp_robots=1<br />" .
"&lt;/IfModule&gt;" .
"</code></pre>";
}
if ( 1 == $this->robots && '1' != get_option( 'blog_public' ) ) {
printf('<div class="updated bws-notice inline"><p><strong>%s</strong></p></div>', $tooltip_text);
}
return false;
}
}
}

View File

@@ -0,0 +1,207 @@
<?php
/**
* Banners on plugin settings page
* @package Sitemap by BestWebSoft
* @since 3.0.3
*/
/**
* Wrapper. Show ads for PRO on plugin settings page
* @param string $func function to call
* @param boolean $show_cross when it is 'false' ad will be displayed regardless of if other blocks are closed
* @return void
*/
if ( ! function_exists( 'gglstmp_pro_block' ) ) {
function gglstmp_pro_block( $func, $show_cross = true ) {
global $gglstmp_plugin_info, $wp_version, $gglstmp_options;
if ( ! bws_hide_premium_options_check( $gglstmp_options ) ) : ?>
<div class="bws_pro_version_bloc gglstmp_pro_block <?php echo $func;?>" title="<?php esc_html_e( 'This option is available in Pro version of plugin', 'google-sitemap-plugin' ); ?>">
<div class="bws_pro_version_table_bloc">
<?php if ( $show_cross ) { ?>
<button type="submit" name="bws_hide_premium_options" class="notice-dismiss bws_hide_premium_options" title="<?php esc_html_e( 'Close', 'google-sitemap-plugin' ); ?>"></button>
<?php } ?>
<div class="bws_table_bg"></div>
<?php call_user_func( $func ); ?>
</div>
<div class="bws_pro_version_tooltip">
<a class="bws_button" href="https://bestwebsoft.com/products/wordpress/plugins/google-sitemap/?k=28d4cf0b4ab6f56e703f46f60d34d039&pn=83&v=<?php echo $gglstmp_plugin_info["Version"]; ?>&wp_v=<?php echo $wp_version; ?>" target="_blank" title="Sitemap Pro"><?php esc_html_e( 'Upgrade to Pro', 'google-sitemap-plugin' ); ?></a>
</div>
</div>
<?php else : ?>
<p>
<?php esc_html_e( 'This tab contains Pro options only.', 'google-sitemap-plugin' );
echo ' ' . sprintf(
esc_html__( '%sChange the settings%s to view the Pro options.', 'google-sitemap-plugin' ),
'<a href="admin.php?page=google-sitemap-plugin.php&bws_active_tab=misc">',
'</a>'
); ?>
</p>
<?php endif;
}
}
/**
* The content of ad block on the "Settings" tab
* @param void
* @return void
*/
if ( ! function_exists( 'gglstmp_frequency_block' ) ) {
function gglstmp_frequency_block() { ?>
<tr>
<th><?php _e( 'Title and Meta Description', 'google-sitemap-plugin' ); ?></th>
<td>
<input type='checkbox' disabled="disabled" />
<span class="bws_info"><?php _e( 'Enable to change title and meta description.', 'google-sitemap-plugin' ); ?></span>
</td>
</tr>
<tr valign="top">
<th><?php esc_html_e( 'Change Frequency', 'google-sitemap-plugin' ); ?></th>
<td>
<select disabled="disabled">
<option><?php esc_html_e( 'Monthly', 'google-sitemap-plugin' ); ?></option>
</select>
<div class="bws_info"><?php esc_html_e( 'This value provides general information to search engines and tell them how frequently the page is likely to change. It may not correlate exactly to how often they crawl the website.', 'google-sitemap-plugin' ); ?>&nbsp;<a href="http://www.sitemaps.org/protocol.html#changefreqdef" target="_blank"><?php esc_html_e( 'Learn More', 'google-sitemap-plugin' ); ?></a></div>
</td>
</tr>
<tr>
<th><?php esc_html_e( 'External Sitemap Update Frequency', 'google-sitemap-plugin' ); ?></th>
<td>
<input disabled="disabled" class="small-text" type="number" value="7">&ensp;<?php esc_html_e( 'day(-s)', 'google-sitemap-plugin' ); ?>
<div class="bws_info">
<?php esc_html_e( 'This option sets how often the external index sitemap files should be checked for updates.', 'google-sitemap-plugin' ); ?>
</div>
</td>
</tr>
<?php }
}
/**
* The content of ad block on the "Extra settings" tab
* @param void
* @return void
*/
if ( ! function_exists( 'gglstmp_extra_block' ) ) {
function gglstmp_extra_block() { ?>
<img style="max-width: 100%;" src="<?php echo plugins_url( 'images/pro_screen_1.png', dirname( __FILE__ ) ); ?>" alt="<?php esc_html_e( "Example of site pages' tree", 'google-sitemap-plugin' ); ?>" title="<?php esc_html_e( "Example of site pages' tree", 'google-sitemap-plugin' ); ?>" />
<?php }
}
/**
* The content of ad block on the "Custom links" tab
* @param void
* @return void
*/
if ( ! function_exists( 'gglstmp_custom_links_block' ) ) {
function gglstmp_custom_links_block() {
$date = date_i18n( get_option( 'date_format' ), 1458086400 ); ?>
<ul class="subsubsub">
<li class="all"><a class="current"><?php esc_html_e( 'All', 'google-sitemap-plugin' ); ?>&nbsp;<span class="count">(5)</span></a> |</li>
<li class="enabled"><a><?php esc_html_e( 'Enabled', 'google-sitemap-plugin' ); ?>&nbsp;<span class="count">(3)</span></a> |</li>
<li class="disabled"><a><?php esc_html_e( 'Disabled', 'google-sitemap-plugin' ); ?>&nbsp;<span class="count">(2)</span></a></li>
</ul>
<p class="search-box">
<input type="search" disabled="disabled"/>
<input class="button" value="<?php esc_html_e( 'Search', 'google-sitemap-plugin' ); ?>" type="submit" disabled="disabled" />
</p>
<div class="tablenav top">
<div class="alignleft actions bulkactions">
<select disabled="disabled">
<option value="-1"><?php esc_html_e( 'Bulk Actions', 'google-sitemap-plugin' ); ?></option>
</select>
<input disabled="disabled" id="doaction" class="button action" value="<?php esc_html_e( 'Apply', 'google-sitemap-plugin' ); ?>" type="submit">
</div>
<div class="tablenav-pages one-page"><span class="displaying-num">5 <?php esc_html_e( 'items', 'google-sitemap-plugin' ); ?></span></div>
</div>
<table class="wp-list-table widefat fixed striped links" id="gglstmp_table">
<thead>
<tr>
<td id="cb" class="manage-column column-cb check-column"><input id="cb-select-all" type="checkbox" disabled="disabled" /></td>
<th scope="col" id="url" class="manage-column column-url column-primary sortable asc"><a>URL</a></th>
<th scope="col" id="is_sitemap" class="manage-column column-is_sitemap sortable desc"><a>Sitemap</a></th>
<th scope="col" id="priority" class="manage-column column-priority sortable desc"><a><?php esc_html_e( 'Priority', 'google-sitemap-plugin' ); ?></a></th>
<th scope="col" id="frequency" class="manage-column column-frequency"><?php esc_html_e( 'Change Frequency', 'google-sitemap-plugin' ); ?></th>
<th scope="col" id="date" class="manage-column column-date sortable desc"><a><?php esc_html_e( 'Last Changed', 'google-sitemap-plugin' ); ?></a></th>
</tr>
</thead>
<tbody data-wp-lists="list:link">
<tr style="overflow: visible;">
<th scope="row" class="check-column"></th>
<td class="url column-url has-row-actions column-primary" data-colname="URL">
<input type="url" style="width: 100%; box-sizing: border-box;" disabled="disabled" />
<div class="bws_info">
<strong><?php esc_html_e( "Please note", "google-sitemap-plugin" ); ?>:</strong>
<?php esc_html_e( "All URLs listed in the sitemap.xml must use the same protocol (HTTP or HTTPS) and must be located on the same host as the sitemap.xml.", "google-sitemap-plugin" ); ?>&nbsp;<a href="http://www.sitemaps.org/protocol.html#location" target="_blank"><?php esc_html_e( 'Learn More', 'google-sitemap-plugin' ); ?></a><br/><strong><?php esc_html_e( 'You can also add multiple URLs at once.' , 'google-sitemap-plugin' ); ?></strong><?php echo bws_add_help_box(''); ?></div>
</div>
</td>
<td class="is_sitemap column-is_sitemap" data-colname="Sitemap"><input type="checkbox" disabled="disabled" value="1"></td>
<td class="priority column-priority" data-colname="Priority"><input class="small-text" value="100" type="number" disabled="disabled" />&nbsp;%</td>
<td class="frequency column-frequency" data-colname="Change Frequency">
<select disabled="disabled" >
<option value="always"><?php esc_html_e( "Always", "google-sitemap-plugin" ); ?></option>
</select>
</td>
<td class="date column-date" data-colname="Last Changed">
<input class="button button-primary" value="<?php esc_html_e( "Save", "google-sitemap-plugin" ); ?>" type="submit" disabled="disabled" />
</td>
</tr>
<tr>
<th scope="row" class="check-column"><input type="checkbox" disabled="disabled" /></th>
<td class="url column-url has-row-actions column-primary" data-colname="URL">
http://example.com/sitemap.xml
<div class="row-actions visible">
<span class="edit"><a><?php esc_html_e( 'Edit', 'google-sitemap-plugin' ); ?></a> | </span>
<span class="disable"><a><?php esc_html_e( 'Disable', 'google-sitemap-plugin' ); ?></a> | </span>
<span class="delete"><a><?php esc_html_e( 'Delete', 'google-sitemap-plugin' ); ?></a></span>
</div>
</td>
<td class="is_sitemap column-is_sitemap" data-colname="Sitemap"><?php esc_html_e( 'Yes', 'google-sitemap-plugin' ); ?></td>
<td class="priority column-priority" data-colname="Priority">100&nbsp;%</td>
<td class="frequency column-frequency" data-colname="Change Frequency"><?php esc_html_e( 'Monthly', 'google-sitemap-plugin' ); ?></td>
<td class="date column-date" data-colname="Last Changed"><?php echo $date; ?></td>
</tr>
<tr>
<th scope="row" class="check-column"><input type="checkbox" disabled="disabled" /></th>
<td class="url column-url has-row-actions column-primary" data-colname="URL">http://example.com/lorem/ipsum/dolor/sit/amet<div class="row-actions">&nbsp;</div></td>
<td class="is_sitemap column-is_sitemap" data-colname="Sitemap"><?php esc_html_e( 'No', 'google-sitemap-plugin' ); ?></td>
<td class="priority column-priority" data-colname="Priority">100&nbsp;%</td>
<td class="frequency column-frequency" data-colname="Change Frequency"><?php esc_html_e( 'Monthly', 'google-sitemap-plugin' ); ?></td>
<td class="date column-date" data-colname="Last Changed"><?php echo $date; ?></td>
</tr>
<tr class="gglstmp_disabled">
<th scope="row" class="check-column"><input type="checkbox" disabled="disabled" /></th>
<td class="url column-url has-row-actions column-primary" data-colname="URL">http://example.com/donec-fringilla<div class="row-actions">&nbsp;</div></td>
<td class="is_sitemap column-is_sitemap" data-colname="Sitemap"><?php esc_html_e( 'No', 'google-sitemap-plugin' ); ?></td>
<td class="priority column-priority" data-colname="Priority">100&nbsp;%</td>
<td class="frequency column-frequency" data-colname="Change Frequency"><?php esc_html_e( 'Monthly', 'google-sitemap-plugin' ); ?></td>
<td class="date column-date" data-colname="Last Changed"><?php echo $date; ?></td>
</tr>
<tr class="gglstmp_disabled">
<th scope="row" class="check-column"><input type="checkbox" disabled="disabled" /></th>
<td class="url column-url has-row-actions column-primary" data-colname="URL">http://example.com/lorem-ipsum<div class="row-actions">&nbsp;</div></td>
<td class="is_sitemap column-is_sitemap" data-colname="Sitemap"><?php esc_html_e( 'No', 'google-sitemap-plugin' ); ?></td>
<td class="priority column-priority" data-colname="Priority">100&nbsp;%</td>
<td class="frequency column-frequency" data-colname="Change Frequency"><?php esc_html_e( 'Monthly', 'google-sitemap-plugin' ); ?></td>
<td class="date column-date" data-colname="Last Changed"><?php echo $date; ?></td>
</tr>
<tr>
<th scope="row" class="check-column"><input type="checkbox" disabled="disabled" /></th>
<td class="url column-url has-row-actions column-primary" data-colname="URL">http://example.com/?s_id=123&amp;p_id=2<div class="row-actions">&nbsp;</div></td>
<td class="is_sitemap column-is_sitemap" data-colname="Sitemap"><?php esc_html_e( 'No', 'google-sitemap-plugin' ); ?></td>
<td class="priority column-priority" data-colname="Priority">100&nbsp;%</td>
<td class="frequency column-frequency" data-colname="Change Frequency"><?php esc_html_e( 'Monthly', 'google-sitemap-plugin' ); ?></td>
<td class="date column-date" data-colname="Last Changed"><?php echo $date; ?></td>
</tr>
</tbody>
<tfoot>
<tr>
<td class="manage-column column-cb check-column"><input id="cb-select-all-2" type="checkbox" disabled="disabled" /></td>
<th scope="col" class="manage-column column-url column-primary sortable asc"><a>URL</a></th>
<th scope="col" class="manage-column column-is_sitemap sortable desc"><a>Sitemap</a></th>
<th scope="col" class="manage-column column-priority sortable desc"><a><?php esc_html_e( 'Priority', 'google-sitemap-plugin' ); ?></a></th>
<th scope="col" class="manage-column column-frequency"><?php esc_html_e( 'Change Frequency', 'google-sitemap-plugin' ); ?></th>
<th scope="col" class="manage-column column-date sortable desc"><a><?php esc_html_e( 'Last Changed', 'google-sitemap-plugin' ); ?></a></th>
</tr>
</tfoot>
</table>
<?php }
}