This commit is contained in:
KhaiNguyen
2020-02-13 10:39:37 +07:00
commit 59401cb805
12867 changed files with 4646216 additions and 0 deletions

View File

@@ -0,0 +1,141 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\admin\google_search_console
*/
/**
* Class WPSEO_GSC.
*/
class WPSEO_GSC implements WPSEO_WordPress_Integration {
/**
* The option where data will be stored.
*
* @var string
*/
const OPTION_WPSEO_GSC = 'wpseo-gsc';
/**
* Outputs the HTML for the redirect page.
*
* @return void
*/
public function display() {
require_once WPSEO_PATH . 'admin/google_search_console/views/gsc-display.php';
}
/**
* Registers the hooks.
*
* @deprecated 12.5
*
* @codeCoverageIgnore
*
* @return void
*/
public function register_hooks() {
_deprecated_function( __METHOD__, 'WPSEO 12.5' );
}
/**
* Handles the dashboard notification.
*
* If the Google Search Console has no credentials, show a notification
* for the user to give them a heads up. This message is dismissable.
*
* @deprecated 12.5
*
* @codeCoverageIgnore
*
* @return void
*/
public function register_gsc_notification() {
_deprecated_function( __METHOD__, 'WPSEO 12.5' );
}
/**
* Makes sure the settings will be registered, so data can be stored.
*
* @deprecated 12.5
*
* @codeCoverageIgnore
*
* @return void
*/
public function register_settings() {
_deprecated_function( __METHOD__, 'WPSEO 12.5' );
}
/**
* Displays the table.
*
* @deprecated 12.5
*
* @codeCoverageIgnore
*
* @return void
*/
public function display_table() {
_deprecated_function( __METHOD__, 'WPSEO 12.5' );
}
/**
* Loads the admin redirects scripts.
*
* @deprecated 12.5
*
* @codeCoverageIgnore
*
* @return void
*/
public function page_scripts() {
_deprecated_function( __METHOD__, 'WPSEO 12.5' );
}
/**
* Sets the screen options.
*
* @deprecated 12.5
*
* @codeCoverageIgnore
*
* @param string $status Status string.
* @param string $option Option key.
* @param string $value Value to return.
*
* @return mixed The screen option value. False when not errors_per_page.
*/
public function set_screen_option( $status, $option, $value ) {
_deprecated_function( __METHOD__, 'WPSEO 12.5' );
return false;
}
/**
* Sets the tab help on top of the screen.
*
* @deprecated 12.5
*
* @codeCoverageIgnore
*
* @return void
*/
public function set_help() {
_deprecated_function( __METHOD__, 'WPSEO 12.5' );
}
/**
* Run init logic.
*
* @codeCoverageIgnore
*
* @deprecated 9.5
*
* @return void
*/
public function init() {
_deprecated_function( __METHOD__, 'WPSEO 9.5' );
}
}

View File

@@ -0,0 +1,58 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Google_Search_Console
*/
// Admin header.
Yoast_Form::get_instance()->admin_header( false, 'wpseo-gsc', false, 'yoast_wpseo_gsc_options' );
// GSC Error notification.
$gsc_profile = WPSEO_GSC_Settings::get_profile();
$gsc_url = 'https://search.google.com/search-console/index';
if ( $gsc_profile !== '' ) {
$gsc_url .= '?resource_id=' . rawurlencode( $gsc_profile );
}
$gsc_post_url = 'https://yoa.st/google-search-console-deprecated';
$gsc_style_alert = '
display: flex;
align-items: baseline;
position: relative;
padding: 16px;
border: 1px solid rgba(0, 0, 0, 0.2);
font-size: 14px;
font-weight: 400;
line-height: 1.5;
margin: 16px 0;
color: #450c11;
background: #f8d7da;
';
$gsc_style_alert_icon = 'display: block; margin-right: 8px;';
$gsc_style_alert_content = 'max-width: 600px;';
$gsc_style_alert_link = 'color: #004973;';
$gsc_notification = sprintf(
/* Translators: %1$s: expands to opening anchor tag, %2$s expands to closing anchor tag. */
__( 'Google has discontinued its Crawl Errors API. Therefore, any possible crawl errors you might have cannot be displayed here anymore. %1$sRead our statement on this for further information%2$s.', 'wordpress-seo' ),
'<a style="' . $gsc_style_alert_link . '" href="' . WPSEO_Shortlinker::get( $gsc_post_url ) . '" target="_blank" rel="noopener">',
WPSEO_Admin_Utils::get_new_tab_message() . '</a>'
);
$gsc_notification .= '<br/><br/>';
$gsc_notification .= sprintf(
/* Translators: %1$s: expands to opening anchor tag, %2$s expands to closing anchor tag. */
__( 'To view your current crawl errors, %1$splease visit Google Search Console%2$s.', 'wordpress-seo' ),
'<a style="' . $gsc_style_alert_link . '" href="' . $gsc_url . '" target="_blank" rel="noopener noreferrer">',
WPSEO_Admin_Utils::get_new_tab_message() . '</a>'
);
?>
<div style="<?php echo $gsc_style_alert; ?>">
<span style="<?php echo $gsc_style_alert_icon; ?>">
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="14" viewBox="0 0 12 14" role="img" aria-hidden="true"
focusable="false" fill="#450c11">
<path
d="M6 1q1.6 0 3 .8T11.2 4t.8 3-.8 3T9 12.2 6 13t-3-.8T.8 10 0 7t.8-3T3 1.8 6 1zm1 9.7V9.3 9L6.7 9H5l-.1.3V10.9l.3.1h1.6l.1-.3zm0-2.6L7 3.2v-.1L6.8 3H5 5l-.1.2.1 4.9.3.2h1.4l.2-.1Q7 8 6.9 8z"></path>
</svg>
</span>
<span style="<?php echo $gsc_style_alert_content; ?>"><?php echo $gsc_notification; ?></span>
</div>
<?php

View File

@@ -0,0 +1,27 @@
<?php
/**
* WPSEO plugin file.
*
* This is the view for the modal box that appears when premium isn't loaded.
*
* @package WPSEO\Admin\Google_Search_Console
*/
_deprecated_file( __FILE__, 'WPSEO 9.5' );
echo '<h1 class="wpseo-redirect-url-title">';
printf(
/* Translators: %s: expands to Yoast SEO Premium */
esc_html__( 'Creating redirects is a %s feature', 'wordpress-seo' ),
'Yoast SEO Premium'
);
echo '</h1>';
echo '<p>';
printf(
/* Translators: %1$s: expands to 'Yoast SEO Premium', %2$s: links to Yoast SEO Premium plugin page. */
esc_html__( 'To be able to create a redirect and fix this issue, you need %1$s. You can buy the plugin, including one year of support and updates, on %2$s.', 'wordpress-seo' ),
'Yoast SEO Premium',
'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/redirects' ) ) . '" target="_blank">yoast.com</a>'
);
echo '</p>';
echo '<button type="button" class="button wpseo-redirect-close">' . esc_html__( 'Close', 'wordpress-seo' ) . '</button>';