Commit 2e1bb25d authored by Simon's avatar Simon

in progress

parent e80e5d63
......@@ -330,10 +330,11 @@ class WPSEO_Admin_Asset_Manager {
return array(
array(
'name' => 'commons',
'name' => 'commons',
// Load webpack-commons for bundle support.
'src' => 'commons-' . $flat_version,
'deps' => array(
'src' => 'commons-' . $flat_version,
'in_footer' => false,
'deps' => array(
'wp-polyfill',
),
),
......@@ -357,17 +358,6 @@ class WPSEO_Admin_Asset_Manager {
self::PREFIX . 'commons',
),
),
array(
'name' => 'help-center',
'src' => 'wp-seo-help-center-' . $flat_version,
'deps' => array(
'jquery',
'wp-element',
'wp-i18n',
self::PREFIX . 'components',
self::PREFIX . 'commons',
),
),
array(
'name' => 'admin-script',
'src' => 'wp-seo-admin-' . $flat_version,
......@@ -650,6 +640,16 @@ class WPSEO_Admin_Asset_Manager {
'wp-element',
),
),
array(
'name' => 'help-scout-beacon',
'src' => 'help-scout-beacon-' . $flat_version,
'in_footer' => false,
'deps' => array(
self::PREFIX . 'styled-components',
'wp-element',
'wp-i18n',
),
),
);
}
......@@ -694,6 +694,7 @@ class WPSEO_Admin_Asset_Manager {
'src' => 'metabox-' . $flat_version,
'deps' => array(
self::PREFIX . 'select2',
self::PREFIX . 'admin-css',
),
),
array(
......
......@@ -9,6 +9,7 @@
* Class WPSEO_Admin_Banner.
*/
class WPSEO_Admin_Banner implements WPSEO_WordPress_Integration {
/**
* Registers all hooks to WordPress.
*
......
......@@ -41,11 +41,13 @@ class WPSEO_Admin_Help_Panel {
/**
* Constructor.
*
* @param string $id Unique identifier of the element the inline help refers to, used as an identifier in the html.
* @param string $help_button_text The Help Button text. Needs a properly escaped string.
* @param string $help_content The Help Panel content. Needs a properly escaped string (might contain HTML).
* @param string $wrapper Optional Whether to print out a container div element for the Help Panel, used for styling.
* Pass a `has-wrapper` value to print out the container. Default: no container.
* @param string $id Unique identifier of the element the inline help refers to, used as
* an identifier in the html.
* @param string $help_button_text The Help Button text. Needs a properly escaped string.
* @param string $help_content The Help Panel content. Needs a properly escaped string (might contain HTML).
* @param string $wrapper Optional Whether to print out a container div element for the Help Panel,
* used for styling.
* Pass a `has-wrapper` value to print out the container. Default: no container.
*/
public function __construct( $id, $help_button_text, $help_content, $wrapper = '' ) {
$this->id = $id;
......
......@@ -113,6 +113,7 @@ class WPSEO_Admin {
$integrations[] = new WPSEO_Tracking( 'https://tracking.yoast.com/stats', ( WEEK_IN_SECONDS * 2 ) );
$integrations[] = new WPSEO_Admin_Settings_Changed_Listener();
$integrations[] = new WPSEO_Admin_Banner();
$integrations[] = $this->get_helpscout_beacon();
$integrations = array_merge(
$integrations,
......@@ -303,8 +304,12 @@ class WPSEO_Admin {
*/
private function localize_admin_global_script() {
return array(
/* translators: %s: '%%term_title%%' variable used in titles and meta's template that's not compatible with the given template */
'variable_warning' => sprintf( __( 'Warning: the variable %s cannot be used in this template. See the help center for more info.', 'wordpress-seo' ), '<code>%s</code>' ),
/* translators: %1$s: '%%term_title%%' variable used in titles and meta's template that's not compatible with the given template, %2$s: expands to 'HelpScout beacon' */
'variable_warning' => sprintf(
__( 'Warning: the variable %1$s cannot be used in this template. See the %2$s for more info.', 'wordpress-seo' ),
'<code>%s</code>',
'HelpScout beacon'
),
'dismiss_about_url' => $this->get_dismiss_url( 'wpseo-dismiss-about' ),
'dismiss_tagline_url' => $this->get_dismiss_url( 'wpseo-dismiss-tagline-notice' ),
/* translators: %s: expends to Yoast SEO */
......@@ -417,6 +422,41 @@ class WPSEO_Admin {
return $integrations;
}
/**
* Retrieves an instance of the HelpScout beacon class for Yoast SEO.
*
* @return WPSEO_HelpScout The instance of the HelpScout beacon.
*/
private function get_helpscout_beacon() {
$helpscout_settings = array(
'beacon_id' => '2496aba6-0292-489c-8f5d-1c0fba417c2f',
'pages' => array(
'wpseo_dashboard',
'wpseo_titles',
'wpseo_search_console',
'wpseo_social',
'wpseo_tools',
'wpseo_licenses',
),
'products' => array(),
'ask_consent' => true,
);
/**
* Filter: 'wpseo_helpscout_beacon_settings' - Allows overriding the HelpScout beacon settings.
*
* @api string - The helpscout beacons settings.
*/
$helpscout_settings = apply_filters( 'wpseo_helpscout_beacon_settings', $helpscout_settings );
return new WPSEO_HelpScout(
$helpscout_settings['beacon_id'],
$helpscout_settings['pages'],
$helpscout_settings['products'],
$helpscout_settings['ask_consent']
);
}
/* ********************* DEPRECATED METHODS ********************* */
/**
......
......@@ -65,7 +65,6 @@ class WPSEO_Admin_Pages {
*/
public function config_page_scripts() {
$this->asset_manager->enqueue_script( 'admin-script' );
$this->asset_manager->enqueue_script( 'help-center' );
$page = filter_input( INPUT_GET, 'page' );
......
......@@ -15,14 +15,14 @@ class WPSEO_Gutenberg_Compatibility {
*
* @var string
*/
const CURRENT_RELEASE = '6.8.0';
const CURRENT_RELEASE = '6.9.0';
/**
* The minimally supported version of Gutenberg by the plugin.
*
* @var string
*/
const MINIMUM_SUPPORTED = '6.8.0';
const MINIMUM_SUPPORTED = '6.9.0';
/**
* Holds the current version.
......
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin\Options\Tabs
*/
/**
* Class WPSEO_Help_Center_Item.
*/
class WPSEO_Help_Center_Item {
/**
* Identifier for this tab.
*
* @var string
*/
private $identifier;
/**
* Label to display.
*
* @var string
*/
private $label;
/**
* The dashicon classname to display in front of the label.
*
* @var string
*/
private $dashicon;
/**
* Optional arguments.
*
* @var array
*/
private $args = array();
/**
* WPSEO_Help_Center_Item constructor.
*
* @param string $identifier Unique identifier for this tab.
* @param string $label Label to display.
* @param array $args Optional. Settings for this tab.
* @param string $dashicon Optional. The classname of the dahsicon to put in front of the label.
*/
public function __construct( $identifier, $label, $args = array(), $dashicon = '' ) {
$this->identifier = $identifier;
$this->label = $label;
$this->dashicon = $dashicon;
$this->args = $args;
}
/**
* Get the label.
*
* @return string
*/
public function get_label() {
return $this->label;
}
/**
* Get the identifier.
*
* @return string
*/
public function get_identifier() {
return $this->identifier;
}
/**
* Get the dashicon.
*
* @return string
*/
public function get_dashicon() {
return $this->dashicon;
}
/**
* Get the content of this tab.
*
* @return mixed|string
*/
public function get_content() {
if ( ! empty( $this->args['content'] ) ) {
return $this->args['content'];
}
if ( ! empty( $this->args['callback'] ) ) {
return call_user_func_array( $this->args['callback'], array( $this ) );
}
if ( ! empty( $this->args['view'] ) ) {
$view = $this->args['view'];
if ( substr( $view, - 4 ) === '.php' ) {
$view = substr( $view, 0, - 4 );
}
if ( ! empty( $this->args['view_arguments'] ) ) {
extract( $this->args['view_arguments'] );
}
include WPSEO_PATH . 'admin/views/' . $view . '.php';
}
return '';
}
}
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin
*/
/**
* Class WPSEO_Help_Center
*/
class WPSEO_Help_Center {
/**
* The tabs in the help center.
*
* @var WPSEO_Option_Tab[] $tab
*/
private $tabs;
/**
* Mount point in the HTML.
*
* @var string
*/
private $identifier = 'yoast-help-center-container';
/**
* Additional help center items.
*
* @var array
*/
protected $help_center_items = array();
/**
* Show premium support tab.
*
* @var bool
*/
protected $premium_support;
/**
* WPSEO_Help_Center constructor.
*
* @param string $unused Backwards compatible argument.
* @param WPSEO_Option_Tabs|WPSEO_Option_Tab $option_tabs Currently displayed tabs.
* @param boolean $premium_support Show premium support tab.
*/
public function __construct( $unused, $option_tabs, $premium_support = false ) {
$this->premium_support = $premium_support;
$tabs = new WPSEO_Option_Tabs( '' );
if ( $option_tabs instanceof WPSEO_Option_Tabs ) {
$tabs = $option_tabs;
}
if ( $option_tabs instanceof WPSEO_Option_Tab ) {
$tabs = new WPSEO_Option_Tabs( '', $option_tabs->get_name() );
$tabs->add_tab( $option_tabs );
}
$this->tabs = $tabs;
}
/**
* Localize data required by the help center component.
*/
public function localize_data() {
$this->add_contact_support_item();
$this->enqueue_localized_data( $this->format_data( $this->tabs->get_tabs() ) );
}
/**
* Format the required data for localized script.
*
* @param WPSEO_Option_Tab[] $tabs Yoast admin pages navigational tabs.
*
* @return array Associative array containing data for help center component.
*/
protected function format_data( array $tabs ) {
$formatted_data = array( 'tabs' => array() );
foreach ( $tabs as $tab ) {
$formatted_data['tabs'][ $tab->get_name() ] = array(
'label' => $tab->get_label(),
'videoUrl' => $tab->get_video_url(),
'id' => $tab->get_name(),
);
}
$active_tab = $this->tabs->get_active_tab();
$active_tab = ( null === $active_tab ) ? $tabs[0] : $active_tab;
$formatted_data['mountId'] = $this->identifier;
$formatted_data['initialTab'] = $active_tab->get_name();
$is_premium = WPSEO_Utils::is_yoast_seo_premium();
// Will translate to either empty string or "1" in localised script.
$formatted_data['isPremium'] = $is_premium;
$formatted_data['pluginVersion'] = WPSEO_VERSION;
// Open HelpScout on activating this tab ID.
$formatted_data['shouldDisplayContactForm'] = $this->premium_support;
$formatted_data['videoDescriptions'] = array();
if ( $is_premium === false ) {
$formatted_data['videoDescriptions'][] = array(
'title' => __( 'Need help?', 'wordpress-seo' ),
'description' => __( 'Go Premium and our experts will be there for you to answer any questions you might have about the setup and use of the plugin.', 'wordpress-seo' ),
'link' => WPSEO_Shortlinker::get( 'https://yoa.st/seo-premium-vt' ),
/* translators: %s expands to Yoast SEO Premium */
'linkText' => sprintf( __( 'Get %s', 'wordpress-seo' ), 'Yoast SEO Premium' ),
);
$formatted_data['videoDescriptions'][] = array(
/* translators: %s expands to Yoast SEO */
'title' => sprintf( __( 'Want to be a %s Expert?', 'wordpress-seo' ), 'Yoast SEO' ),
/* translators: %1$s expands to Yoast SEO */
'description' => sprintf( __( 'Follow our free %1$s for WordPress training and become a certified %1$s Expert!', 'wordpress-seo' ), 'Yoast SEO' ),
'link' => WPSEO_Shortlinker::get( 'https://yoa.st/wordpress-training-vt' ),
/* translators: %s expands to Yoast SEO */
'linkText' => sprintf( __( 'Enroll in the free %s for WordPress training', 'wordpress-seo' ), 'Yoast SEO' ),
);
}
$formatted_data['contactSupportParagraphs'] = array(
array(
'image' => array(
'src' => esc_url( plugin_dir_url( WPSEO_FILE ) . 'images/support-team.svg' ),
'width' => 100,
'height' => 100,
'alt' => '',
),
'content' => null,
),
array(
'image' => null,
'content' => __( 'If you have a problem that you can\'t solve with our video tutorials or knowledge base, you can send a message to our support team. They can be reached 24/7.', 'wordpress-seo' ),
),
array(
'image' => null,
'content' => __( 'Support requests you create here are sent directly into our support system, which is secured with 256 bit SSL, so communication is 100% secure.', 'wordpress-seo' ),
),
);
$formatted_data['extraTabs'] = $this->get_extra_tabs();
return $formatted_data;
}
/**
* Get additional tabs for the help center component.
*
* @return array Additional help center tabs.
*/
protected function get_extra_tabs() {
$help_center_items = apply_filters( 'wpseo_help_center_items', $this->help_center_items );
return array_map( array( $this, 'format_helpcenter_tab' ), $help_center_items );
}
/**
* Convert WPSEO_Help_Center_Item into help center format.
*
* @param WPSEO_Help_Center_Item $item The item to convert.
*
* @return array Formatted item.
*/
protected function format_helpcenter_tab( WPSEO_Help_Center_Item $item ) {
return array(
'identifier' => $item->get_identifier(),
'label' => $item->get_label(),
'content' => $item->get_content(),
);
}
/**
* Enqueue localized script for help center component.
*
* @param array $data Data to localize.
*/
protected function enqueue_localized_data( $data ) {
wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'help-center', 'wpseoHelpCenterData', $data );
$yoast_components_l10n = new WPSEO_Admin_Asset_Yoast_Components_L10n();
$yoast_components_l10n->localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'help-center' );
}
/**
* Outputs the help center div.
*/
public function mount() {
echo '<div id="' . esc_attr( $this->identifier ) . '">' . esc_html__( 'Loading help center.', 'wordpress-seo' ) . '</div>';
}
/**
* Add the contact support help center item to the help center.
*/
private function add_contact_support_item() {
/* translators: %s: expands to 'Yoast SEO Premium'. */
$popup_title = sprintf( __( 'Email support is a %s feature', 'wordpress-seo' ), 'Yoast SEO Premium' );
$popup_content = '<p class="yoast-measure">' . __( 'Go Premium and our experts will be there for you to answer any questions you might have about the setup and use of the plugin.', 'wordpress-seo' ) . '</p>';
/* translators: %s: expands to 'Yoast SEO Premium'. */
$popup_content .= '<p>' . sprintf( __( 'Other benefits of %s for you:', 'wordpress-seo' ), 'Yoast SEO Premium' ) . '</p>';
$popup_content .= '<ul class="wpseo-premium-advantages-list">';
$popup_content .= '<li>' . sprintf(
// We don't use strong text here, but we do use it in the "Add keyword" popup, this is just to have the same translatable strings.
/* translators: %1$s expands to a 'strong' start tag, %2$s to a 'strong' end tag. */
__( '%1$sNo more dead links%2$s: easy redirect manager', 'wordpress-seo' ),
'',
''
) . '</li>';
$popup_content .= '<li>' . __( 'Superfast internal linking suggestions', 'wordpress-seo' ) . '</li>';
$popup_content .= '<li>' . sprintf(
// We don't use strong text here, but we do use it in the "Add keyword" popup, this is just to have the same translatable strings.
/* translators: %1$s expands to a 'strong' start tag, %2$s to a 'strong' end tag. */
__( '%1$sSocial media preview%2$s: Facebook & Twitter', 'wordpress-seo' ),
'',
''
) . '</li>';
$popup_content .= '<li>' . __( '24/7 email support', 'wordpress-seo' ) . '</li>';
$popup_content .= '<li>' . __( 'No ads!', 'wordpress-seo' ) . '</li>';
$popup_content .= '</ul>';
$premium_popup = new WPSEO_Premium_Popup( 'contact-support', 'h2', $popup_title, $popup_content, WPSEO_Shortlinker::get( 'https://yoa.st/contact-support' ) );
$contact_support_help_center_item = new WPSEO_Help_Center_Item(
'contact-support',
__( 'Get support', 'wordpress-seo' ),
array( 'content' => $premium_popup->get_premium_message( false ) ),
'dashicons-email-alt'
);
$this->help_center_items[] = $contact_support_help_center_item;
}
}
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin
*/
/**
* Class WPSEO_HelpScout
*/
class WPSEO_HelpScout implements WPSEO_WordPress_Integration {
/**
* The id for the beacon.
*
* @var string
*/
protected $beacon_id;
/**
* The pages where the beacon is loaded.
*
* @var array
*/
protected $pages;
/**
* The products the beacon is loaded for.
*
* @var array
*/
protected $products;
/**
* Whether to asks the user's consent before loading in HelpScout.
*
* @var bool
*/
protected $ask_consent;
/**
* WPSEO_HelpScout constructor.
*
* @param string $beacon_id The beacon id.
* @param array $pages The pages where the beacon is loaded.
* @param array $products The products the beacon is loaded for.
* @param bool $ask_consent Optional. Whether to ask for consent before loading in HelpScout.
*/
public function __construct( $beacon_id, array $pages, array $products, $ask_consent = false ) {
$this->beacon_id = $beacon_id;
$this->pages = $pages;
$this->products = $products;
$this->ask_consent = $ask_consent;
}
/**
* @inheritDoc
*/
public function register_hooks() {
if ( ! $this->is_beacon_page() ) {
return;
}
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_help_scout_script' ) );
add_action( 'admin_footer', array( $this, 'output_beacon_js' ) );
}
/**
* Enqueues the HelpScout script.
*/
public function enqueue_help_scout_script() {
$asset_manager = new WPSEO_Admin_Asset_Manager();
$asset_manager->enqueue_script( 'help-scout-beacon' );
}
/**
* Outputs a small piece of javascript for the beacon.
*/
public function output_beacon_js() {
printf(
'<script type="text/javascript">window.%1$s(\'%2$s\', %3$s)</script>',
( $this->ask_consent ) ? 'wpseoHelpScoutBeaconConsent' : 'wpseoHelpScoutBeacon',
esc_html( $this->beacon_id ),
wp_json_encode( $this->get_session_data() )
);
}
/**
* Checks if the current page is a page containing the beacon.
*/
private function is_beacon_page() {
return in_array( $this->get_current_page(), $this->pages, true );
}
/**
* Retrieves the value of the current page.
*
* @return string The current page.
*/
private function get_current_page() {
$page = filter_input( INPUT_GET, 'page' );
if ( isset( $page ) && $page !== false ) {
return $page;
}
return '';
}
/**
* Retrieves the identifying data.
*
* @return string The data to pass as identifying data.
*/
protected function get_session_data() {
/** @noinspection PhpUnusedLocalVariableInspection */
// Do not make these strings translatable! They are for our support agents, the user won't see them!
$current_user = wp_get_current_user();
$data = array(
'name' => trim( $current_user->user_firstname . ' ' . $current_user->user_lastname ),
'email' => $current_user->user_email,
'WordPress Version' => $this->get_wordpress_version(),
'Server' => $this->get_server_info(),
'<a href="' . admin_url( 'themes.php' ) . '">Theme</a>' => $this->get_theme_info(),
'<a href="' . admin_url( 'plugins.php' ) . '">Plugins</a>' => $this->get_active_plugins(),
);
if ( ! empty( $this->products ) ) {
$addon_manager = new WPSEO_Addon_Manager();
foreach ( $this->products as $product ) {
$subscription = $addon_manager->get_subscription( $product );
if ( ! $subscription ) {
continue;
}
$data[ $subscription->product->name ] = $this->get_product_info( $subscription );
}
}
return wp_json_encode( $data );
}
/**
* Returns basic info about the server software.
*
* @return string
*/
private function get_server_info() {
$server_tracking_data = new WPSEO_Tracking_Server_Data();
$server_data = $server_tracking_data->get();
$server_data = $server_data['server'];
$fields_to_use = array(
'IP' => 'ip',
'Hostname' => 'Hostname',
'OS' => 'os',
'PHP' => 'PhpVersion',
'CURL' => 'CurlVersion',
);
$server_data['CurlVersion'] = $server_data['CurlVersion']['version'] . '(SSL Support' . $server_data['CurlVersion']['sslSupport'] . ')';
$server_info = '<table>';
foreach ( $fields_to_use as $label => $field_to_use ) {
if ( isset( $server_data[ $field_to_use ] ) ) {
$server_info .= sprintf( '<tr><td>%1$s</td><td>%2$s</td></tr>', esc_html( $label ), esc_html( $server_data[ $field_to_use ] ) );
}
}
$server_info .= '</table>';
return $server_info;
}
/**
* Returns info about the Yoast SEO plugin version and license.
*
* @param object $plugin The plugin.
*
* @return string The product info.
*/
private function get_product_info( $plugin ) {
if ( empty( $plugin ) ) {
return '';
}
$product_info = '<table>';
$product_info .= '<tr><td>Version</td><td>' . $plugin->product->version . '</td></tr>';
$product_info .= '<tr><td>Expiration date</td><td>' . $plugin->expiry_date . '</td></tr>';
$product_info .= '</table>';
return $product_info;
}
/**
* Returns the WordPress version + a suffix if current WP is multi site.
*
* @return string The WordPress version string.
*/
private function get_wordpress_version() {
global $wp_version;
$wordpress_version = $wp_version;
if ( is_multisite() ) {
$wordpress_version .= ' MULTI-SITE';
}
return $wordpress_version;
}
/**
* Returns a formatted HTML string for the current theme.
*
* @return string The theme info as string.
*/
private function get_theme_info() {
$theme = wp_get_theme();
$theme_info = sprintf(
'<a href="%1$s">%2$s</a> v%3$s by %4$s',
esc_attr( $theme->display( 'ThemeURI' ) ),
esc_html( $theme->display( 'Name' ) ),
esc_html( $theme->display( 'Version' ) ),
esc_html( $theme->display( 'Author' ) )
);
if ( is_child_theme() ) {
$theme_info .= sprintf( '<br />Child theme of: %1$s', esc_html( $theme->display( 'Template' ) ) );
}
return $theme_info;
}
/**
* Returns a formatted HTML list of all active plugins.
*
* @return string The active plugins.
*/
private function get_active_plugins() {
$updates_available = get_site_transient( 'update_plugins' );
$active_plugins = '';
foreach ( wp_get_active_and_valid_plugins() as $plugin ) {
$plugin_data = get_plugin_data( $plugin );
$plugin_file = str_replace( trailingslashit( WP_PLUGIN_DIR ), '', $plugin );
if ( isset( $updates_available->response[ $plugin_file ] ) ) {
$active_plugins .= '<i class="icon-close1"></i> ';
}
$active_plugins .= sprintf(
'<a href="%1$s">%2$s</a> v%3$s',
esc_attr( $plugin_data['PluginURI'] ),
esc_html( $plugin_data['Name'] ),
esc_html( $plugin_data['Version'] )
);
}
return $active_plugins;
}
}
......@@ -62,15 +62,6 @@ class WPSEO_Option_Tab {
return $this->label;
}
/**
* Gets the video URL.
*
* @return string The video url.
*/
public function get_video_url() {
return $this->get_argument( 'video_url' );
}
/**
* Retrieves whether the tab needs a save button.
*
......
......@@ -40,10 +40,6 @@ class WPSEO_Option_Tabs_Formatter {
}
echo '</h2>';
$help_center = new WPSEO_Help_Center( '', $option_tabs, WPSEO_Utils::is_yoast_seo_premium() );
$help_center->localize_data();
$help_center->mount();
foreach ( $option_tabs->get_tabs() as $tab ) {
$identifier = $tab->get_name();
......
......@@ -24,6 +24,13 @@ class WPSEO_Post_Metabox_Formatter implements WPSEO_Metabox_Formatter_Interface
*/
private $permalink;
/**
* The date helper.
*
* @var Date_Helper
*/
protected $date;
/**
* Constructor.
*
......@@ -34,6 +41,7 @@ class WPSEO_Post_Metabox_Formatter implements WPSEO_Metabox_Formatter_Interface
public function __construct( $post, array $options, $structure ) {
$this->post = $post;
$this->permalink = $structure;
$this->date = new Date_Helper();
}
/**
......@@ -222,7 +230,7 @@ class WPSEO_Post_Metabox_Formatter implements WPSEO_Metabox_Formatter_Interface
$date = '';
if ( $this->is_show_date_enabled() ) {
$date = date_i18n( 'M j, Y', mysql2date( 'U', $this->post->post_date ) );
$date = $this->date->format_translated( $this->post->post_date, 'M j, Y' );
}
return $date;
......
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin
*/
/**
* Class that adds a template variables explanation tab to the Help Center.
*/
class WPSEO_Help_Center_Template_Variables_Tab implements WPSEO_WordPress_Integration {
/**
* Priority to hook into the tab filter.
*
* @var int
*/
private $priority;
/**
* Tab constructor.
*
* @param int $priority The priority to add the filter on, allows for ordering.
*/
public function __construct( $priority = 10 ) {
$this->priority = $priority;
}
/**
* Registers all hooks to WordPress.
*
* @return void
*/
public function register_hooks() {
add_filter( 'wpseo_help_center_items', array( $this, 'add_meta_options_help_center_tabs' ), $this->priority );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );
}
/**
* Enqueues the styles needed in the Help Center tab.
*
* @return void
*/
public function enqueue_assets() {
$asset_manager = new WPSEO_Admin_Asset_Manager();
$asset_manager->enqueue_style( 'admin-css' );
}
/**
* Adds help tabs.
*
* @param array $tabs Current help center tabs.
*
* @return array List containing all the additional tabs.
*/
public function add_meta_options_help_center_tabs( $tabs ) {
$tabs[] = new WPSEO_Help_Center_Item(
'template-variables',
__( 'Snippet variables', 'wordpress-seo' ),
array( 'content' => $this->get_content() )
);
return $tabs;
}
/**
* Adds template variables to the help center.
*
* @return string The content for the template variables tab.
*/
private function get_content() {
$explanation = sprintf(
/* translators: %1$s expands to Yoast SEO. */
__( 'The search appearance settings for %1$s are made up of variables that are replaced by specific values from the page when the page is displayed. The table below contains a list of the available variables.', 'wordpress-seo' ),
'Yoast SEO'
);
$output_explanation = sprintf(
'<h2 class="wpseo-help-center-sub-title">%s</h2><p>%s</p><p>%s</p>',
esc_html( __( 'Snippet variables', 'wordpress-seo' ) ),
esc_html( $explanation ),
esc_html( __( 'Note that not all variables can be used in every field.', 'wordpress-seo' ) )
);
$output_basic = sprintf(
'<h2 class="wpseo-help-center-sub-title">%s</h2>%s',
esc_html( __( 'Basic Variables', 'wordpress-seo' ) ),
WPSEO_Replace_Vars::get_basic_help_texts()
);
$output_advanced = sprintf(
'<h2 class="wpseo-help-center-sub-title">%s</h2>%s',
esc_html( __( 'Advanced Variables', 'wordpress-seo' ) ),
WPSEO_Replace_Vars::get_advanced_help_texts()
);
return $output_explanation . $output_basic . $output_advanced;
}
}
......@@ -33,7 +33,7 @@ class WPSEO_Replacevar_Editor {
/**
* Constructs the object.
*
* @param Yoast_Form $yform Yoast forms.
* @param Yoast_Form $yform Yoast forms.
* @param array $arguments {
* The arguments that can be given.
*
......
......@@ -42,6 +42,11 @@ class WPSEO_Metabox extends WPSEO_Meta {
* Class constructor.
*/
public function __construct() {
if ( $this->is_internet_explorer() ) {
add_action( 'add_meta_boxes', array( $this, 'internet_explorer_metabox' ) );
return;
}
add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
add_action( 'wp_insert_post', array( $this, 'save_postdata' ) );
......@@ -62,7 +67,69 @@ class WPSEO_Metabox extends WPSEO_Meta {
}
/**
* Translate text strings for use in the meta box.
* Checks whether the request comes from an IE 11 browser.
*
* @return bool Whether the request comes from an IE 11 browser.
*/
public static function is_internet_explorer() {
$user_agent = $_SERVER['HTTP_USER_AGENT'];
if ( ! stripos( $user_agent, 'Trident/7.0' ) ) {
return false;
}
return true;
}
/**
* Adds an alternative metabox for internet explorer users.
*/
public function internet_explorer_metabox() {
$post_types = WPSEO_Post_Type::get_accessible_post_types();
$post_types = array_filter( $post_types, array( $this, 'display_metabox' ) );
if ( ! is_array( $post_types ) || $post_types === array() ) {
return;
}
$product_title = $this->get_product_title();
foreach ( $post_types as $post_type ) {
add_filter( "postbox_classes_{$post_type}_wpseo_meta", array( $this, 'wpseo_metabox_class' ) );
add_meta_box(
'wpseo_meta',
$product_title,
array( $this, 'render_internet_explorer_notice' ),
$post_type,
'normal',
apply_filters( 'wpseo_metabox_prio', 'high' ),
array( '__block_editor_compatible_meta_box' => true )
);
}
}
/**
* Renders the content for the internet explorer metabox.
*/
public function render_internet_explorer_notice() {
echo '<div class="yoast-alert-box yoast-alert-box__warning">';
echo '<span class="icon">';
echo '<svg xmlns="http://www.w3.org/2000/svg" fill="#674E00" height="14px" width="14px" viewBox="0 0 576 512" role="img" aria-hidden="true" focusable="false"><path d="M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"/></svg>';
echo '</span>';
echo '<div style="float: left">';
printf(
esc_html__( 'The browser you are currently using is unfortunately rather dated. Since we strive to give you the best experience possible, we no longer support this browser. Instead, please use %1$sFirefox%4$s, %2$sChrome%4$s or %3$sMicrosoft Edge%4$s.', 'wordpress-seo' ),
'<a href="https://www.mozilla.org/firefox/new/">',
'<a href="https://www.google.com/intl/nl/chrome/">',
'<a href="https://www.microsoft.com/windows/microsoft-edge">',
'</a>'
);
echo '</div></div>';
}
/**
* Translates text strings for use in the meta box.
*
* IMPORTANT: if you want to add a new string (option) somewhere, make sure you add that array key to
* the main meta box definition array in the class WPSEO_Meta() as well!!!!
......@@ -88,10 +155,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
WPSEO_Meta::$meta_fields['advanced']['meta-robots-nofollow']['options']['1'] = __( 'No', 'wordpress-seo' );
WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['title'] = __( 'Meta robots advanced', 'wordpress-seo' );
WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['description'] = __( 'Advanced <code>meta</code> robots settings for this page.', 'wordpress-seo' );
/* translators: %s expands to the advanced robots settings default as set in the site-wide settings.*/
WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['options']['-'] = __( 'Site-wide default: %s', 'wordpress-seo' );
WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['options']['none'] = __( 'None', 'wordpress-seo' );
WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['description'] = __( 'If you want to apply advanced <code>meta</code> robots settings for this page, please define them in the following field.', 'wordpress-seo' );
WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['options']['noimageindex'] = __( 'No Image Index', 'wordpress-seo' );
WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['options']['noarchive'] = __( 'No Archive', 'wordpress-seo' );
WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['options']['nosnippet'] = __( 'No Snippet', 'wordpress-seo' );
......@@ -144,8 +208,6 @@ class WPSEO_Metabox extends WPSEO_Meta {
$product_title = $this->get_product_title();
$this->register_helpcenter_tab();
foreach ( $post_types as $post_type ) {
add_filter( "postbox_classes_{$post_type}_wpseo_meta", array( $this, 'wpseo_metabox_class' ) );
......@@ -175,7 +237,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
}
/**
* Pass variables to js for use with the post-scraper.
* Passes variables to js for use with the post-scraper.
*
* @return array
*/
......@@ -204,7 +266,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
}
/**
* Pass some variables to js for replacing variables.
* Passes some variables to js for replacing variables.
*/
public function localize_replace_vars_script() {
return array(
......@@ -244,7 +306,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
}
/**
* Pass some variables to js for the edit / post page overview, etc.
* Passes some variables to js for the edit / post page overview, etc.
*
* @return array
*/
......@@ -256,7 +318,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
}
/**
* Output the meta box.
* Outputs the meta box.
*/
public function meta_box() {
$content_sections = $this->get_content_sections();
......@@ -365,7 +427,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
}
/**
* Returns metabox sections that have been added by other plugins.
* Returns the metabox sections that have been added by other plugins.
*
* @return WPSEO_Metabox_Section_Additional[]
*/
......@@ -607,7 +669,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
$html = $content;
}
else {
$html = $label . $help_button . $help_panel . $content . $description;
$html = $label . $description . $help_button . $help_panel . $content;
}
}
......@@ -615,7 +677,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
}
/**
* Save the WP SEO metadata for posts.
* Saves the WP SEO metadata for posts.
*
* {@internal $_POST parameters are validated via sanitize_post_meta().}}
*
......@@ -793,7 +855,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
);
/**
* Remove the emoji script as it is incompatible with both React and any
* Removes the emoji script as it is incompatible with both React and any
* contenteditable fields.
*/
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
......@@ -817,7 +879,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
}
/**
* Pass some variables to js for upload module.
* Passes some variables to js for upload module.
*
* @return array
*/
......@@ -1017,25 +1079,6 @@ class WPSEO_Metabox extends WPSEO_Meta {
return $product_title;
}
/**
* Adds the template variables tab to the helpcenter.
*
* @return void
*/
protected function register_helpcenter_tab() {
static $tab_registered;
if ( $tab_registered ) {
return;
}
// Add template variables tab to the Help Center.
$tab = new WPSEO_Help_Center_Template_Variables_Tab();
$tab->register_hooks();
$tab_registered = true;
}
/* ********************* DEPRECATED METHODS ********************* */
/**
......@@ -1063,7 +1106,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
}
/**
* Output a tab in the Yoast SEO Metabox.
* Outputs a tab in the Yoast SEO Metabox.
*
* @deprecated 12.2
* @codeCoverageIgnore
......
......@@ -48,7 +48,7 @@ class WPSEO_Ryte_Service {
* Returns an the results of the Ryte option based on the passed status.
*
* @param string $status The option's status.
* @param bool $fetch Whether or not the data should be fetched.
* @param bool $fetch Whether or not the data should be fetched.
*
* @return array The results, contains a score and label.
*/
......
......@@ -38,7 +38,6 @@ $tabs->add_tab(
'dashboard',
__( 'Dashboard', 'wordpress-seo' ),
array(
'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-notification-center' ),
'save_button' => false,
)
)
......@@ -46,15 +45,13 @@ $tabs->add_tab(
$tabs->add_tab(
new WPSEO_Option_Tab(
'features',
__( 'Features', 'wordpress-seo' ),
array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-features' ) )
__( 'Features', 'wordpress-seo' )
)
);
$tabs->add_tab(
new WPSEO_Option_Tab(
'webmaster-tools',
__( 'Webmaster Tools', 'wordpress-seo' ),
array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-general-search-console' ) )
__( 'Webmaster Tools', 'wordpress-seo' )
)
);
......
......@@ -11,20 +11,17 @@ if ( ! defined( 'WPSEO_VERSION' ) ) {
exit();
}
$tab = new WPSEO_Help_Center_Template_Variables_Tab();
$tab->register_hooks();
$yform = Yoast_Form::get_instance();
$yform->admin_header( true, 'wpseo_titles' );
$tabs = new WPSEO_Option_Tabs( 'metas' );
$tabs->add_tab( new WPSEO_Option_Tab( 'general', __( 'General', 'wordpress-seo' ), array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-metas' ) ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'post-types', __( 'Content Types', 'wordpress-seo' ), array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-metas-post-types' ) ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'general', __( 'General', 'wordpress-seo' ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'post-types', __( 'Content Types', 'wordpress-seo' ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'media', __( 'Media', 'wordpress-seo' ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'taxonomies', __( 'Taxonomies', 'wordpress-seo' ), array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-metas-taxonomies' ) ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'archives', __( 'Archives', 'wordpress-seo' ), array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-metas-archives' ) ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'breadcrumbs', __( 'Breadcrumbs', 'wordpress-seo' ), array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-breadcrumbs' ) ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'rss', __( 'RSS', 'wordpress-seo' ), array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-rss' ) ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'taxonomies', __( 'Taxonomies', 'wordpress-seo' ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'archives', __( 'Archives', 'wordpress-seo' ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'breadcrumbs', __( 'Breadcrumbs', 'wordpress-seo' ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'rss', __( 'RSS', 'wordpress-seo' ) ) );
$tabs->display( $yform );
$yform->admin_footer();
......@@ -16,7 +16,7 @@ $yform->admin_header( true, 'wpseo_ms' );
$tabs = new WPSEO_Option_Tabs( 'network' );
$tabs->add_tab( new WPSEO_Option_Tab( 'general', __( 'General', 'wordpress-seo' ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'features', __( 'Features', 'wordpress-seo' ), array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-features' ) ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'features', __( 'Features', 'wordpress-seo' ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'restore-site', __( 'Restore Site', 'wordpress-seo' ), array( 'save_button' => false ) ) );
$tabs->display( $yform );
......
......@@ -15,10 +15,10 @@ $yform = Yoast_Form::get_instance();
$yform->admin_header( true, 'wpseo_social' );
$tabs = new WPSEO_Option_Tabs( 'social' );
$tabs->add_tab( new WPSEO_Option_Tab( 'accounts', __( 'Accounts', 'wordpress-seo' ), array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-social-accounts' ) ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'facebook', __( 'Facebook', 'wordpress-seo' ), array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-social-facebook' ) ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'twitterbox', __( 'Twitter', 'wordpress-seo' ), array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-social-twitter' ) ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'pinterest', __( 'Pinterest', 'wordpress-seo' ), array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-social-pinterest' ) ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'accounts', __( 'Accounts', 'wordpress-seo' ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'facebook', __( 'Facebook', 'wordpress-seo' ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'twitterbox', __( 'Twitter', 'wordpress-seo' ) ) );
$tabs->add_tab( new WPSEO_Option_Tab( 'pinterest', __( 'Pinterest', 'wordpress-seo' ) ) );
$tabs->display( $yform );
......
......@@ -71,19 +71,51 @@ class WPSEO_Taxonomy {
* @param stdClass|WP_Term $term Term to show the edit boxes for.
*/
public function term_metabox( $term ) {
$tab = new WPSEO_Help_Center_Template_Variables_Tab();
$tab->register_hooks();
if ( WPSEO_Metabox::is_internet_explorer() ) {
$this->show_internet_explorer_notice();
return;
}
$metabox = new WPSEO_Taxonomy_Metabox( $this->taxonomy, $term );
$metabox->display();
}
/**
* Renders the content for the internet explorer metabox.
*/
private function show_internet_explorer_notice() {
$product_title = 'Yoast SEO';
if ( file_exists( WPSEO_PATH . 'premium/' ) ) {
$product_title .= ' Premium';
}
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $product_title is hardcoded.
printf( '<div id="wpseo_meta" class="postbox yoast wpseo-taxonomy-metabox-postbox"><h2><span>%1$s</span></h2>', $product_title );
echo '<div class="inside">';
echo '<div class="yoast-alert-box yoast-alert-box__warning">';
echo '<span class="icon">';
echo '<svg xmlns="http://www.w3.org/2000/svg" fill="#674E00" height="14px" width="14px" viewBox="0 0 576 512" role="img" aria-hidden="true" focusable="false"><path d="M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"/></svg>';
echo '</span>';
echo '<div style="float: left">';
printf(
esc_html__( 'The browser you are currently using is unfortunately rather dated. Since we strive to give you the best experience possible, we no longer support this browser. Instead, please use %1$sFirefox%4$s, %2$sChrome%4$s or %3$sMicrosoft Edge%4$s.', 'wordpress-seo' ),
'<a href="https://www.mozilla.org/firefox/new/">',
'<a href="https://www.google.com/intl/nl/chrome/">',
'<a href="https://www.microsoft.com/windows/microsoft-edge">',
'</a>'
);
echo '</div></div>';
echo '</div></div>';
}
/**
* Queue assets for taxonomy screens.
*
* @since 1.5.0
*/
public function admin_enqueue_scripts() {
$pagenow = $GLOBALS['pagenow'];
if ( ! ( self::is_term_edit( $pagenow ) || self::is_term_overview( $pagenow ) ) ) {
......@@ -93,9 +125,6 @@ class WPSEO_Taxonomy {
$asset_manager = new WPSEO_Admin_Asset_Manager();
$asset_manager->enqueue_style( 'scoring' );
$tab = new WPSEO_Help_Center_Template_Variables_Tab();
$tab->enqueue_assets();
$tag_id = filter_input( INPUT_GET, 'tag_ID' );
if (
self::is_term_edit( $pagenow ) &&
......
......@@ -76,31 +76,6 @@ if ( ! empty( $_REQUEST['_wp_http_referer'] ) && isset( $_SERVER['REQUEST_URI']
exit;
}
/**
* Outputs a help center.
*/
function wpseo_render_help_center() {
$tabs = new WPSEO_Option_Tabs( '', '' );
$bulk_editor_tab_title = new WPSEO_Option_Tab(
'title',
__( 'Bulk editor', 'wordpress-seo' ),
array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-tools-bulk-editor' ) )
);
$tabs->add_tab( $bulk_editor_tab_title );
$bulk_editor_tab_description = new WPSEO_Option_Tab(
'description',
__( 'Bulk editor', 'wordpress-seo' ),
array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-tools-bulk-editor' ) )
);
$tabs->add_tab( $bulk_editor_tab_description );
$helpcenter = new WPSEO_Help_Center( '', $tabs, WPSEO_Utils::is_yoast_seo_premium() );
$helpcenter->localize_data();
$helpcenter->mount();
}
/**
* Renders a bulk editor tab.
*
......@@ -136,8 +111,6 @@ function wpseo_get_rendered_tab( $table, $id ) {
href="#top#description"><?php esc_html_e( 'Description', 'wordpress-seo' ); ?></a>
</h2>
<?php wpseo_render_help_center(); ?>
<div class="tabwrapper">
<?php wpseo_get_rendered_tab( $wpseo_bulk_titles_table, 'title' ); ?>
<?php wpseo_get_rendered_tab( $wpseo_bulk_description_table, 'description' ); ?>
......
......@@ -98,20 +98,9 @@ if ( isset( $msg ) && ! empty( $msg ) ) {
echo '<div id="message" class="notice notice-success"><p>', esc_html( $msg ), '</p></div>';
}
$helpcenter_tab = new WPSEO_Option_Tab(
'bulk-editor',
__( 'Bulk editor', 'wordpress-seo' ),
array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-tools-file-editor' ) )
);
$helpcenter = new WPSEO_Help_Center( 'bulk-editor', $helpcenter_tab, WPSEO_Utils::is_yoast_seo_premium() );
$helpcenter->localize_data();
$helpcenter->mount();
// N.B.: "robots.txt" is a fixed file name and should not be translatable.
echo '<h2>robots.txt</h2>';
if ( ! file_exists( $robots_file ) ) {
if ( is_writable( get_home_path() ) ) {
echo '<form action="', esc_url( $action_url ), '" method="post" id="robotstxtcreateform">';
......
......@@ -82,16 +82,13 @@ if ( $import ) {
$tabs = array(
'wpseo-import' => array(
'label' => __( 'Import settings', 'wordpress-seo' ),
'screencast_video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-tools-import-export' ),
'label' => __( 'Import settings', 'wordpress-seo' ),
),
'wpseo-export' => array(
'label' => __( 'Export settings', 'wordpress-seo' ),
'screencast_video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-tools-import-export' ),
'label' => __( 'Export settings', 'wordpress-seo' ),
),
'import-seo' => array(
'label' => __( 'Import from other SEO plugins', 'wordpress-seo' ),
'screencast_video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-tools-import-export' ),
'label' => __( 'Import from other SEO plugins', 'wordpress-seo' ),
),
);
......@@ -113,26 +110,6 @@ $tabs = array(
<?php
$helpcenter_tabs = new WPSEO_Option_Tabs( '', '' );
foreach ( $tabs as $identifier => $tab ) {
if ( ! empty( $tab['screencast_video_url'] ) ) {
$tab_video_url = $tab['screencast_video_url'];
$helpcenter_tab = new WPSEO_Option_Tab(
$identifier,
$tab['label'],
array( 'video_url' => $tab['screencast_video_url'] )
);
}
$helpcenter_tabs->add_tab( $helpcenter_tab );
}
$helpcenter = new WPSEO_Help_Center( '', $helpcenter_tabs, WPSEO_Utils::is_yoast_seo_premium() );
$helpcenter->localize_data();
$helpcenter->mount();
foreach ( $tabs as $identifier => $tab ) {
printf( '<div id="%s" class="wpseotab">', esc_attr( $identifier ) );
require_once WPSEO_PATH . 'admin/views/tabs/tool/' . $identifier . '.php';
......
......@@ -106,15 +106,19 @@ class Actions {
* @return void
*/
private static function check_cs_for_changed_files( $compare ) {
\exec( 'git diff --name-only --diff-filter=d ' . escapeshellarg( $compare ), $files );
$files = array_filter( $files, function ( $file ) {
return substr( $file, -4 ) === '.php';
} );
\exec( 'git diff --name-only --diff-filter=d ' . \escapeshellarg( $compare ), $files );
$files = \array_filter(
$files,
function ( $file ) {
return \substr( $file, -4 ) === '.php';
}
);
if ( empty( $files ) ) {
echo 'No files to compare! Exiting.';
return;
}
\system( 'composer check-cs -- ' . implode( ' ', array_map( 'escapeshellarg', $files ) ) );
\system( 'composer check-cs -- ' . \implode( ' ', \array_map( 'escapeshellarg', $files ) ) );
}
}
......@@ -75,5 +75,4 @@ class WPSEO_GSC_Settings {
// Return the profile.
return trim( $profile, '/' );
}
}
......@@ -31,6 +31,13 @@ class WPSEO_Breadcrumbs {
*/
public static $after = '';
/**
* The date helper.
*
* @var Date_Helper
*/
protected $date;
/**
* Blog's show on front setting, 'page' or 'posts'.
*
......@@ -122,6 +129,7 @@ class WPSEO_Breadcrumbs {
$this->show_on_front = get_option( 'show_on_front' );
$this->page_for_posts = get_option( 'page_for_posts' );
$this->woocommerce_shop_page = new WPSEO_WooCommerce_Shop_Page();
$this->date = new Date_Helper();
$this->filter_element();
$this->filter_separator();
......@@ -728,17 +736,9 @@ class WPSEO_Breadcrumbs {
/**
* Add (non-link) date crumb to crumbs property.
*
* @param string $date Optional date string, defaults to post's date.
*/
private function add_date_crumb( $date = null ) {
if ( is_null( $date ) ) {
$date = get_the_date();
}
else {
$date = mysql2date( get_option( 'date_format' ), $date, true );
$date = apply_filters( 'get_the_date', $date, '' );
}
private function add_date_crumb() {
$date = get_the_date();
$this->add_predefined_crumb(
WPSEO_Options::get( 'breadcrumbs-archiveprefix' ) . ' ' . esc_html( $date ),
......
......@@ -1461,7 +1461,8 @@ class WPSEO_Frontend {
global $post;
/**
* Allow the developer to determine whether or not to follow the links in the bits Yoast SEO adds to the RSS feed, defaults to true.
* Allow the developer to determine whether or not to follow the links
* in the bits Yoast SEO adds to the RSS feed, defaults to true.
*
* @api bool $unsigned Whether or not to follow the links in RSS feed, defaults to true.
*
......
......@@ -10,10 +10,19 @@
*/
class WPSEO_OpenGraph {
/**
* The date helper.
*
* @var Date_Helper
*/
protected $date;
/**
* Class constructor.
*/
public function __construct() {
$this->date = new Date_Helper();
if ( isset( $GLOBALS['fb_ver'] ) || class_exists( 'Facebook_Loader', false ) ) {
add_filter( 'fb_meta_tags', array( $this, 'facebook_filter' ), 10, 1 );
}
......@@ -225,7 +234,7 @@ class WPSEO_OpenGraph {
* If the unpaged URL is the same as the normal URL but just with pagination added, use that.
* This makes sure we always use the unpaged URL when we can, but doesn't break for overridden canonicals.
*/
if ( is_string( $unpaged_url ) && strpos( $url, $unpaged_url ) === 0 ) {
if ( ! empty( $unpaged_url ) && is_string( $unpaged_url ) && strpos( $url, $unpaged_url ) === 0 ) {
$url = $unpaged_url;
}
......@@ -701,10 +710,10 @@ class WPSEO_OpenGraph {
$post = get_post();
$pub = mysql2date( DATE_W3C, $post->post_date, false );
$pub = $this->date->format( $post->post_date_gmt );
$this->og_tag( 'article:published_time', $pub );
$mod = mysql2date( DATE_W3C, $post->post_modified, false );
$mod = $this->date->format( $post->post_modified_gmt );
if ( $mod !== $pub ) {
$this->og_tag( 'article:modified_time', $mod );
$this->og_tag( 'og:updated_time', $mod );
......
......@@ -12,6 +12,13 @@
*/
class WPSEO_Schema_Article implements WPSEO_Graph_Piece {
/**
* The date helper.
*
* @var Date_Helper
*/
protected $date;
/**
* A value object with context variables.
*
......@@ -26,6 +33,7 @@ class WPSEO_Schema_Article implements WPSEO_Graph_Piece {
*/
public function __construct( WPSEO_Schema_Context $context ) {
$this->context = $context;
$this->date = new Date_Helper();
}
/**
......@@ -59,8 +67,8 @@ class WPSEO_Schema_Article implements WPSEO_Graph_Piece {
'isPartOf' => array( '@id' => $this->context->canonical . WPSEO_Schema_IDs::WEBPAGE_HASH ),
'author' => array( '@id' => WPSEO_Schema_Utils::get_user_schema_id( $post->post_author, $this->context ) ),
'headline' => get_the_title(),
'datePublished' => mysql2date( DATE_W3C, $post->post_date, false ),
'dateModified' => mysql2date( DATE_W3C, $post->post_modified, false ),
'datePublished' => $this->date->format( $post->post_date_gmt ),
'dateModified' => $this->date->format( $post->post_modified_gmt ),
'commentCount' => $comment_count['approved'],
'mainEntityOfPage' => array( '@id' => $this->context->canonical . WPSEO_Schema_IDs::WEBPAGE_HASH ),
);
......@@ -150,7 +158,7 @@ class WPSEO_Schema_Article implements WPSEO_Graph_Piece {
foreach ( $terms as $term ) {
// We are checking against the WordPress internal translation.
// @codingStandardsIgnoreLine
if ( $term->name !== __( 'Uncategorized' ) ) {
if ( $term->name !== __( 'Uncategorized', 'default' ) ) {
$keywords[] = $term->name;
}
}
......
......@@ -13,6 +13,7 @@
* @property int $company_logo_id Holds the company logo's ID, if the site represents a company.
* @property int $id The post ID, if there is one.
* @property string $site_name The site's name.
* @property string $site_description The site's tagline.
* @property string $site_represents Whether this site represents a `company` or a `person`.
* @property string $site_url The site's URL.
* @property int $site_user_id The site's user ID if a site represents a `person`.
......@@ -68,6 +69,13 @@ class WPSEO_Schema_Context {
*/
public $site_name;
/**
* The site's tagline.
*
* @var string
*/
public $site_description;
/**
* The site's URL.
*
......@@ -136,8 +144,9 @@ class WPSEO_Schema_Context {
$this->id = get_queried_object_id();
// Site level variables.
$this->site_name = $this->set_site_name();
$this->site_url = trailingslashit( WPSEO_Utils::home_url() );
$this->site_name = $this->set_site_name();
$this->site_description = get_bloginfo( 'description' );
$this->site_url = trailingslashit( WPSEO_Utils::home_url() );
$this->set_breadcrumbs_variables();
$this->set_site_represents_variables();
......
......@@ -12,6 +12,13 @@
*/
class WPSEO_Schema_WebPage implements WPSEO_Graph_Piece {
/**
* The date helper.
*
* @var Date_Helper
*/
protected $date;
/**
* A value object with context variables.
*
......@@ -26,6 +33,7 @@ class WPSEO_Schema_WebPage implements WPSEO_Graph_Piece {
*/
public function __construct( WPSEO_Schema_Context $context ) {
$this->context = $context;
$this->date = new Date_Helper();
}
/**
......@@ -68,8 +76,8 @@ class WPSEO_Schema_WebPage implements WPSEO_Graph_Piece {
$this->add_image( $data );
$post = get_post( $this->context->id );
$data['datePublished'] = mysql2date( DATE_W3C, $post->post_date, false );
$data['dateModified'] = mysql2date( DATE_W3C, $post->post_modified, false );
$data['datePublished'] = $this->date->format( $post->post_date_gmt );
$data['dateModified'] = $this->date->format( $post->post_modified_gmt );
if ( get_post_type( $post ) === 'post' ) {
$data = $this->add_author( $data, $post );
......
......@@ -54,6 +54,10 @@ class WPSEO_Schema_Website implements WPSEO_Graph_Piece {
'name' => $this->context->site_name,
);
if ( get_bloginfo( 'description' ) ) {
$data['description'] = $this->context->site_description;
}
if ( $this->context->site_represents_reference ) {
$data['publisher'] = $this->context->site_represents_reference;
}
......
......@@ -233,7 +233,7 @@ class WPSEO_MyYoast_Api_Request {
return array( 'token' => $access_token->getToken() );
}
}
// @codingStandardsIgnoreLine Generic.CodeAnalysis.EmptyStatement.DetectedCATCH -- There is nothing to do.
// @codingStandardsIgnoreLine Generic.CodeAnalysis.EmptyStatement.DetectedCATCH -- There is nothing to do.
catch ( WPSEO_MyYoast_Bad_Request_Exception $bad_request ) {
// Do nothing.
}
......
......@@ -126,7 +126,8 @@ class WPSEO_Image_Utils {
}
/**
* Filter: 'wpseo_image_image_weight_limit' - Determines what the maximum weight (in bytes) of an image is allowed to be, default is 2 MB.
* Filter: 'wpseo_image_image_weight_limit' - Determines what the maximum weight
* (in bytes) of an image is allowed to be, default is 2 MB.
*
* @api int - The maximum weight (in bytes) of an image.
*/
......@@ -281,7 +282,7 @@ class WPSEO_Image_Utils {
* @type int $min_height Minimum height of image.
* @type int $max_height Maximum height of image.
* }
* @param array $variations The variations that should be considered.
* @param array $variations The variations that should be considered.
*
* @return array Whether a variation is fit for display or not.
*/
......
......@@ -163,11 +163,9 @@ class WPSEO_Meta {
'meta-robots-adv' => array(
'type' => 'multiselect',
'title' => '', // Translation added later.
'default_value' => '-', // = site-wide default.
'default_value' => '',
'description' => '', // Translation added later.
'options' => array(
'-' => '', // Site-wide default - translation added later.
'none' => '', // Translation added later.
'noimageindex' => '', // Translation added later.
'noarchive' => '', // Translation added later.
'nosnippet' => '', // Translation added later.
......@@ -352,13 +350,6 @@ class WPSEO_Meta {
$field_defs['meta-robots-noindex']['options']['0'] = sprintf( $field_defs['meta-robots-noindex']['options']['0'], ( ( WPSEO_Options::get( 'noindex-' . $post_type, false ) === true ) ? $field_defs['meta-robots-noindex']['options']['1'] : $field_defs['meta-robots-noindex']['options']['2'] ), $post_type_object->label );
$field_defs['meta-robots-nofollow']['title'] = sprintf( $field_defs['meta-robots-nofollow']['title'], $post_type_object->labels->singular_name );
/* Adjust the robots advanced 'site-wide default' text string based on those settings. */
$robots_adv = __( 'None', 'wordpress-seo' );
$field_defs['meta-robots-adv']['options']['-'] = sprintf( $field_defs['meta-robots-adv']['options']['-'], $robots_adv );
unset( $robots_adv );
/* Don't show the breadcrumb title field if breadcrumbs aren't enabled. */
if ( WPSEO_Options::get( 'breadcrumbs-enable', false ) !== true && ! current_theme_supports( 'yoast-seo-breadcrumbs' ) ) {
unset( $field_defs['bctitle'] );
......@@ -503,28 +494,18 @@ class WPSEO_Meta {
if ( is_array( $meta_value ) && $meta_value !== array() ) {
$meta_value = array_map( 'trim', $meta_value );
if ( in_array( 'none', $meta_value, true ) ) {
// None is one of the selected values, takes priority over everything else.
$clean = 'none';
}
elseif ( in_array( '-', $meta_value, true ) ) {
// Site-wide defaults is one of the selected values, takes priority over individual selected entries.
$clean = '-';
}
else {
// Individual selected entries.
$cleaning = array();
foreach ( $meta_value as $value ) {
if ( isset( $options[ $value ] ) ) {
$cleaning[] = $value;
}
// Individual selected entries.
$cleaning = array();
foreach ( $meta_value as $value ) {
if ( isset( $options[ $value ] ) ) {
$cleaning[] = $value;
}
}
if ( $cleaning !== array() ) {
$clean = implode( ',', $cleaning );
}
unset( $cleaning, $value );
if ( $cleaning !== array() ) {
$clean = implode( ',', $cleaning );
}
unset( $cleaning, $value );
}
return $clean;
......@@ -672,7 +653,7 @@ class WPSEO_Meta {
/**
* Deletes a meta value for a post.
*
* @param string $key The internal key of the meta value to change (without prefix).
* @param string $key The internal key of the meta value to change (without prefix).
* @param int $post_id The ID of the post to change the meta for.
*
* @return bool Whether the value was changed.
......@@ -791,7 +772,6 @@ class WPSEO_Meta {
// Delete old keys.
delete_post_meta_by_key( self::$meta_prefix . 'meta-robots' );
/*
* Remove all default values and (most) invalid option values.
* Invalid option values for the multiselect (meta-robots-adv) field will be dealt with seperately.
......@@ -814,13 +794,7 @@ class WPSEO_Meta {
continue;
}
if ( $key === 'meta-robots-adv' ) {
$query[] = $wpdb->prepare(
"( meta_key = %s AND ( meta_value = 'none' OR meta_value = '-' ) )",
self::$meta_prefix . $key
);
}
elseif ( isset( $field_def['options'] ) && is_array( $field_def['options'] ) && $field_def['options'] !== array() ) {
if ( isset( $field_def['options'] ) && is_array( $field_def['options'] ) && $field_def['options'] !== array() ) {
$valid = $field_def['options'];
// Remove the default value from the valid options.
unset( $valid[ $field_def['default_value'] ] );
......@@ -870,7 +844,6 @@ class WPSEO_Meta {
}
unset( $query, $meta_ids, $count, $object_id );
/*
* Deal with the multiselect (meta-robots-adv) field.
*
......
......@@ -47,6 +47,13 @@ class WPSEO_Replace_Vars {
*/
protected $args;
/**
* The date helper.
*
* @var Date_Helper
*/
protected $date;
/**
* Help texts for use in WPSEO -> Search appearance tabs.
*
......@@ -67,6 +74,7 @@ class WPSEO_Replace_Vars {
* @return \WPSEO_Replace_Vars
*/
public function __construct() {
$this->date = new Date_Helper();
}
/**
......@@ -307,7 +315,7 @@ class WPSEO_Replace_Vars {
$replacement = null;
if ( $this->args->post_date !== '' ) {
$replacement = mysql2date( get_option( 'date_format' ), $this->args->post_date, true );
$replacement = $this->date->format_translated( $this->args->post_date, get_option( 'date_format' ) );
}
else {
if ( get_query_var( 'day' ) && get_query_var( 'day' ) !== '' ) {
......@@ -883,7 +891,7 @@ class WPSEO_Replace_Vars {
$replacement = null;
if ( ! empty( $this->args->post_modified ) ) {
$replacement = mysql2date( get_option( 'date_format' ), $this->args->post_modified, true );
$replacement = $this->date->format_translated( $this->args->post_modified, get_option( 'date_format' ) );
}
return $replacement;
......@@ -1047,63 +1055,6 @@ class WPSEO_Replace_Vars {
/* *********************** HELP TEXT RELATED ************************** */
/**
* Create a variable help text table.
*
* @param string $type Either 'basic' or 'advanced'.
*
* @return string Help text table.
*/
private static function create_variable_help_table( $type ) {
if ( ! in_array( $type, array( 'basic', 'advanced' ), true ) ) {
return '';
}
$table = '
<table class="yoast_help yoast-table-scrollable">
<thead>
<tr>
<th scope="col">' . esc_html__( 'Label', 'wordpress-seo' ) . '</th>
<th scope="col">' . esc_html__( 'Variable', 'wordpress-seo' ) . '</th>
<th scope="col">' . esc_html__( 'Description', 'wordpress-seo' ) . '</th>
</tr>
</thead>
<tbody>';
foreach ( self::$help_texts[ $type ] as $replacement_variable ) {
$table .= '
<tr>
<td class="yoast-variable-label">' . esc_html( $replacement_variable->get_label() ) . '</td>
<td class="yoast-variable-name">%%' . esc_html( $replacement_variable->get_variable() ) . '%%</td>
<td class="yoast-variable-desc">' . esc_html( $replacement_variable->get_description() ) . '</td>
</tr>';
}
$table .= '
</tbody>
</table>';
return $table;
}
/**
* Create the help text table for the basic variables for use in a help tab.
*
* @return string
*/
public static function get_basic_help_texts() {
return self::create_variable_help_table( 'basic' );
}
/**
* Create the help text table for the advanced variables for use in a help tab.
*
* @return string
*/
public static function get_advanced_help_texts() {
return self::create_variable_help_table( 'advanced' );
}
/**
* Set the help text for a user/plugin/theme defined extra variable.
*
......@@ -1438,7 +1389,8 @@ class WPSEO_Replace_Vars {
unset( $terms, $term );
/**
* Allows filtering of the terms list used to replace %%category%%, %%tag%% and %%ct_<custom-tax-name>%% variables.
* Allows filtering of the terms list used to replace %%category%%, %%tag%%
* and %%ct_<custom-tax-name>%% variables.
*
* @api string $output Comma-delimited string containing the terms.
* @api string $taxonomy The taxonomy of the terms.
......
<?php
/**
* Date helper class.
*
* @package WPSEO\Internals
*/
/**
* Class Date_Helper
*
* Note: Move this class with namespace to the src/helpers directory and add a class_alias for BC.
*/
class Date_Helper {
/**
* Formats a given date in UTC TimeZone format.
*
* @param string $date String representing the date / time.
* @param string $format The format that the passed date should be in.
*
* @return string The formatted date.
*/
public function format( $date, $format = DATE_W3C ) {
$immutable_date = date_create_immutable_from_format( 'Y-m-d H:i:s', $date, new DateTimeZone( 'UTC' ) );
return $immutable_date->format( $format );
}
/**
* Formats a given date in UTC TimeZone format and translate it to the set language.
*
* @param string $date String representing the date / time.
* @param string $format The format that the passed date should be in.
*
* @return string The formatted and translated date.
*/
public function format_translated( $date, $format = DATE_W3C ) {
return date_i18n( $format, $this->format( $date, 'U' ) );
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
(window.yoastWebpackJsonp=window.yoastWebpackJsonp||[]).push([[2],{11:function(e,t){e.exports=window.yoast.styledComponents},16:function(e,t){e.exports=window.wp.element},5:function(e,t){e.exports=window.wp.i18n},788:function(e,t,n){"use strict";var o=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],o=!0,a=!1,i=void 0;try{for(var r,c=e[Symbol.iterator]();!(o=(r=c.next()).done)&&(n.push(r.value),!t||n.length!==t);o=!0);}catch(e){a=!0,i=e}finally{try{!o&&c.return&&c.return()}finally{if(a)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(e,t){return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n\t@media only screen and (min-width: 1024px) {\n\t\t.BeaconFabButtonFrame.BeaconFabButtonFrame {\n\t\t\tright: 340px;\n\t\t}\n\t}\n"],["\n\t@media only screen and (min-width: 1024px) {\n\t\t.BeaconFabButtonFrame.BeaconFabButtonFrame {\n\t\t\tright: 340px;\n\t\t}\n\t}\n"]),i=n(16),r=n(11),c=function(e){return e&&e.__esModule?e:{default:e}}(r),l=n(5);var s=(0,r.createGlobalStyle)(a);function d(e){var t=document.createElement("div");t.setAttribute("id","yoast-helpscout-beacon"),(0,i.render)(wp.element.createElement(e,null),t),document.body.appendChild(t)}function p(){return!!document.getElementById("sidebar")}function u(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";!function(e,t){var n=e.Beacon;function o(){var e=t.getElementsByTagName("script")[0],n=t.createElement("script");n.type="text/javascript",n.async=!0,n.src="https://beacon-v2.helpscout.net",e.parentNode.insertBefore(n,e)}if(e.Beacon=n=function(t,n,o){e.Beacon.readyQueue.push({method:t,options:n,data:o})},n.readyQueue=[],"complete"===t.readyState)return o();e.attachEvent?e.attachEvent("onload",o):e.addEventListener("load",o,!1)}(window,document,window.Beacon),window.Beacon("init",e),""!==t&&window.Beacon("session-data",JSON.parse(t)),p()&&d(s)}window.wpseoHelpScoutBeacon=u,window.wpseoHelpScoutBeaconConsent=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=c.default.div.withConfig({displayName:"help-scout-beacon__Frame",componentId:"sc-15tmc09-0"})(["border-radius:60px;height:60px;position:fixed;transform:scale(1);width:60px;z-index:1049;bottom:40px;box-shadow:rgba(0,0,0,0.1) 0 4px 7px;right:40px;top:auto;border-width:initial;border-style:none;border-color:initial;border-image:initial;transition:box-shadow 250ms ease 0s,opacity 0.4s ease 0s,scale 1000ms ease-in-out 0s,transform 0.2s ease-in-out 0s;"]),a=c.default.span.withConfig({displayName:"help-scout-beacon__SvgContainer",componentId:"sc-15tmc09-1"})(["-webkit-box-align:center;align-items:center;color:white;cursor:pointer;display:flex;height:100%;-webkit-box-pack:center;justify-content:center;left:0;pointer-events:none;position:absolute;text-indent:-99999px;top:0;width:60px;will-change:opacity,transform;opacity:1 !important;transform:rotate(0deg) scale(1) !important;transition:opacity 80ms linear 0s,transform 160ms linear 0s;"]),r=function(){return wp.element.createElement(a,null,wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"52",height:"52"},wp.element.createElement("path",{d:"M27.031 32h-2.488v-2.046c0-.635.077-1.21.232-1.72.154-.513.366-.972.639-1.381.272-.41.58-.779.923-1.109.345-.328.694-.652 1.049-.97l.995-.854a6.432 6.432 0 0 0 1.475-1.568c.39-.59.585-1.329.585-2.216 0-.635-.117-1.203-.355-1.703a3.7 3.7 0 0 0-.96-1.263 4.305 4.305 0 0 0-1.401-.783A5.324 5.324 0 0 0 26 16.114c-1.28 0-2.316.375-3.11 1.124-.795.75-1.286 1.705-1.475 2.865L19 19.693c.356-1.772 1.166-3.165 2.434-4.176C22.701 14.507 24.26 14 26.107 14c.947 0 1.842.131 2.682.392.84.262 1.57.648 2.185 1.16a5.652 5.652 0 0 1 1.475 1.892c.368.75.551 1.602.551 2.556 0 .728-.083 1.364-.248 1.909a5.315 5.315 0 0 1-.693 1.467 6.276 6.276 0 0 1-1.048 1.176c-.403.351-.83.71-1.28 1.073-.498.387-.918.738-1.26 1.057a4.698 4.698 0 0 0-.836 1.006 3.847 3.847 0 0 0-.462 1.176c-.095.432-.142.955-.142 1.568V32zM26 37a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z",fill:"#FFF"})))},m=c.default.button.withConfig({displayName:"help-scout-beacon__Button",componentId:"sc-15tmc09-2"})(["-webkit-appearance:none;-webkit-box-align:center;align-items:center;bottom:0;display:block;height:60px;-webkit-box-pack:center;justify-content:center;line-height:60px;position:relative;user-select:none;z-index:899;background-color:rgb(164,40,106);color:white;cursor:pointer;min-width:60px;-webkit-tap-highlight-color:transparent;border-radius:200px;margin:0;outline:none;padding:0;border-width:initial;border-style:none;border-color:initial;border-image:initial;transition:background-color 200ms linear 0s,transform 200ms linear 0s;"]);d(function(){var a=(0,i.useState)(!0),c=o(a,2),d=c[0],w=c[1],h=p();return wp.element.createElement(i.Fragment,null,h&&wp.element.createElement(s,null),d&&wp.element.createElement(n,{className:h?"BeaconFabButtonFrame":""},wp.element.createElement(m,{onClick:function(){var n=(0,l.__)("When you click OK we will load our HelpScout beacon, which will load data from HelpScout. This beacon can potentially also set cookies.","wordpress-seo");window.confirm(n)&&(u(e,t),window.Beacon("open"),window.setTimeout(function(){w(!1)},1e3))}},wp.element.createElement(r,null))))})}}},[[788,0]]]);
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
(window.yoastWebpackJsonp=window.yoastWebpackJsonp||[]).push([[11],{875:function(o,a,s){"use strict";!function(o){function a(){o("#wp-admin-bar-root-default > li").off("mouseenter.yoastalertpopup mouseleave.yoastalertpopup"),o(".yoast-issue-added").fadeOut(200)}function s(a,s){if(o(".yoast-alert-holder").off("click",".restore").off("click",".dismiss"),void 0!==s.html){s.html&&(a.closest(".yoast-container").html(s.html),t());var e=o("#wp-admin-bar-wpseo-menu"),n=e.find(".yoast-issue-counter");n.length||(e.find("> a:first-child").append('<div class="yoast-issue-counter"/>'),n=e.find(".yoast-issue-counter")),n.html(s.total),0===s.total?n.hide():n.show(),o("#toplevel_page_wpseo_dashboard .update-plugins").removeClass().addClass("update-plugins count-"+s.total),o("#toplevel_page_wpseo_dashboard .plugin-count").html(s.total)}}function t(){var a=o(".yoast-alert-holder");a.on("click",".dismiss",function(){var a=o(this),t=a.closest(".yoast-alert-holder");a.closest(".yoast-container").append('<div class="yoast-container-disabled"/>'),a.find("span").removeClass("dashicons-no-alt").addClass("dashicons-randomize"),o.post(ajaxurl,{action:"yoast_dismiss_alert",notification:t.attr("id"),nonce:t.data("nonce"),data:t.data("json")},s.bind(this,t),"json")}),a.on("click",".restore",function(){var a=o(this),t=a.closest(".yoast-alert-holder");a.closest(".yoast-container").append('<div class="yoast-container-disabled"/>'),a.find("span").removeClass("dashicons-arrow-up").addClass("dashicons-randomize"),o.post(ajaxurl,{action:"yoast_restore_alert",notification:t.attr("id"),nonce:t.data("nonce"),data:t.data("json")},s.bind(this,t),"json")})}function e(o){o.is(":hidden")||(o.outerWidth()>o.parent().outerWidth()?(o.data("scrollHint").addClass("yoast-has-scroll"),o.data("scrollContainer").addClass("yoast-has-scroll")):(o.data("scrollHint").removeClass("yoast-has-scroll"),o.data("scrollContainer").removeClass("yoast-has-scroll")))}function n(){window.wpseoScrollableTables=o(".yoast-table-scrollable"),window.wpseoScrollableTables.length&&window.wpseoScrollableTables.each(function(){var a=o(this);if(!a.data("scrollContainer")){var s=o("<div />",{class:"yoast-table-scrollable__hintwrapper",html:"<span class='yoast-table-scrollable__hint' aria-hidden='true' />"}).insertBefore(a),t=o("<div />",{class:"yoast-table-scrollable__container",html:"<div class='yoast-table-scrollable__inner' />"}).insertBefore(a);s.find(".yoast-table-scrollable__hint").text(wpseoAdminGlobalL10n.scrollable_table_hint),a.data("scrollContainer",t),a.data("scrollHint",s),a.appendTo(t.find(".yoast-table-scrollable__inner")),e(a)}})}jQuery(document).ready(function(){if(void 0!==window.wpseoConsoleNotifications&&"undefined"!=typeof console)for(var o=0;o<wpseoConsoleNotifications.length;o++)console.warn(wpseoConsoleNotifications[o])}),jQuery(document).ready(function(){jQuery(".yoast-dismissible").on("click",".yoast-notice-dismiss",function(){var o=jQuery(this).parent();return jQuery.post(ajaxurl,{action:o.attr("id").replace(/-/g,"_"),_wpnonce:o.data("nonce"),data:o.data("json")}),jQuery.post(ajaxurl,{action:"yoast_dismiss_notification",notification:o.attr("id"),nonce:o.data("nonce"),data:o.data("json")}),o.fadeTo(100,0,function(){o.slideUp(100,function(){o.remove()})}),!1}),jQuery(".yoast-help-button").on("click",function(){var o=jQuery(this),a=jQuery("#"+o.attr("aria-controls")),s=a.is(":visible");jQuery(a).slideToggle(200,function(){o.attr("aria-expanded",!s)})})}),window.wpseoDismissTaglineNotice=function(o){jQuery.post(ajaxurl,{action:"wpseo_dismiss_tagline_notice",_wpnonce:o})},window.wpseoSetIgnore=function(o,a,s){jQuery.post(ajaxurl,{action:"wpseo_set_ignore",option:o,_wpnonce:s},function(s){s&&(jQuery("#"+a).hide(),jQuery("#hidden_ignore_"+o).val("ignore"))})},window.wpseoDismissLink=function(o){return jQuery('<a href="'+o+'" type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></a>')},o(window).on("wp-window-resized orientationchange",function(){window.wpseoScrollableTables&&window.wpseoScrollableTables.length&&function(a){a.each(function(){e(o(this))})}(window.wpseoScrollableTables)}),o(window).on({"Yoast:YoastTabsMounted":function(){setTimeout(function(){n()},100)},"Yoast:YoastTabsSelected":function(){setTimeout(function(){n()},100)}}),o(document).ready(function(){o(".yoast-issue-added").on("mouseenter mouseleave",function(o){o.stopPropagation(),a()}).fadeIn(),o("#wp-admin-bar-root-default > li").on("mouseenter.yoastalertpopup mouseleave.yoastalertpopup",a),setTimeout(a,3e3),t(),function(){var o=jQuery(".wpseo-js-premium-indicator"),a=o.find("svg");if(o.hasClass("wpseo-premium-indicator--no")){var s=a.find("path"),t=o.css("backgroundColor");s.css("fill",t)}a.css("display","block"),o.css({backgroundColor:"transparent",width:"20px",height:"20px"})}(),n()})}(jQuery)}},[[875,0]]]);
\ No newline at end of file
(window.yoastWebpackJsonp=window.yoastWebpackJsonp||[]).push([[11],{874:function(o,a,s){"use strict";!function(o){function a(){o("#wp-admin-bar-root-default > li").off("mouseenter.yoastalertpopup mouseleave.yoastalertpopup"),o(".yoast-issue-added").fadeOut(200)}function s(a,s){if(o(".yoast-alert-holder").off("click",".restore").off("click",".dismiss"),void 0!==s.html){s.html&&(a.closest(".yoast-container").html(s.html),t());var e=o("#wp-admin-bar-wpseo-menu"),n=e.find(".yoast-issue-counter");n.length||(e.find("> a:first-child").append('<div class="yoast-issue-counter"/>'),n=e.find(".yoast-issue-counter")),n.html(s.total),0===s.total?n.hide():n.show(),o("#toplevel_page_wpseo_dashboard .update-plugins").removeClass().addClass("update-plugins count-"+s.total),o("#toplevel_page_wpseo_dashboard .plugin-count").html(s.total)}}function t(){var a=o(".yoast-alert-holder");a.on("click",".dismiss",function(){var a=o(this),t=a.closest(".yoast-alert-holder");a.closest(".yoast-container").append('<div class="yoast-container-disabled"/>'),a.find("span").removeClass("dashicons-no-alt").addClass("dashicons-randomize"),o.post(ajaxurl,{action:"yoast_dismiss_alert",notification:t.attr("id"),nonce:t.data("nonce"),data:t.data("json")},s.bind(this,t),"json")}),a.on("click",".restore",function(){var a=o(this),t=a.closest(".yoast-alert-holder");a.closest(".yoast-container").append('<div class="yoast-container-disabled"/>'),a.find("span").removeClass("dashicons-arrow-up").addClass("dashicons-randomize"),o.post(ajaxurl,{action:"yoast_restore_alert",notification:t.attr("id"),nonce:t.data("nonce"),data:t.data("json")},s.bind(this,t),"json")})}function e(o){o.is(":hidden")||(o.outerWidth()>o.parent().outerWidth()?(o.data("scrollHint").addClass("yoast-has-scroll"),o.data("scrollContainer").addClass("yoast-has-scroll")):(o.data("scrollHint").removeClass("yoast-has-scroll"),o.data("scrollContainer").removeClass("yoast-has-scroll")))}function n(){window.wpseoScrollableTables=o(".yoast-table-scrollable"),window.wpseoScrollableTables.length&&window.wpseoScrollableTables.each(function(){var a=o(this);if(!a.data("scrollContainer")){var s=o("<div />",{class:"yoast-table-scrollable__hintwrapper",html:"<span class='yoast-table-scrollable__hint' aria-hidden='true' />"}).insertBefore(a),t=o("<div />",{class:"yoast-table-scrollable__container",html:"<div class='yoast-table-scrollable__inner' />"}).insertBefore(a);s.find(".yoast-table-scrollable__hint").text(wpseoAdminGlobalL10n.scrollable_table_hint),a.data("scrollContainer",t),a.data("scrollHint",s),a.appendTo(t.find(".yoast-table-scrollable__inner")),e(a)}})}jQuery(document).ready(function(){if(void 0!==window.wpseoConsoleNotifications&&"undefined"!=typeof console)for(var o=0;o<wpseoConsoleNotifications.length;o++)console.warn(wpseoConsoleNotifications[o])}),jQuery(document).ready(function(){jQuery(".yoast-dismissible").on("click",".yoast-notice-dismiss",function(){var o=jQuery(this).parent();return jQuery.post(ajaxurl,{action:o.attr("id").replace(/-/g,"_"),_wpnonce:o.data("nonce"),data:o.data("json")}),jQuery.post(ajaxurl,{action:"yoast_dismiss_notification",notification:o.attr("id"),nonce:o.data("nonce"),data:o.data("json")}),o.fadeTo(100,0,function(){o.slideUp(100,function(){o.remove()})}),!1}),jQuery(".yoast-help-button").on("click",function(){var o=jQuery(this),a=jQuery("#"+o.attr("aria-controls")),s=a.is(":visible");jQuery(a).slideToggle(200,function(){o.attr("aria-expanded",!s)})})}),window.wpseoDismissTaglineNotice=function(o){jQuery.post(ajaxurl,{action:"wpseo_dismiss_tagline_notice",_wpnonce:o})},window.wpseoSetIgnore=function(o,a,s){jQuery.post(ajaxurl,{action:"wpseo_set_ignore",option:o,_wpnonce:s},function(s){s&&(jQuery("#"+a).hide(),jQuery("#hidden_ignore_"+o).val("ignore"))})},window.wpseoDismissLink=function(o){return jQuery('<a href="'+o+'" type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></a>')},o(window).on("wp-window-resized orientationchange",function(){window.wpseoScrollableTables&&window.wpseoScrollableTables.length&&function(a){a.each(function(){e(o(this))})}(window.wpseoScrollableTables)}),o(window).on({"Yoast:YoastTabsMounted":function(){setTimeout(function(){n()},100)},"Yoast:YoastTabsSelected":function(){setTimeout(function(){n()},100)}}),o(document).ready(function(){o(".yoast-issue-added").on("mouseenter mouseleave",function(o){o.stopPropagation(),a()}).fadeIn(),o("#wp-admin-bar-root-default > li").on("mouseenter.yoastalertpopup mouseleave.yoastalertpopup",a),setTimeout(a,3e3),t(),function(){var o=jQuery(".wpseo-js-premium-indicator"),a=o.find("svg");if(o.hasClass("wpseo-premium-indicator--no")){var s=a.find("path"),t=o.css("backgroundColor");s.css("fill",t)}a.css("display","block"),o.css({backgroundColor:"transparent",width:"20px",height:"20px"})}(),n()})}(jQuery)}},[[874,0]]]);
\ No newline at end of file
(window.yoastWebpackJsonp=window.yoastWebpackJsonp||[]).push([[12],{876:function(o,e,n){"use strict";function s(){console.error("This function is deprecated since WPSEO 12.5")}function i(){console.error("This function is deprecated since WPSEO 12.5")}function d(){console.error("This function is deprecated since WPSEO 12.5")}window.wpseoUpdateCategoryCount=s,window.wpseoMarkAsFixed=d,window.wpseoSendMarkAsFixed=i,window.wpseo_update_category_count=s,window.wpseo_mark_as_fixed=d,window.wpseo_send_mark_as_fixed=i}},[[876,0]]]);
\ No newline at end of file
(window.yoastWebpackJsonp=window.yoastWebpackJsonp||[]).push([[12],{875:function(o,e,n){"use strict";function s(){console.error("This function is deprecated since WPSEO 12.5")}function i(){console.error("This function is deprecated since WPSEO 12.5")}function d(){console.error("This function is deprecated since WPSEO 12.5")}window.wpseoUpdateCategoryCount=s,window.wpseoMarkAsFixed=d,window.wpseoSendMarkAsFixed=i,window.wpseo_update_category_count=s,window.wpseo_mark_as_fixed=d,window.wpseo_send_mark_as_fixed=i}},[[875,0]]]);
\ No newline at end of file
(window.yoastWebpackJsonp=window.yoastWebpackJsonp||[]).push([[13],{877:function(e,t,a){"use strict";jQuery(document).ready(function(e){void 0!==wp.media&&e(".wpseo_image_upload_button").each(function(t,a){var n=function(t){var a=(t=e(t)).data("target");return a&&""!==a||(a=e(t).attr("id").replace(/_button$/,"")),a}(a),i=function(t){return(t=e(t)).data("target-id")}(a),o=e("#"+n),r=e("#"+i),u=wp.media.frames.file_frame=wp.media({title:wpseoMediaL10n.choose_image,button:{text:wpseoMediaL10n.choose_image},multiple:!1,library:{type:"image"}});u.on("select",function(){var e=u.state().get("selection").first().toJSON();o.val(e.url),r.val(e.id)});var c=e(a);c.click(function(e){e.preventDefault(),u.open()}),c.siblings(".wpseo_image_remove_button").on("click",function(e){e.preventDefault(),o.val(""),r.val("")})})})}},[[877,0]]]);
\ No newline at end of file
(window.yoastWebpackJsonp=window.yoastWebpackJsonp||[]).push([[13],{876:function(e,t,a){"use strict";jQuery(document).ready(function(e){void 0!==wp.media&&e(".wpseo_image_upload_button").each(function(t,a){var n=function(t){var a=(t=e(t)).data("target");return a&&""!==a||(a=e(t).attr("id").replace(/_button$/,"")),a}(a),i=function(t){return(t=e(t)).data("target-id")}(a),o=e("#"+n),r=e("#"+i),u=wp.media.frames.file_frame=wp.media({title:wpseoMediaL10n.choose_image,button:{text:wpseoMediaL10n.choose_image},multiple:!1,library:{type:"image"}});u.on("select",function(){var e=u.state().get("selection").first().toJSON();o.val(e.url),r.val(e.id)});var c=e(a);c.click(function(e){e.preventDefault(),u.open()}),c.siblings(".wpseo_image_remove_button").on("click",function(e){e.preventDefault(),o.val(""),r.val("")})})})}},[[876,0]]]);
\ No newline at end of file
(window.yoastWebpackJsonp=window.yoastWebpackJsonp||[]).push([[22],{896:function(t,e,n){"use strict";!function(t,e){window.wpseoApi={get:function(t,e,n,o){this.request("GET",t,e,n,o)},post:function(t,e,n,o){this.request("POST",t,e,n,o)},put:function(t,e,n,o){this.request("PUT",t,e,n,o)},patch:function(t,e,n,o){this.request("PATCH",t,e,n,o)},delete:function(t,e,n,o){this.request("DELETE",t,e,n,o)},request:function(n,o,i,s,u){t.isFunction(i)&&void 0===u&&(u=s,s=i,i={}),"POST"!==n&&"GET"!==n&&(i._method=n,n="POST"),t.ajax({url:e.root+"yoast/v1/"+o,method:n,beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",e.nonce)},data:i}).done(s).fail(u)}}}(jQuery,wpApiSettings)}},[[896,0]]]);
\ No newline at end of file
(window.yoastWebpackJsonp=window.yoastWebpackJsonp||[]).push([[22],{895:function(t,e,n){"use strict";!function(t,e){window.wpseoApi={get:function(t,e,n,o){this.request("GET",t,e,n,o)},post:function(t,e,n,o){this.request("POST",t,e,n,o)},put:function(t,e,n,o){this.request("PUT",t,e,n,o)},patch:function(t,e,n,o){this.request("PATCH",t,e,n,o)},delete:function(t,e,n,o){this.request("DELETE",t,e,n,o)},request:function(n,o,i,s,u){t.isFunction(i)&&void 0===u&&(u=s,s=i,i={}),"POST"!==n&&"GET"!==n&&(i._method=n,n="POST"),t.ajax({url:e.root+"yoast/v1/"+o,method:n,beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",e.nonce)},data:i}).done(s).fail(u)}}}(jQuery,wpApiSettings)}},[[895,0]]]);
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment