Version Description
Download this release
Release Info
Developer | Yoast |
Plugin | Yoast SEO |
Version | 12.6 |
Comparing to | |
See all releases |
Code changes from version 12.5.1 to 12.6
- admin/class-admin-asset-manager.php +15 -14
- admin/class-admin-banner.php +1 -0
- admin/class-admin-help-panel.php +7 -5
- admin/class-admin.php +42 -2
- admin/class-config.php +0 -1
- admin/class-gutenberg-compatibility.php +2 -2
- admin/class-help-center-item.php +0 -112
- admin/class-help-center.php +0 -237
- admin/class-helpscout.php +263 -0
- admin/class-option-tab.php +0 -9
- admin/class-option-tabs-formatter.php +0 -4
- admin/formatter/class-post-metabox-formatter.php +9 -1
- admin/help_center/class-template-variables-tab.php +0 -99
- admin/menu/class-replacevar-editor.php +1 -1
- admin/metabox/class-metabox.php +79 -36
- admin/onpage/class-ryte-service.php +1 -1
- admin/pages/dashboard.php +2 -5
- admin/pages/metas.php +6 -9
- admin/pages/network.php +1 -1
- admin/pages/social.php +4 -4
- admin/taxonomy/class-taxonomy.php +34 -5
- admin/views/tool-bulk-editor.php +0 -27
- admin/views/tool-file-editor.php +0 -11
- admin/views/tool-import-export.php +3 -26
- config/composer/actions.php +9 -5
- css/dist/admin-global-1251-rtl.min.css +0 -1
- css/dist/admin-global-1251.min.css +0 -1
- css/dist/admin-global-1260-rtl.min.css +1 -0
- css/dist/admin-global-1260.min.css +1 -0
- css/dist/{adminbar-1251-rtl.min.css → adminbar-1260-rtl.min.css} +0 -0
- css/dist/{adminbar-1251.min.css → adminbar-1260.min.css} +0 -0
- css/dist/{alerts-1251-rtl.min.css → alerts-1260-rtl.min.css} +0 -0
- css/dist/{alerts-1251.min.css → alerts-1260.min.css} +0 -0
- css/dist/{dashboard-1251-rtl.min.css → dashboard-1260-rtl.min.css} +0 -0
- css/dist/{dashboard-1251.min.css → dashboard-1260.min.css} +0 -0
- css/dist/{edit-page-1251-rtl.min.css → edit-page-1260-rtl.min.css} +0 -0
- css/dist/{edit-page-1251.min.css → edit-page-1260.min.css} +0 -0
- css/dist/{featured-image-1251-rtl.min.css → featured-image-1260-rtl.min.css} +0 -0
- css/dist/{featured-image-1251.min.css → featured-image-1260.min.css} +0 -0
- css/dist/{filter-explanation-1251-rtl.min.css → filter-explanation-1260-rtl.min.css} +0 -0
- css/dist/{filter-explanation-1251.min.css → filter-explanation-1260.min.css} +0 -0
- css/dist/{inside-editor-1251-rtl.min.css → inside-editor-1260-rtl.min.css} +0 -0
- css/dist/{inside-editor-1251.min.css → inside-editor-1260.min.css} +0 -0
- css/dist/{metabox-1251-rtl.min.css → metabox-1260-rtl.min.css} +0 -0
- css/dist/{metabox-1251.min.css → metabox-1260.min.css} +0 -0
- css/dist/{metabox-primary-category-1251-rtl.min.css → metabox-primary-category-1260-rtl.min.css} +0 -0
- css/dist/{metabox-primary-category-1251.min.css → metabox-primary-category-1260.min.css} +0 -0
- css/dist/{search-appearance-1251-rtl.min.css → search-appearance-1260-rtl.min.css} +0 -0
- css/dist/{search-appearance-1251.min.css → search-appearance-1260.min.css} +0 -0
- css/dist/{structured-data-blocks-1251-rtl.min.css → structured-data-blocks-1260-rtl.min.css} +0 -0
- css/dist/{structured-data-blocks-1251.min.css → structured-data-blocks-1260.min.css} +0 -0
- css/dist/{toggle-switch-1251-rtl.min.css → toggle-switch-1260-rtl.min.css} +0 -0
- css/dist/{toggle-switch-1251.min.css → toggle-switch-1260.min.css} +0 -0
- css/dist/{wpseo-dismissible-1251-rtl.min.css → wpseo-dismissible-1260-rtl.min.css} +0 -0
- css/dist/{wpseo-dismissible-1251.min.css → wpseo-dismissible-1260.min.css} +0 -0
- css/dist/{yoast-components-1251-rtl.min.css → yoast-components-1260-rtl.min.css} +0 -0
- css/dist/{yoast-components-1251.min.css → yoast-components-1260.min.css} +0 -0
- css/dist/{yoast-extensions-1251-rtl.min.css → yoast-extensions-1260-rtl.min.css} +0 -0
- css/dist/{yoast-extensions-1251.min.css → yoast-extensions-1260.min.css} +0 -0
- css/dist/{yst_plugin_tools-1251-rtl.min.css → yst_plugin_tools-1260-rtl.min.css} +0 -0
- css/dist/{yst_plugin_tools-1251.min.css → yst_plugin_tools-1260.min.css} +0 -0
- css/dist/{yst_seo_score-1251-rtl.min.css → yst_seo_score-1260-rtl.min.css} +0 -0
- css/dist/{yst_seo_score-1251.min.css → yst_seo_score-1260.min.css} +0 -0
- deprecated/admin/google-search-console/class-gsc-settings.php +0 -1
- frontend/class-breadcrumbs.php +10 -10
- frontend/class-frontend.php +2 -1
- frontend/class-opengraph.php +12 -3
- frontend/schema/class-schema-article.php +11 -3
- frontend/schema/class-schema-context.php +11 -2
- frontend/schema/class-schema-webpage.php +10 -2
- frontend/schema/class-schema-website.php +4 -0
- inc/class-my-yoast-api-request.php +1 -1
- inc/class-wpseo-image-utils.php +3 -2
- inc/class-wpseo-meta.php +12 -39
- inc/class-wpseo-replace-vars.php +12 -60
- inc/date-helper.php +40 -0
- js/dist/analysis-1251.min.js +0 -21
admin/class-admin-asset-manager.php
CHANGED
@@ -330,10 +330,11 @@ class WPSEO_Admin_Asset_Manager {
|
|
330 |
|
331 |
return array(
|
332 |
array(
|
333 |
-
'name'
|
334 |
// Load webpack-commons for bundle support.
|
335 |
-
'src'
|
336 |
-
'
|
|
|
337 |
'wp-polyfill',
|
338 |
),
|
339 |
),
|
@@ -357,17 +358,6 @@ class WPSEO_Admin_Asset_Manager {
|
|
357 |
self::PREFIX . 'commons',
|
358 |
),
|
359 |
),
|
360 |
-
array(
|
361 |
-
'name' => 'help-center',
|
362 |
-
'src' => 'wp-seo-help-center-' . $flat_version,
|
363 |
-
'deps' => array(
|
364 |
-
'jquery',
|
365 |
-
'wp-element',
|
366 |
-
'wp-i18n',
|
367 |
-
self::PREFIX . 'components',
|
368 |
-
self::PREFIX . 'commons',
|
369 |
-
),
|
370 |
-
),
|
371 |
array(
|
372 |
'name' => 'admin-script',
|
373 |
'src' => 'wp-seo-admin-' . $flat_version,
|
@@ -650,6 +640,16 @@ class WPSEO_Admin_Asset_Manager {
|
|
650 |
'wp-element',
|
651 |
),
|
652 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
653 |
);
|
654 |
}
|
655 |
|
@@ -694,6 +694,7 @@ class WPSEO_Admin_Asset_Manager {
|
|
694 |
'src' => 'metabox-' . $flat_version,
|
695 |
'deps' => array(
|
696 |
self::PREFIX . 'select2',
|
|
|
697 |
),
|
698 |
),
|
699 |
array(
|
330 |
|
331 |
return array(
|
332 |
array(
|
333 |
+
'name' => 'commons',
|
334 |
// Load webpack-commons for bundle support.
|
335 |
+
'src' => 'commons-' . $flat_version,
|
336 |
+
'in_footer' => false,
|
337 |
+
'deps' => array(
|
338 |
'wp-polyfill',
|
339 |
),
|
340 |
),
|
358 |
self::PREFIX . 'commons',
|
359 |
),
|
360 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
array(
|
362 |
'name' => 'admin-script',
|
363 |
'src' => 'wp-seo-admin-' . $flat_version,
|
640 |
'wp-element',
|
641 |
),
|
642 |
),
|
643 |
+
array(
|
644 |
+
'name' => 'help-scout-beacon',
|
645 |
+
'src' => 'help-scout-beacon-' . $flat_version,
|
646 |
+
'in_footer' => false,
|
647 |
+
'deps' => array(
|
648 |
+
self::PREFIX . 'styled-components',
|
649 |
+
'wp-element',
|
650 |
+
'wp-i18n',
|
651 |
+
),
|
652 |
+
),
|
653 |
);
|
654 |
}
|
655 |
|
694 |
'src' => 'metabox-' . $flat_version,
|
695 |
'deps' => array(
|
696 |
self::PREFIX . 'select2',
|
697 |
+
self::PREFIX . 'admin-css',
|
698 |
),
|
699 |
),
|
700 |
array(
|
admin/class-admin-banner.php
CHANGED
@@ -9,6 +9,7 @@
|
|
9 |
* Class WPSEO_Admin_Banner.
|
10 |
*/
|
11 |
class WPSEO_Admin_Banner implements WPSEO_WordPress_Integration {
|
|
|
12 |
/**
|
13 |
* Registers all hooks to WordPress.
|
14 |
*
|
9 |
* Class WPSEO_Admin_Banner.
|
10 |
*/
|
11 |
class WPSEO_Admin_Banner implements WPSEO_WordPress_Integration {
|
12 |
+
|
13 |
/**
|
14 |
* Registers all hooks to WordPress.
|
15 |
*
|
admin/class-admin-help-panel.php
CHANGED
@@ -41,11 +41,13 @@ class WPSEO_Admin_Help_Panel {
|
|
41 |
/**
|
42 |
* Constructor.
|
43 |
*
|
44 |
-
* @param string $id
|
45 |
-
*
|
46 |
-
* @param string $
|
47 |
-
* @param string $
|
48 |
-
*
|
|
|
|
|
49 |
*/
|
50 |
public function __construct( $id, $help_button_text, $help_content, $wrapper = '' ) {
|
51 |
$this->id = $id;
|
41 |
/**
|
42 |
* Constructor.
|
43 |
*
|
44 |
+
* @param string $id Unique identifier of the element the inline help refers to, used as
|
45 |
+
* an identifier in the html.
|
46 |
+
* @param string $help_button_text The Help Button text. Needs a properly escaped string.
|
47 |
+
* @param string $help_content The Help Panel content. Needs a properly escaped string (might contain HTML).
|
48 |
+
* @param string $wrapper Optional Whether to print out a container div element for the Help Panel,
|
49 |
+
* used for styling.
|
50 |
+
* Pass a `has-wrapper` value to print out the container. Default: no container.
|
51 |
*/
|
52 |
public function __construct( $id, $help_button_text, $help_content, $wrapper = '' ) {
|
53 |
$this->id = $id;
|
admin/class-admin.php
CHANGED
@@ -113,6 +113,7 @@ class WPSEO_Admin {
|
|
113 |
$integrations[] = new WPSEO_Tracking( 'https://tracking.yoast.com/stats', ( WEEK_IN_SECONDS * 2 ) );
|
114 |
$integrations[] = new WPSEO_Admin_Settings_Changed_Listener();
|
115 |
$integrations[] = new WPSEO_Admin_Banner();
|
|
|
116 |
|
117 |
$integrations = array_merge(
|
118 |
$integrations,
|
@@ -303,8 +304,12 @@ class WPSEO_Admin {
|
|
303 |
*/
|
304 |
private function localize_admin_global_script() {
|
305 |
return array(
|
306 |
-
/* translators: %s: '%%term_title%%' variable used in titles and meta's template that's not compatible with the given template */
|
307 |
-
'variable_warning' => sprintf(
|
|
|
|
|
|
|
|
|
308 |
'dismiss_about_url' => $this->get_dismiss_url( 'wpseo-dismiss-about' ),
|
309 |
'dismiss_tagline_url' => $this->get_dismiss_url( 'wpseo-dismiss-tagline-notice' ),
|
310 |
/* translators: %s: expends to Yoast SEO */
|
@@ -417,6 +422,41 @@ class WPSEO_Admin {
|
|
417 |
return $integrations;
|
418 |
}
|
419 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
420 |
/* ********************* DEPRECATED METHODS ********************* */
|
421 |
|
422 |
/**
|
113 |
$integrations[] = new WPSEO_Tracking( 'https://tracking.yoast.com/stats', ( WEEK_IN_SECONDS * 2 ) );
|
114 |
$integrations[] = new WPSEO_Admin_Settings_Changed_Listener();
|
115 |
$integrations[] = new WPSEO_Admin_Banner();
|
116 |
+
$integrations[] = $this->get_helpscout_beacon();
|
117 |
|
118 |
$integrations = array_merge(
|
119 |
$integrations,
|
304 |
*/
|
305 |
private function localize_admin_global_script() {
|
306 |
return array(
|
307 |
+
/* 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' */
|
308 |
+
'variable_warning' => sprintf(
|
309 |
+
__( 'Warning: the variable %1$s cannot be used in this template. See the %2$s for more info.', 'wordpress-seo' ),
|
310 |
+
'<code>%s</code>',
|
311 |
+
'HelpScout beacon'
|
312 |
+
),
|
313 |
'dismiss_about_url' => $this->get_dismiss_url( 'wpseo-dismiss-about' ),
|
314 |
'dismiss_tagline_url' => $this->get_dismiss_url( 'wpseo-dismiss-tagline-notice' ),
|
315 |
/* translators: %s: expends to Yoast SEO */
|
422 |
return $integrations;
|
423 |
}
|
424 |
|
425 |
+
/**
|
426 |
+
* Retrieves an instance of the HelpScout beacon class for Yoast SEO.
|
427 |
+
*
|
428 |
+
* @return WPSEO_HelpScout The instance of the HelpScout beacon.
|
429 |
+
*/
|
430 |
+
private function get_helpscout_beacon() {
|
431 |
+
$helpscout_settings = array(
|
432 |
+
'beacon_id' => '2496aba6-0292-489c-8f5d-1c0fba417c2f',
|
433 |
+
'pages' => array(
|
434 |
+
'wpseo_dashboard',
|
435 |
+
'wpseo_titles',
|
436 |
+
'wpseo_search_console',
|
437 |
+
'wpseo_social',
|
438 |
+
'wpseo_tools',
|
439 |
+
'wpseo_licenses',
|
440 |
+
),
|
441 |
+
'products' => array(),
|
442 |
+
'ask_consent' => true,
|
443 |
+
);
|
444 |
+
|
445 |
+
/**
|
446 |
+
* Filter: 'wpseo_helpscout_beacon_settings' - Allows overriding the HelpScout beacon settings.
|
447 |
+
*
|
448 |
+
* @api string - The helpscout beacons settings.
|
449 |
+
*/
|
450 |
+
$helpscout_settings = apply_filters( 'wpseo_helpscout_beacon_settings', $helpscout_settings );
|
451 |
+
|
452 |
+
return new WPSEO_HelpScout(
|
453 |
+
$helpscout_settings['beacon_id'],
|
454 |
+
$helpscout_settings['pages'],
|
455 |
+
$helpscout_settings['products'],
|
456 |
+
$helpscout_settings['ask_consent']
|
457 |
+
);
|
458 |
+
}
|
459 |
+
|
460 |
/* ********************* DEPRECATED METHODS ********************* */
|
461 |
|
462 |
/**
|
admin/class-config.php
CHANGED
@@ -65,7 +65,6 @@ class WPSEO_Admin_Pages {
|
|
65 |
*/
|
66 |
public function config_page_scripts() {
|
67 |
$this->asset_manager->enqueue_script( 'admin-script' );
|
68 |
-
$this->asset_manager->enqueue_script( 'help-center' );
|
69 |
|
70 |
$page = filter_input( INPUT_GET, 'page' );
|
71 |
|
65 |
*/
|
66 |
public function config_page_scripts() {
|
67 |
$this->asset_manager->enqueue_script( 'admin-script' );
|
|
|
68 |
|
69 |
$page = filter_input( INPUT_GET, 'page' );
|
70 |
|
admin/class-gutenberg-compatibility.php
CHANGED
@@ -15,14 +15,14 @@ class WPSEO_Gutenberg_Compatibility {
|
|
15 |
*
|
16 |
* @var string
|
17 |
*/
|
18 |
-
const CURRENT_RELEASE = '6.
|
19 |
|
20 |
/**
|
21 |
* The minimally supported version of Gutenberg by the plugin.
|
22 |
*
|
23 |
* @var string
|
24 |
*/
|
25 |
-
const MINIMUM_SUPPORTED = '6.
|
26 |
|
27 |
/**
|
28 |
* Holds the current version.
|
15 |
*
|
16 |
* @var string
|
17 |
*/
|
18 |
+
const CURRENT_RELEASE = '6.9.0';
|
19 |
|
20 |
/**
|
21 |
* The minimally supported version of Gutenberg by the plugin.
|
22 |
*
|
23 |
* @var string
|
24 |
*/
|
25 |
+
const MINIMUM_SUPPORTED = '6.9.0';
|
26 |
|
27 |
/**
|
28 |
* Holds the current version.
|
admin/class-help-center-item.php
DELETED
@@ -1,112 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* WPSEO plugin file.
|
4 |
-
*
|
5 |
-
* @package WPSEO\Admin\Options\Tabs
|
6 |
-
*/
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Class WPSEO_Help_Center_Item.
|
10 |
-
*/
|
11 |
-
class WPSEO_Help_Center_Item {
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Identifier for this tab.
|
15 |
-
*
|
16 |
-
* @var string
|
17 |
-
*/
|
18 |
-
private $identifier;
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Label to display.
|
22 |
-
*
|
23 |
-
* @var string
|
24 |
-
*/
|
25 |
-
private $label;
|
26 |
-
|
27 |
-
/**
|
28 |
-
* The dashicon classname to display in front of the label.
|
29 |
-
*
|
30 |
-
* @var string
|
31 |
-
*/
|
32 |
-
private $dashicon;
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Optional arguments.
|
36 |
-
*
|
37 |
-
* @var array
|
38 |
-
*/
|
39 |
-
private $args = array();
|
40 |
-
|
41 |
-
/**
|
42 |
-
* WPSEO_Help_Center_Item constructor.
|
43 |
-
*
|
44 |
-
* @param string $identifier Unique identifier for this tab.
|
45 |
-
* @param string $label Label to display.
|
46 |
-
* @param array $args Optional. Settings for this tab.
|
47 |
-
* @param string $dashicon Optional. The classname of the dahsicon to put in front of the label.
|
48 |
-
*/
|
49 |
-
public function __construct( $identifier, $label, $args = array(), $dashicon = '' ) {
|
50 |
-
$this->identifier = $identifier;
|
51 |
-
$this->label = $label;
|
52 |
-
$this->dashicon = $dashicon;
|
53 |
-
$this->args = $args;
|
54 |
-
}
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Get the label.
|
58 |
-
*
|
59 |
-
* @return string
|
60 |
-
*/
|
61 |
-
public function get_label() {
|
62 |
-
return $this->label;
|
63 |
-
}
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Get the identifier.
|
67 |
-
*
|
68 |
-
* @return string
|
69 |
-
*/
|
70 |
-
public function get_identifier() {
|
71 |
-
return $this->identifier;
|
72 |
-
}
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Get the dashicon.
|
76 |
-
*
|
77 |
-
* @return string
|
78 |
-
*/
|
79 |
-
public function get_dashicon() {
|
80 |
-
return $this->dashicon;
|
81 |
-
}
|
82 |
-
|
83 |
-
/**
|
84 |
-
* Get the content of this tab.
|
85 |
-
*
|
86 |
-
* @return mixed|string
|
87 |
-
*/
|
88 |
-
public function get_content() {
|
89 |
-
if ( ! empty( $this->args['content'] ) ) {
|
90 |
-
return $this->args['content'];
|
91 |
-
}
|
92 |
-
|
93 |
-
if ( ! empty( $this->args['callback'] ) ) {
|
94 |
-
return call_user_func_array( $this->args['callback'], array( $this ) );
|
95 |
-
}
|
96 |
-
|
97 |
-
if ( ! empty( $this->args['view'] ) ) {
|
98 |
-
$view = $this->args['view'];
|
99 |
-
if ( substr( $view, - 4 ) === '.php' ) {
|
100 |
-
$view = substr( $view, 0, - 4 );
|
101 |
-
}
|
102 |
-
|
103 |
-
if ( ! empty( $this->args['view_arguments'] ) ) {
|
104 |
-
extract( $this->args['view_arguments'] );
|
105 |
-
}
|
106 |
-
|
107 |
-
include WPSEO_PATH . 'admin/views/' . $view . '.php';
|
108 |
-
}
|
109 |
-
|
110 |
-
return '';
|
111 |
-
}
|
112 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/class-help-center.php
DELETED
@@ -1,237 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* WPSEO plugin file.
|
4 |
-
*
|
5 |
-
* @package WPSEO\Admin
|
6 |
-
*/
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Class WPSEO_Help_Center
|
10 |
-
*/
|
11 |
-
class WPSEO_Help_Center {
|
12 |
-
|
13 |
-
/**
|
14 |
-
* The tabs in the help center.
|
15 |
-
*
|
16 |
-
* @var WPSEO_Option_Tab[] $tab
|
17 |
-
*/
|
18 |
-
private $tabs;
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Mount point in the HTML.
|
22 |
-
*
|
23 |
-
* @var string
|
24 |
-
*/
|
25 |
-
private $identifier = 'yoast-help-center-container';
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Additional help center items.
|
29 |
-
*
|
30 |
-
* @var array
|
31 |
-
*/
|
32 |
-
protected $help_center_items = array();
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Show premium support tab.
|
36 |
-
*
|
37 |
-
* @var bool
|
38 |
-
*/
|
39 |
-
protected $premium_support;
|
40 |
-
|
41 |
-
/**
|
42 |
-
* WPSEO_Help_Center constructor.
|
43 |
-
*
|
44 |
-
* @param string $unused Backwards compatible argument.
|
45 |
-
* @param WPSEO_Option_Tabs|WPSEO_Option_Tab $option_tabs Currently displayed tabs.
|
46 |
-
* @param boolean $premium_support Show premium support tab.
|
47 |
-
*/
|
48 |
-
public function __construct( $unused, $option_tabs, $premium_support = false ) {
|
49 |
-
$this->premium_support = $premium_support;
|
50 |
-
|
51 |
-
$tabs = new WPSEO_Option_Tabs( '' );
|
52 |
-
|
53 |
-
if ( $option_tabs instanceof WPSEO_Option_Tabs ) {
|
54 |
-
$tabs = $option_tabs;
|
55 |
-
}
|
56 |
-
|
57 |
-
if ( $option_tabs instanceof WPSEO_Option_Tab ) {
|
58 |
-
$tabs = new WPSEO_Option_Tabs( '', $option_tabs->get_name() );
|
59 |
-
$tabs->add_tab( $option_tabs );
|
60 |
-
}
|
61 |
-
|
62 |
-
$this->tabs = $tabs;
|
63 |
-
}
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Localize data required by the help center component.
|
67 |
-
*/
|
68 |
-
public function localize_data() {
|
69 |
-
$this->add_contact_support_item();
|
70 |
-
$this->enqueue_localized_data( $this->format_data( $this->tabs->get_tabs() ) );
|
71 |
-
}
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Format the required data for localized script.
|
75 |
-
*
|
76 |
-
* @param WPSEO_Option_Tab[] $tabs Yoast admin pages navigational tabs.
|
77 |
-
*
|
78 |
-
* @return array Associative array containing data for help center component.
|
79 |
-
*/
|
80 |
-
protected function format_data( array $tabs ) {
|
81 |
-
$formatted_data = array( 'tabs' => array() );
|
82 |
-
|
83 |
-
foreach ( $tabs as $tab ) {
|
84 |
-
$formatted_data['tabs'][ $tab->get_name() ] = array(
|
85 |
-
'label' => $tab->get_label(),
|
86 |
-
'videoUrl' => $tab->get_video_url(),
|
87 |
-
'id' => $tab->get_name(),
|
88 |
-
);
|
89 |
-
}
|
90 |
-
|
91 |
-
$active_tab = $this->tabs->get_active_tab();
|
92 |
-
$active_tab = ( null === $active_tab ) ? $tabs[0] : $active_tab;
|
93 |
-
|
94 |
-
$formatted_data['mountId'] = $this->identifier;
|
95 |
-
$formatted_data['initialTab'] = $active_tab->get_name();
|
96 |
-
|
97 |
-
$is_premium = WPSEO_Utils::is_yoast_seo_premium();
|
98 |
-
|
99 |
-
// Will translate to either empty string or "1" in localised script.
|
100 |
-
$formatted_data['isPremium'] = $is_premium;
|
101 |
-
$formatted_data['pluginVersion'] = WPSEO_VERSION;
|
102 |
-
|
103 |
-
// Open HelpScout on activating this tab ID.
|
104 |
-
$formatted_data['shouldDisplayContactForm'] = $this->premium_support;
|
105 |
-
|
106 |
-
$formatted_data['videoDescriptions'] = array();
|
107 |
-
|
108 |
-
if ( $is_premium === false ) {
|
109 |
-
$formatted_data['videoDescriptions'][] = array(
|
110 |
-
'title' => __( 'Need help?', 'wordpress-seo' ),
|
111 |
-
'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' ),
|
112 |
-
'link' => WPSEO_Shortlinker::get( 'https://yoa.st/seo-premium-vt' ),
|
113 |
-
/* translators: %s expands to Yoast SEO Premium */
|
114 |
-
'linkText' => sprintf( __( 'Get %s', 'wordpress-seo' ), 'Yoast SEO Premium' ),
|
115 |
-
);
|
116 |
-
|
117 |
-
$formatted_data['videoDescriptions'][] = array(
|
118 |
-
/* translators: %s expands to Yoast SEO */
|
119 |
-
'title' => sprintf( __( 'Want to be a %s Expert?', 'wordpress-seo' ), 'Yoast SEO' ),
|
120 |
-
/* translators: %1$s expands to Yoast SEO */
|
121 |
-
'description' => sprintf( __( 'Follow our free %1$s for WordPress training and become a certified %1$s Expert!', 'wordpress-seo' ), 'Yoast SEO' ),
|
122 |
-
'link' => WPSEO_Shortlinker::get( 'https://yoa.st/wordpress-training-vt' ),
|
123 |
-
/* translators: %s expands to Yoast SEO */
|
124 |
-
'linkText' => sprintf( __( 'Enroll in the free %s for WordPress training', 'wordpress-seo' ), 'Yoast SEO' ),
|
125 |
-
);
|
126 |
-
}
|
127 |
-
|
128 |
-
$formatted_data['contactSupportParagraphs'] = array(
|
129 |
-
array(
|
130 |
-
'image' => array(
|
131 |
-
'src' => esc_url( plugin_dir_url( WPSEO_FILE ) . 'images/support-team.svg' ),
|
132 |
-
'width' => 100,
|
133 |
-
'height' => 100,
|
134 |
-
'alt' => '',
|
135 |
-
),
|
136 |
-
'content' => null,
|
137 |
-
),
|
138 |
-
array(
|
139 |
-
'image' => null,
|
140 |
-
'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' ),
|
141 |
-
),
|
142 |
-
array(
|
143 |
-
'image' => null,
|
144 |
-
'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' ),
|
145 |
-
),
|
146 |
-
);
|
147 |
-
|
148 |
-
$formatted_data['extraTabs'] = $this->get_extra_tabs();
|
149 |
-
|
150 |
-
return $formatted_data;
|
151 |
-
}
|
152 |
-
|
153 |
-
/**
|
154 |
-
* Get additional tabs for the help center component.
|
155 |
-
*
|
156 |
-
* @return array Additional help center tabs.
|
157 |
-
*/
|
158 |
-
protected function get_extra_tabs() {
|
159 |
-
$help_center_items = apply_filters( 'wpseo_help_center_items', $this->help_center_items );
|
160 |
-
|
161 |
-
return array_map( array( $this, 'format_helpcenter_tab' ), $help_center_items );
|
162 |
-
}
|
163 |
-
|
164 |
-
/**
|
165 |
-
* Convert WPSEO_Help_Center_Item into help center format.
|
166 |
-
*
|
167 |
-
* @param WPSEO_Help_Center_Item $item The item to convert.
|
168 |
-
*
|
169 |
-
* @return array Formatted item.
|
170 |
-
*/
|
171 |
-
protected function format_helpcenter_tab( WPSEO_Help_Center_Item $item ) {
|
172 |
-
return array(
|
173 |
-
'identifier' => $item->get_identifier(),
|
174 |
-
'label' => $item->get_label(),
|
175 |
-
'content' => $item->get_content(),
|
176 |
-
);
|
177 |
-
}
|
178 |
-
|
179 |
-
/**
|
180 |
-
* Enqueue localized script for help center component.
|
181 |
-
*
|
182 |
-
* @param array $data Data to localize.
|
183 |
-
*/
|
184 |
-
protected function enqueue_localized_data( $data ) {
|
185 |
-
wp_localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'help-center', 'wpseoHelpCenterData', $data );
|
186 |
-
|
187 |
-
$yoast_components_l10n = new WPSEO_Admin_Asset_Yoast_Components_L10n();
|
188 |
-
$yoast_components_l10n->localize_script( WPSEO_Admin_Asset_Manager::PREFIX . 'help-center' );
|
189 |
-
}
|
190 |
-
|
191 |
-
/**
|
192 |
-
* Outputs the help center div.
|
193 |
-
*/
|
194 |
-
public function mount() {
|
195 |
-
echo '<div id="' . esc_attr( $this->identifier ) . '">' . esc_html__( 'Loading help center.', 'wordpress-seo' ) . '</div>';
|
196 |
-
}
|
197 |
-
|
198 |
-
/**
|
199 |
-
* Add the contact support help center item to the help center.
|
200 |
-
*/
|
201 |
-
private function add_contact_support_item() {
|
202 |
-
/* translators: %s: expands to 'Yoast SEO Premium'. */
|
203 |
-
$popup_title = sprintf( __( 'Email support is a %s feature', 'wordpress-seo' ), 'Yoast SEO Premium' );
|
204 |
-
$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>';
|
205 |
-
/* translators: %s: expands to 'Yoast SEO Premium'. */
|
206 |
-
$popup_content .= '<p>' . sprintf( __( 'Other benefits of %s for you:', 'wordpress-seo' ), 'Yoast SEO Premium' ) . '</p>';
|
207 |
-
$popup_content .= '<ul class="wpseo-premium-advantages-list">';
|
208 |
-
$popup_content .= '<li>' . sprintf(
|
209 |
-
// 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.
|
210 |
-
/* translators: %1$s expands to a 'strong' start tag, %2$s to a 'strong' end tag. */
|
211 |
-
__( '%1$sNo more dead links%2$s: easy redirect manager', 'wordpress-seo' ),
|
212 |
-
'',
|
213 |
-
''
|
214 |
-
) . '</li>';
|
215 |
-
$popup_content .= '<li>' . __( 'Superfast internal linking suggestions', 'wordpress-seo' ) . '</li>';
|
216 |
-
$popup_content .= '<li>' . sprintf(
|
217 |
-
// 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.
|
218 |
-
/* translators: %1$s expands to a 'strong' start tag, %2$s to a 'strong' end tag. */
|
219 |
-
__( '%1$sSocial media preview%2$s: Facebook & Twitter', 'wordpress-seo' ),
|
220 |
-
'',
|
221 |
-
''
|
222 |
-
) . '</li>';
|
223 |
-
$popup_content .= '<li>' . __( '24/7 email support', 'wordpress-seo' ) . '</li>';
|
224 |
-
$popup_content .= '<li>' . __( 'No ads!', 'wordpress-seo' ) . '</li>';
|
225 |
-
$popup_content .= '</ul>';
|
226 |
-
|
227 |
-
$premium_popup = new WPSEO_Premium_Popup( 'contact-support', 'h2', $popup_title, $popup_content, WPSEO_Shortlinker::get( 'https://yoa.st/contact-support' ) );
|
228 |
-
$contact_support_help_center_item = new WPSEO_Help_Center_Item(
|
229 |
-
'contact-support',
|
230 |
-
__( 'Get support', 'wordpress-seo' ),
|
231 |
-
array( 'content' => $premium_popup->get_premium_message( false ) ),
|
232 |
-
'dashicons-email-alt'
|
233 |
-
);
|
234 |
-
|
235 |
-
$this->help_center_items[] = $contact_support_help_center_item;
|
236 |
-
}
|
237 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/class-helpscout.php
ADDED
@@ -0,0 +1,263 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WPSEO plugin file.
|
4 |
+
*
|
5 |
+
* @package WPSEO\Admin
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Class WPSEO_HelpScout
|
10 |
+
*/
|
11 |
+
class WPSEO_HelpScout implements WPSEO_WordPress_Integration {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* The id for the beacon.
|
15 |
+
*
|
16 |
+
* @var string
|
17 |
+
*/
|
18 |
+
protected $beacon_id;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* The pages where the beacon is loaded.
|
22 |
+
*
|
23 |
+
* @var array
|
24 |
+
*/
|
25 |
+
protected $pages;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* The products the beacon is loaded for.
|
29 |
+
*
|
30 |
+
* @var array
|
31 |
+
*/
|
32 |
+
protected $products;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Whether to asks the user's consent before loading in HelpScout.
|
36 |
+
*
|
37 |
+
* @var bool
|
38 |
+
*/
|
39 |
+
protected $ask_consent;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* WPSEO_HelpScout constructor.
|
43 |
+
*
|
44 |
+
* @param string $beacon_id The beacon id.
|
45 |
+
* @param array $pages The pages where the beacon is loaded.
|
46 |
+
* @param array $products The products the beacon is loaded for.
|
47 |
+
* @param bool $ask_consent Optional. Whether to ask for consent before loading in HelpScout.
|
48 |
+
*/
|
49 |
+
public function __construct( $beacon_id, array $pages, array $products, $ask_consent = false ) {
|
50 |
+
$this->beacon_id = $beacon_id;
|
51 |
+
$this->pages = $pages;
|
52 |
+
$this->products = $products;
|
53 |
+
$this->ask_consent = $ask_consent;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* @inheritDoc
|
58 |
+
*/
|
59 |
+
public function register_hooks() {
|
60 |
+
if ( ! $this->is_beacon_page() ) {
|
61 |
+
return;
|
62 |
+
}
|
63 |
+
|
64 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_help_scout_script' ) );
|
65 |
+
add_action( 'admin_footer', array( $this, 'output_beacon_js' ) );
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Enqueues the HelpScout script.
|
70 |
+
*/
|
71 |
+
public function enqueue_help_scout_script() {
|
72 |
+
$asset_manager = new WPSEO_Admin_Asset_Manager();
|
73 |
+
$asset_manager->enqueue_script( 'help-scout-beacon' );
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Outputs a small piece of javascript for the beacon.
|
78 |
+
*/
|
79 |
+
public function output_beacon_js() {
|
80 |
+
printf(
|
81 |
+
'<script type="text/javascript">window.%1$s(\'%2$s\', %3$s)</script>',
|
82 |
+
( $this->ask_consent ) ? 'wpseoHelpScoutBeaconConsent' : 'wpseoHelpScoutBeacon',
|
83 |
+
esc_html( $this->beacon_id ),
|
84 |
+
wp_json_encode( $this->get_session_data() )
|
85 |
+
);
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Checks if the current page is a page containing the beacon.
|
90 |
+
*/
|
91 |
+
private function is_beacon_page() {
|
92 |
+
return in_array( $this->get_current_page(), $this->pages, true );
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Retrieves the value of the current page.
|
97 |
+
*
|
98 |
+
* @return string The current page.
|
99 |
+
*/
|
100 |
+
private function get_current_page() {
|
101 |
+
$page = filter_input( INPUT_GET, 'page' );
|
102 |
+
if ( isset( $page ) && $page !== false ) {
|
103 |
+
return $page;
|
104 |
+
}
|
105 |
+
|
106 |
+
return '';
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Retrieves the identifying data.
|
111 |
+
*
|
112 |
+
* @return string The data to pass as identifying data.
|
113 |
+
*/
|
114 |
+
protected function get_session_data() {
|
115 |
+
/** @noinspection PhpUnusedLocalVariableInspection */
|
116 |
+
// Do not make these strings translatable! They are for our support agents, the user won't see them!
|
117 |
+
$current_user = wp_get_current_user();
|
118 |
+
|
119 |
+
$data = array(
|
120 |
+
'name' => trim( $current_user->user_firstname . ' ' . $current_user->user_lastname ),
|
121 |
+
'email' => $current_user->user_email,
|
122 |
+
'WordPress Version' => $this->get_wordpress_version(),
|
123 |
+
'Server' => $this->get_server_info(),
|
124 |
+
'<a href="' . admin_url( 'themes.php' ) . '">Theme</a>' => $this->get_theme_info(),
|
125 |
+
'<a href="' . admin_url( 'plugins.php' ) . '">Plugins</a>' => $this->get_active_plugins(),
|
126 |
+
);
|
127 |
+
|
128 |
+
if ( ! empty( $this->products ) ) {
|
129 |
+
$addon_manager = new WPSEO_Addon_Manager();
|
130 |
+
foreach ( $this->products as $product ) {
|
131 |
+
$subscription = $addon_manager->get_subscription( $product );
|
132 |
+
|
133 |
+
if ( ! $subscription ) {
|
134 |
+
continue;
|
135 |
+
}
|
136 |
+
|
137 |
+
$data[ $subscription->product->name ] = $this->get_product_info( $subscription );
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
return wp_json_encode( $data );
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Returns basic info about the server software.
|
146 |
+
*
|
147 |
+
* @return string
|
148 |
+
*/
|
149 |
+
private function get_server_info() {
|
150 |
+
$server_tracking_data = new WPSEO_Tracking_Server_Data();
|
151 |
+
$server_data = $server_tracking_data->get();
|
152 |
+
$server_data = $server_data['server'];
|
153 |
+
|
154 |
+
$fields_to_use = array(
|
155 |
+
'IP' => 'ip',
|
156 |
+
'Hostname' => 'Hostname',
|
157 |
+
'OS' => 'os',
|
158 |
+
'PHP' => 'PhpVersion',
|
159 |
+
'CURL' => 'CurlVersion',
|
160 |
+
);
|
161 |
+
|
162 |
+
$server_data['CurlVersion'] = $server_data['CurlVersion']['version'] . '(SSL Support' . $server_data['CurlVersion']['sslSupport'] . ')';
|
163 |
+
|
164 |
+
$server_info = '<table>';
|
165 |
+
|
166 |
+
foreach ( $fields_to_use as $label => $field_to_use ) {
|
167 |
+
if ( isset( $server_data[ $field_to_use ] ) ) {
|
168 |
+
$server_info .= sprintf( '<tr><td>%1$s</td><td>%2$s</td></tr>', esc_html( $label ), esc_html( $server_data[ $field_to_use ] ) );
|
169 |
+
}
|
170 |
+
}
|
171 |
+
|
172 |
+
$server_info .= '</table>';
|
173 |
+
|
174 |
+
return $server_info;
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Returns info about the Yoast SEO plugin version and license.
|
179 |
+
*
|
180 |
+
* @param object $plugin The plugin.
|
181 |
+
*
|
182 |
+
* @return string The product info.
|
183 |
+
*/
|
184 |
+
private function get_product_info( $plugin ) {
|
185 |
+
if ( empty( $plugin ) ) {
|
186 |
+
return '';
|
187 |
+
}
|
188 |
+
|
189 |
+
$product_info = '<table>';
|
190 |
+
$product_info .= '<tr><td>Version</td><td>' . $plugin->product->version . '</td></tr>';
|
191 |
+
$product_info .= '<tr><td>Expiration date</td><td>' . $plugin->expiry_date . '</td></tr>';
|
192 |
+
$product_info .= '</table>';
|
193 |
+
|
194 |
+
return $product_info;
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Returns the WordPress version + a suffix if current WP is multi site.
|
199 |
+
*
|
200 |
+
* @return string The WordPress version string.
|
201 |
+
*/
|
202 |
+
private function get_wordpress_version() {
|
203 |
+
global $wp_version;
|
204 |
+
|
205 |
+
$wordpress_version = $wp_version;
|
206 |
+
if ( is_multisite() ) {
|
207 |
+
$wordpress_version .= ' MULTI-SITE';
|
208 |
+
}
|
209 |
+
|
210 |
+
return $wordpress_version;
|
211 |
+
}
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Returns a formatted HTML string for the current theme.
|
215 |
+
*
|
216 |
+
* @return string The theme info as string.
|
217 |
+
*/
|
218 |
+
private function get_theme_info() {
|
219 |
+
$theme = wp_get_theme();
|
220 |
+
|
221 |
+
$theme_info = sprintf(
|
222 |
+
'<a href="%1$s">%2$s</a> v%3$s by %4$s',
|
223 |
+
esc_attr( $theme->display( 'ThemeURI' ) ),
|
224 |
+
esc_html( $theme->display( 'Name' ) ),
|
225 |
+
esc_html( $theme->display( 'Version' ) ),
|
226 |
+
esc_html( $theme->display( 'Author' ) )
|
227 |
+
);
|
228 |
+
|
229 |
+
if ( is_child_theme() ) {
|
230 |
+
$theme_info .= sprintf( '<br />Child theme of: %1$s', esc_html( $theme->display( 'Template' ) ) );
|
231 |
+
}
|
232 |
+
|
233 |
+
return $theme_info;
|
234 |
+
}
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Returns a formatted HTML list of all active plugins.
|
238 |
+
*
|
239 |
+
* @return string The active plugins.
|
240 |
+
*/
|
241 |
+
private function get_active_plugins() {
|
242 |
+
$updates_available = get_site_transient( 'update_plugins' );
|
243 |
+
|
244 |
+
$active_plugins = '';
|
245 |
+
foreach ( wp_get_active_and_valid_plugins() as $plugin ) {
|
246 |
+
$plugin_data = get_plugin_data( $plugin );
|
247 |
+
$plugin_file = str_replace( trailingslashit( WP_PLUGIN_DIR ), '', $plugin );
|
248 |
+
|
249 |
+
if ( isset( $updates_available->response[ $plugin_file ] ) ) {
|
250 |
+
$active_plugins .= '<i class="icon-close1"></i> ';
|
251 |
+
}
|
252 |
+
|
253 |
+
$active_plugins .= sprintf(
|
254 |
+
'<a href="%1$s">%2$s</a> v%3$s',
|
255 |
+
esc_attr( $plugin_data['PluginURI'] ),
|
256 |
+
esc_html( $plugin_data['Name'] ),
|
257 |
+
esc_html( $plugin_data['Version'] )
|
258 |
+
);
|
259 |
+
}
|
260 |
+
|
261 |
+
return $active_plugins;
|
262 |
+
}
|
263 |
+
}
|
admin/class-option-tab.php
CHANGED
@@ -62,15 +62,6 @@ class WPSEO_Option_Tab {
|
|
62 |
return $this->label;
|
63 |
}
|
64 |
|
65 |
-
/**
|
66 |
-
* Gets the video URL.
|
67 |
-
*
|
68 |
-
* @return string The video url.
|
69 |
-
*/
|
70 |
-
public function get_video_url() {
|
71 |
-
return $this->get_argument( 'video_url' );
|
72 |
-
}
|
73 |
-
|
74 |
/**
|
75 |
* Retrieves whether the tab needs a save button.
|
76 |
*
|
62 |
return $this->label;
|
63 |
}
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
/**
|
66 |
* Retrieves whether the tab needs a save button.
|
67 |
*
|
admin/class-option-tabs-formatter.php
CHANGED
@@ -40,10 +40,6 @@ class WPSEO_Option_Tabs_Formatter {
|
|
40 |
}
|
41 |
echo '</h2>';
|
42 |
|
43 |
-
$help_center = new WPSEO_Help_Center( '', $option_tabs, WPSEO_Utils::is_yoast_seo_premium() );
|
44 |
-
$help_center->localize_data();
|
45 |
-
$help_center->mount();
|
46 |
-
|
47 |
foreach ( $option_tabs->get_tabs() as $tab ) {
|
48 |
$identifier = $tab->get_name();
|
49 |
|
40 |
}
|
41 |
echo '</h2>';
|
42 |
|
|
|
|
|
|
|
|
|
43 |
foreach ( $option_tabs->get_tabs() as $tab ) {
|
44 |
$identifier = $tab->get_name();
|
45 |
|
admin/formatter/class-post-metabox-formatter.php
CHANGED
@@ -24,6 +24,13 @@ class WPSEO_Post_Metabox_Formatter implements WPSEO_Metabox_Formatter_Interface
|
|
24 |
*/
|
25 |
private $permalink;
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
/**
|
28 |
* Constructor.
|
29 |
*
|
@@ -34,6 +41,7 @@ class WPSEO_Post_Metabox_Formatter implements WPSEO_Metabox_Formatter_Interface
|
|
34 |
public function __construct( $post, array $options, $structure ) {
|
35 |
$this->post = $post;
|
36 |
$this->permalink = $structure;
|
|
|
37 |
}
|
38 |
|
39 |
/**
|
@@ -222,7 +230,7 @@ class WPSEO_Post_Metabox_Formatter implements WPSEO_Metabox_Formatter_Interface
|
|
222 |
$date = '';
|
223 |
|
224 |
if ( $this->is_show_date_enabled() ) {
|
225 |
-
$date =
|
226 |
}
|
227 |
|
228 |
return $date;
|
24 |
*/
|
25 |
private $permalink;
|
26 |
|
27 |
+
/**
|
28 |
+
* The date helper.
|
29 |
+
*
|
30 |
+
* @var Date_Helper
|
31 |
+
*/
|
32 |
+
protected $date;
|
33 |
+
|
34 |
/**
|
35 |
* Constructor.
|
36 |
*
|
41 |
public function __construct( $post, array $options, $structure ) {
|
42 |
$this->post = $post;
|
43 |
$this->permalink = $structure;
|
44 |
+
$this->date = new Date_Helper();
|
45 |
}
|
46 |
|
47 |
/**
|
230 |
$date = '';
|
231 |
|
232 |
if ( $this->is_show_date_enabled() ) {
|
233 |
+
$date = $this->date->format_translated( $this->post->post_date, 'M j, Y' );
|
234 |
}
|
235 |
|
236 |
return $date;
|
admin/help_center/class-template-variables-tab.php
DELETED
@@ -1,99 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* WPSEO plugin file.
|
4 |
-
*
|
5 |
-
* @package WPSEO\Admin
|
6 |
-
*/
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Class that adds a template variables explanation tab to the Help Center.
|
10 |
-
*/
|
11 |
-
class WPSEO_Help_Center_Template_Variables_Tab implements WPSEO_WordPress_Integration {
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Priority to hook into the tab filter.
|
15 |
-
*
|
16 |
-
* @var int
|
17 |
-
*/
|
18 |
-
private $priority;
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Tab constructor.
|
22 |
-
*
|
23 |
-
* @param int $priority The priority to add the filter on, allows for ordering.
|
24 |
-
*/
|
25 |
-
public function __construct( $priority = 10 ) {
|
26 |
-
$this->priority = $priority;
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Registers all hooks to WordPress.
|
31 |
-
*
|
32 |
-
* @return void
|
33 |
-
*/
|
34 |
-
public function register_hooks() {
|
35 |
-
add_filter( 'wpseo_help_center_items', array( $this, 'add_meta_options_help_center_tabs' ), $this->priority );
|
36 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );
|
37 |
-
}
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Enqueues the styles needed in the Help Center tab.
|
41 |
-
*
|
42 |
-
* @return void
|
43 |
-
*/
|
44 |
-
public function enqueue_assets() {
|
45 |
-
$asset_manager = new WPSEO_Admin_Asset_Manager();
|
46 |
-
$asset_manager->enqueue_style( 'admin-css' );
|
47 |
-
}
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Adds help tabs.
|
51 |
-
*
|
52 |
-
* @param array $tabs Current help center tabs.
|
53 |
-
*
|
54 |
-
* @return array List containing all the additional tabs.
|
55 |
-
*/
|
56 |
-
public function add_meta_options_help_center_tabs( $tabs ) {
|
57 |
-
$tabs[] = new WPSEO_Help_Center_Item(
|
58 |
-
'template-variables',
|
59 |
-
__( 'Snippet variables', 'wordpress-seo' ),
|
60 |
-
array( 'content' => $this->get_content() )
|
61 |
-
);
|
62 |
-
|
63 |
-
return $tabs;
|
64 |
-
}
|
65 |
-
|
66 |
-
/**
|
67 |
-
* Adds template variables to the help center.
|
68 |
-
*
|
69 |
-
* @return string The content for the template variables tab.
|
70 |
-
*/
|
71 |
-
private function get_content() {
|
72 |
-
$explanation = sprintf(
|
73 |
-
/* translators: %1$s expands to Yoast SEO. */
|
74 |
-
__( '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' ),
|
75 |
-
'Yoast SEO'
|
76 |
-
);
|
77 |
-
|
78 |
-
$output_explanation = sprintf(
|
79 |
-
'<h2 class="wpseo-help-center-sub-title">%s</h2><p>%s</p><p>%s</p>',
|
80 |
-
esc_html( __( 'Snippet variables', 'wordpress-seo' ) ),
|
81 |
-
esc_html( $explanation ),
|
82 |
-
esc_html( __( 'Note that not all variables can be used in every field.', 'wordpress-seo' ) )
|
83 |
-
);
|
84 |
-
|
85 |
-
$output_basic = sprintf(
|
86 |
-
'<h2 class="wpseo-help-center-sub-title">%s</h2>%s',
|
87 |
-
esc_html( __( 'Basic Variables', 'wordpress-seo' ) ),
|
88 |
-
WPSEO_Replace_Vars::get_basic_help_texts()
|
89 |
-
);
|
90 |
-
|
91 |
-
$output_advanced = sprintf(
|
92 |
-
'<h2 class="wpseo-help-center-sub-title">%s</h2>%s',
|
93 |
-
esc_html( __( 'Advanced Variables', 'wordpress-seo' ) ),
|
94 |
-
WPSEO_Replace_Vars::get_advanced_help_texts()
|
95 |
-
);
|
96 |
-
|
97 |
-
return $output_explanation . $output_basic . $output_advanced;
|
98 |
-
}
|
99 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/menu/class-replacevar-editor.php
CHANGED
@@ -33,7 +33,7 @@ class WPSEO_Replacevar_Editor {
|
|
33 |
/**
|
34 |
* Constructs the object.
|
35 |
*
|
36 |
-
* @param Yoast_Form $yform
|
37 |
* @param array $arguments {
|
38 |
* The arguments that can be given.
|
39 |
*
|
33 |
/**
|
34 |
* Constructs the object.
|
35 |
*
|
36 |
+
* @param Yoast_Form $yform Yoast forms.
|
37 |
* @param array $arguments {
|
38 |
* The arguments that can be given.
|
39 |
*
|
admin/metabox/class-metabox.php
CHANGED
@@ -42,6 +42,11 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
|
42 |
* Class constructor.
|
43 |
*/
|
44 |
public function __construct() {
|
|
|
|
|
|
|
|
|
|
|
45 |
add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
|
46 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
|
47 |
add_action( 'wp_insert_post', array( $this, 'save_postdata' ) );
|
@@ -62,7 +67,69 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
|
62 |
}
|
63 |
|
64 |
/**
|
65 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
*
|
67 |
* IMPORTANT: if you want to add a new string (option) somewhere, make sure you add that array key to
|
68 |
* the main meta box definition array in the class WPSEO_Meta() as well!!!!
|
@@ -88,10 +155,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
|
88 |
WPSEO_Meta::$meta_fields['advanced']['meta-robots-nofollow']['options']['1'] = __( 'No', 'wordpress-seo' );
|
89 |
|
90 |
WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['title'] = __( 'Meta robots advanced', 'wordpress-seo' );
|
91 |
-
WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['description'] = __( '
|
92 |
-
/* translators: %s expands to the advanced robots settings default as set in the site-wide settings.*/
|
93 |
-
WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['options']['-'] = __( 'Site-wide default: %s', 'wordpress-seo' );
|
94 |
-
WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['options']['none'] = __( 'None', 'wordpress-seo' );
|
95 |
WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['options']['noimageindex'] = __( 'No Image Index', 'wordpress-seo' );
|
96 |
WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['options']['noarchive'] = __( 'No Archive', 'wordpress-seo' );
|
97 |
WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['options']['nosnippet'] = __( 'No Snippet', 'wordpress-seo' );
|
@@ -144,8 +208,6 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
|
144 |
|
145 |
$product_title = $this->get_product_title();
|
146 |
|
147 |
-
$this->register_helpcenter_tab();
|
148 |
-
|
149 |
foreach ( $post_types as $post_type ) {
|
150 |
add_filter( "postbox_classes_{$post_type}_wpseo_meta", array( $this, 'wpseo_metabox_class' ) );
|
151 |
|
@@ -175,7 +237,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
|
175 |
}
|
176 |
|
177 |
/**
|
178 |
-
*
|
179 |
*
|
180 |
* @return array
|
181 |
*/
|
@@ -204,7 +266,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
|
204 |
}
|
205 |
|
206 |
/**
|
207 |
-
*
|
208 |
*/
|
209 |
public function localize_replace_vars_script() {
|
210 |
return array(
|
@@ -244,7 +306,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
|
244 |
}
|
245 |
|
246 |
/**
|
247 |
-
*
|
248 |
*
|
249 |
* @return array
|
250 |
*/
|
@@ -256,7 +318,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
|
256 |
}
|
257 |
|
258 |
/**
|
259 |
-
*
|
260 |
*/
|
261 |
public function meta_box() {
|
262 |
$content_sections = $this->get_content_sections();
|
@@ -365,7 +427,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
|
365 |
}
|
366 |
|
367 |
/**
|
368 |
-
* Returns metabox sections that have been added by other plugins.
|
369 |
*
|
370 |
* @return WPSEO_Metabox_Section_Additional[]
|
371 |
*/
|
@@ -607,7 +669,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
|
607 |
$html = $content;
|
608 |
}
|
609 |
else {
|
610 |
-
$html = $label . $
|
611 |
}
|
612 |
}
|
613 |
|
@@ -615,7 +677,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
|
615 |
}
|
616 |
|
617 |
/**
|
618 |
-
*
|
619 |
*
|
620 |
* {@internal $_POST parameters are validated via sanitize_post_meta().}}
|
621 |
*
|
@@ -793,7 +855,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
|
793 |
);
|
794 |
|
795 |
/**
|
796 |
-
*
|
797 |
* contenteditable fields.
|
798 |
*/
|
799 |
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
|
@@ -817,7 +879,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
|
817 |
}
|
818 |
|
819 |
/**
|
820 |
-
*
|
821 |
*
|
822 |
* @return array
|
823 |
*/
|
@@ -1017,25 +1079,6 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
|
1017 |
return $product_title;
|
1018 |
}
|
1019 |
|
1020 |
-
/**
|
1021 |
-
* Adds the template variables tab to the helpcenter.
|
1022 |
-
*
|
1023 |
-
* @return void
|
1024 |
-
*/
|
1025 |
-
protected function register_helpcenter_tab() {
|
1026 |
-
static $tab_registered;
|
1027 |
-
|
1028 |
-
if ( $tab_registered ) {
|
1029 |
-
return;
|
1030 |
-
}
|
1031 |
-
|
1032 |
-
// Add template variables tab to the Help Center.
|
1033 |
-
$tab = new WPSEO_Help_Center_Template_Variables_Tab();
|
1034 |
-
$tab->register_hooks();
|
1035 |
-
|
1036 |
-
$tab_registered = true;
|
1037 |
-
}
|
1038 |
-
|
1039 |
/* ********************* DEPRECATED METHODS ********************* */
|
1040 |
|
1041 |
/**
|
@@ -1063,7 +1106,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
|
1063 |
}
|
1064 |
|
1065 |
/**
|
1066 |
-
*
|
1067 |
*
|
1068 |
* @deprecated 12.2
|
1069 |
* @codeCoverageIgnore
|
42 |
* Class constructor.
|
43 |
*/
|
44 |
public function __construct() {
|
45 |
+
if ( $this->is_internet_explorer() ) {
|
46 |
+
add_action( 'add_meta_boxes', array( $this, 'internet_explorer_metabox' ) );
|
47 |
+
return;
|
48 |
+
}
|
49 |
+
|
50 |
add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
|
51 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
|
52 |
add_action( 'wp_insert_post', array( $this, 'save_postdata' ) );
|
67 |
}
|
68 |
|
69 |
/**
|
70 |
+
* Checks whether the request comes from an IE 11 browser.
|
71 |
+
*
|
72 |
+
* @return bool Whether the request comes from an IE 11 browser.
|
73 |
+
*/
|
74 |
+
public static function is_internet_explorer() {
|
75 |
+
$user_agent = $_SERVER['HTTP_USER_AGENT'];
|
76 |
+
|
77 |
+
if ( ! stripos( $user_agent, 'Trident/7.0' ) ) {
|
78 |
+
return false;
|
79 |
+
}
|
80 |
+
|
81 |
+
return true;
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Adds an alternative metabox for internet explorer users.
|
86 |
+
*/
|
87 |
+
public function internet_explorer_metabox() {
|
88 |
+
$post_types = WPSEO_Post_Type::get_accessible_post_types();
|
89 |
+
$post_types = array_filter( $post_types, array( $this, 'display_metabox' ) );
|
90 |
+
|
91 |
+
if ( ! is_array( $post_types ) || $post_types === array() ) {
|
92 |
+
return;
|
93 |
+
}
|
94 |
+
|
95 |
+
$product_title = $this->get_product_title();
|
96 |
+
|
97 |
+
foreach ( $post_types as $post_type ) {
|
98 |
+
add_filter( "postbox_classes_{$post_type}_wpseo_meta", array( $this, 'wpseo_metabox_class' ) );
|
99 |
+
|
100 |
+
add_meta_box(
|
101 |
+
'wpseo_meta',
|
102 |
+
$product_title,
|
103 |
+
array( $this, 'render_internet_explorer_notice' ),
|
104 |
+
$post_type,
|
105 |
+
'normal',
|
106 |
+
apply_filters( 'wpseo_metabox_prio', 'high' ),
|
107 |
+
array( '__block_editor_compatible_meta_box' => true )
|
108 |
+
);
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Renders the content for the internet explorer metabox.
|
114 |
+
*/
|
115 |
+
public function render_internet_explorer_notice() {
|
116 |
+
echo '<div class="yoast-alert-box yoast-alert-box__warning">';
|
117 |
+
echo '<span class="icon">';
|
118 |
+
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>';
|
119 |
+
echo '</span>';
|
120 |
+
echo '<div style="float: left">';
|
121 |
+
printf(
|
122 |
+
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' ),
|
123 |
+
'<a href="https://www.mozilla.org/firefox/new/">',
|
124 |
+
'<a href="https://www.google.com/intl/nl/chrome/">',
|
125 |
+
'<a href="https://www.microsoft.com/windows/microsoft-edge">',
|
126 |
+
'</a>'
|
127 |
+
);
|
128 |
+
echo '</div></div>';
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Translates text strings for use in the meta box.
|
133 |
*
|
134 |
* IMPORTANT: if you want to add a new string (option) somewhere, make sure you add that array key to
|
135 |
* the main meta box definition array in the class WPSEO_Meta() as well!!!!
|
155 |
WPSEO_Meta::$meta_fields['advanced']['meta-robots-nofollow']['options']['1'] = __( 'No', 'wordpress-seo' );
|
156 |
|
157 |
WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['title'] = __( 'Meta robots advanced', 'wordpress-seo' );
|
158 |
+
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' );
|
|
|
|
|
|
|
159 |
WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['options']['noimageindex'] = __( 'No Image Index', 'wordpress-seo' );
|
160 |
WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['options']['noarchive'] = __( 'No Archive', 'wordpress-seo' );
|
161 |
WPSEO_Meta::$meta_fields['advanced']['meta-robots-adv']['options']['nosnippet'] = __( 'No Snippet', 'wordpress-seo' );
|
208 |
|
209 |
$product_title = $this->get_product_title();
|
210 |
|
|
|
|
|
211 |
foreach ( $post_types as $post_type ) {
|
212 |
add_filter( "postbox_classes_{$post_type}_wpseo_meta", array( $this, 'wpseo_metabox_class' ) );
|
213 |
|
237 |
}
|
238 |
|
239 |
/**
|
240 |
+
* Passes variables to js for use with the post-scraper.
|
241 |
*
|
242 |
* @return array
|
243 |
*/
|
266 |
}
|
267 |
|
268 |
/**
|
269 |
+
* Passes some variables to js for replacing variables.
|
270 |
*/
|
271 |
public function localize_replace_vars_script() {
|
272 |
return array(
|
306 |
}
|
307 |
|
308 |
/**
|
309 |
+
* Passes some variables to js for the edit / post page overview, etc.
|
310 |
*
|
311 |
* @return array
|
312 |
*/
|
318 |
}
|
319 |
|
320 |
/**
|
321 |
+
* Outputs the meta box.
|
322 |
*/
|
323 |
public function meta_box() {
|
324 |
$content_sections = $this->get_content_sections();
|
427 |
}
|
428 |
|
429 |
/**
|
430 |
+
* Returns the metabox sections that have been added by other plugins.
|
431 |
*
|
432 |
* @return WPSEO_Metabox_Section_Additional[]
|
433 |
*/
|
669 |
$html = $content;
|
670 |
}
|
671 |
else {
|
672 |
+
$html = $label . $description . $help_button . $help_panel . $content;
|
673 |
}
|
674 |
}
|
675 |
|
677 |
}
|
678 |
|
679 |
/**
|
680 |
+
* Saves the WP SEO metadata for posts.
|
681 |
*
|
682 |
* {@internal $_POST parameters are validated via sanitize_post_meta().}}
|
683 |
*
|
855 |
);
|
856 |
|
857 |
/**
|
858 |
+
* Removes the emoji script as it is incompatible with both React and any
|
859 |
* contenteditable fields.
|
860 |
*/
|
861 |
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
|
879 |
}
|
880 |
|
881 |
/**
|
882 |
+
* Passes some variables to js for upload module.
|
883 |
*
|
884 |
* @return array
|
885 |
*/
|
1079 |
return $product_title;
|
1080 |
}
|
1081 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1082 |
/* ********************* DEPRECATED METHODS ********************* */
|
1083 |
|
1084 |
/**
|
1106 |
}
|
1107 |
|
1108 |
/**
|
1109 |
+
* Outputs a tab in the Yoast SEO Metabox.
|
1110 |
*
|
1111 |
* @deprecated 12.2
|
1112 |
* @codeCoverageIgnore
|
admin/onpage/class-ryte-service.php
CHANGED
@@ -48,7 +48,7 @@ class WPSEO_Ryte_Service {
|
|
48 |
* Returns an the results of the Ryte option based on the passed status.
|
49 |
*
|
50 |
* @param string $status The option's status.
|
51 |
-
* @param bool $fetch
|
52 |
*
|
53 |
* @return array The results, contains a score and label.
|
54 |
*/
|
48 |
* Returns an the results of the Ryte option based on the passed status.
|
49 |
*
|
50 |
* @param string $status The option's status.
|
51 |
+
* @param bool $fetch Whether or not the data should be fetched.
|
52 |
*
|
53 |
* @return array The results, contains a score and label.
|
54 |
*/
|
admin/pages/dashboard.php
CHANGED
@@ -38,7 +38,6 @@ $tabs->add_tab(
|
|
38 |
'dashboard',
|
39 |
__( 'Dashboard', 'wordpress-seo' ),
|
40 |
array(
|
41 |
-
'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-notification-center' ),
|
42 |
'save_button' => false,
|
43 |
)
|
44 |
)
|
@@ -46,15 +45,13 @@ $tabs->add_tab(
|
|
46 |
$tabs->add_tab(
|
47 |
new WPSEO_Option_Tab(
|
48 |
'features',
|
49 |
-
__( 'Features', 'wordpress-seo' )
|
50 |
-
array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-features' ) )
|
51 |
)
|
52 |
);
|
53 |
$tabs->add_tab(
|
54 |
new WPSEO_Option_Tab(
|
55 |
'webmaster-tools',
|
56 |
-
__( 'Webmaster Tools', 'wordpress-seo' )
|
57 |
-
array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-general-search-console' ) )
|
58 |
)
|
59 |
);
|
60 |
|
38 |
'dashboard',
|
39 |
__( 'Dashboard', 'wordpress-seo' ),
|
40 |
array(
|
|
|
41 |
'save_button' => false,
|
42 |
)
|
43 |
)
|
45 |
$tabs->add_tab(
|
46 |
new WPSEO_Option_Tab(
|
47 |
'features',
|
48 |
+
__( 'Features', 'wordpress-seo' )
|
|
|
49 |
)
|
50 |
);
|
51 |
$tabs->add_tab(
|
52 |
new WPSEO_Option_Tab(
|
53 |
'webmaster-tools',
|
54 |
+
__( 'Webmaster Tools', 'wordpress-seo' )
|
|
|
55 |
)
|
56 |
);
|
57 |
|
admin/pages/metas.php
CHANGED
@@ -11,20 +11,17 @@ if ( ! defined( 'WPSEO_VERSION' ) ) {
|
|
11 |
exit();
|
12 |
}
|
13 |
|
14 |
-
$tab = new WPSEO_Help_Center_Template_Variables_Tab();
|
15 |
-
$tab->register_hooks();
|
16 |
-
|
17 |
$yform = Yoast_Form::get_instance();
|
18 |
$yform->admin_header( true, 'wpseo_titles' );
|
19 |
|
20 |
$tabs = new WPSEO_Option_Tabs( 'metas' );
|
21 |
-
$tabs->add_tab( new WPSEO_Option_Tab( 'general', __( 'General', 'wordpress-seo' )
|
22 |
-
$tabs->add_tab( new WPSEO_Option_Tab( 'post-types', __( 'Content Types', 'wordpress-seo' )
|
23 |
$tabs->add_tab( new WPSEO_Option_Tab( 'media', __( 'Media', 'wordpress-seo' ) ) );
|
24 |
-
$tabs->add_tab( new WPSEO_Option_Tab( 'taxonomies', __( 'Taxonomies', 'wordpress-seo' )
|
25 |
-
$tabs->add_tab( new WPSEO_Option_Tab( 'archives', __( 'Archives', 'wordpress-seo' )
|
26 |
-
$tabs->add_tab( new WPSEO_Option_Tab( 'breadcrumbs', __( 'Breadcrumbs', 'wordpress-seo' )
|
27 |
-
$tabs->add_tab( new WPSEO_Option_Tab( 'rss', __( 'RSS', 'wordpress-seo' )
|
28 |
$tabs->display( $yform );
|
29 |
|
30 |
$yform->admin_footer();
|
11 |
exit();
|
12 |
}
|
13 |
|
|
|
|
|
|
|
14 |
$yform = Yoast_Form::get_instance();
|
15 |
$yform->admin_header( true, 'wpseo_titles' );
|
16 |
|
17 |
$tabs = new WPSEO_Option_Tabs( 'metas' );
|
18 |
+
$tabs->add_tab( new WPSEO_Option_Tab( 'general', __( 'General', 'wordpress-seo' ) ) );
|
19 |
+
$tabs->add_tab( new WPSEO_Option_Tab( 'post-types', __( 'Content Types', 'wordpress-seo' ) ) );
|
20 |
$tabs->add_tab( new WPSEO_Option_Tab( 'media', __( 'Media', 'wordpress-seo' ) ) );
|
21 |
+
$tabs->add_tab( new WPSEO_Option_Tab( 'taxonomies', __( 'Taxonomies', 'wordpress-seo' ) ) );
|
22 |
+
$tabs->add_tab( new WPSEO_Option_Tab( 'archives', __( 'Archives', 'wordpress-seo' ) ) );
|
23 |
+
$tabs->add_tab( new WPSEO_Option_Tab( 'breadcrumbs', __( 'Breadcrumbs', 'wordpress-seo' ) ) );
|
24 |
+
$tabs->add_tab( new WPSEO_Option_Tab( 'rss', __( 'RSS', 'wordpress-seo' ) ) );
|
25 |
$tabs->display( $yform );
|
26 |
|
27 |
$yform->admin_footer();
|
admin/pages/network.php
CHANGED
@@ -16,7 +16,7 @@ $yform->admin_header( true, 'wpseo_ms' );
|
|
16 |
|
17 |
$tabs = new WPSEO_Option_Tabs( 'network' );
|
18 |
$tabs->add_tab( new WPSEO_Option_Tab( 'general', __( 'General', 'wordpress-seo' ) ) );
|
19 |
-
$tabs->add_tab( new WPSEO_Option_Tab( 'features', __( 'Features', 'wordpress-seo' )
|
20 |
$tabs->add_tab( new WPSEO_Option_Tab( 'restore-site', __( 'Restore Site', 'wordpress-seo' ), array( 'save_button' => false ) ) );
|
21 |
$tabs->display( $yform );
|
22 |
|
16 |
|
17 |
$tabs = new WPSEO_Option_Tabs( 'network' );
|
18 |
$tabs->add_tab( new WPSEO_Option_Tab( 'general', __( 'General', 'wordpress-seo' ) ) );
|
19 |
+
$tabs->add_tab( new WPSEO_Option_Tab( 'features', __( 'Features', 'wordpress-seo' ) ) );
|
20 |
$tabs->add_tab( new WPSEO_Option_Tab( 'restore-site', __( 'Restore Site', 'wordpress-seo' ), array( 'save_button' => false ) ) );
|
21 |
$tabs->display( $yform );
|
22 |
|
admin/pages/social.php
CHANGED
@@ -15,10 +15,10 @@ $yform = Yoast_Form::get_instance();
|
|
15 |
$yform->admin_header( true, 'wpseo_social' );
|
16 |
|
17 |
$tabs = new WPSEO_Option_Tabs( 'social' );
|
18 |
-
$tabs->add_tab( new WPSEO_Option_Tab( 'accounts', __( 'Accounts', 'wordpress-seo' )
|
19 |
-
$tabs->add_tab( new WPSEO_Option_Tab( 'facebook', __( 'Facebook', 'wordpress-seo' )
|
20 |
-
$tabs->add_tab( new WPSEO_Option_Tab( 'twitterbox', __( 'Twitter', 'wordpress-seo' )
|
21 |
-
$tabs->add_tab( new WPSEO_Option_Tab( 'pinterest', __( 'Pinterest', 'wordpress-seo' )
|
22 |
|
23 |
$tabs->display( $yform );
|
24 |
|
15 |
$yform->admin_header( true, 'wpseo_social' );
|
16 |
|
17 |
$tabs = new WPSEO_Option_Tabs( 'social' );
|
18 |
+
$tabs->add_tab( new WPSEO_Option_Tab( 'accounts', __( 'Accounts', 'wordpress-seo' ) ) );
|
19 |
+
$tabs->add_tab( new WPSEO_Option_Tab( 'facebook', __( 'Facebook', 'wordpress-seo' ) ) );
|
20 |
+
$tabs->add_tab( new WPSEO_Option_Tab( 'twitterbox', __( 'Twitter', 'wordpress-seo' ) ) );
|
21 |
+
$tabs->add_tab( new WPSEO_Option_Tab( 'pinterest', __( 'Pinterest', 'wordpress-seo' ) ) );
|
22 |
|
23 |
$tabs->display( $yform );
|
24 |
|
admin/taxonomy/class-taxonomy.php
CHANGED
@@ -71,19 +71,51 @@ class WPSEO_Taxonomy {
|
|
71 |
* @param stdClass|WP_Term $term Term to show the edit boxes for.
|
72 |
*/
|
73 |
public function term_metabox( $term ) {
|
74 |
-
|
75 |
-
|
|
|
|
|
76 |
|
77 |
$metabox = new WPSEO_Taxonomy_Metabox( $this->taxonomy, $term );
|
78 |
$metabox->display();
|
79 |
}
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
/**
|
82 |
* Queue assets for taxonomy screens.
|
83 |
*
|
84 |
* @since 1.5.0
|
85 |
*/
|
86 |
public function admin_enqueue_scripts() {
|
|
|
87 |
$pagenow = $GLOBALS['pagenow'];
|
88 |
|
89 |
if ( ! ( self::is_term_edit( $pagenow ) || self::is_term_overview( $pagenow ) ) ) {
|
@@ -93,9 +125,6 @@ class WPSEO_Taxonomy {
|
|
93 |
$asset_manager = new WPSEO_Admin_Asset_Manager();
|
94 |
$asset_manager->enqueue_style( 'scoring' );
|
95 |
|
96 |
-
$tab = new WPSEO_Help_Center_Template_Variables_Tab();
|
97 |
-
$tab->enqueue_assets();
|
98 |
-
|
99 |
$tag_id = filter_input( INPUT_GET, 'tag_ID' );
|
100 |
if (
|
101 |
self::is_term_edit( $pagenow ) &&
|
71 |
* @param stdClass|WP_Term $term Term to show the edit boxes for.
|
72 |
*/
|
73 |
public function term_metabox( $term ) {
|
74 |
+
if ( WPSEO_Metabox::is_internet_explorer() ) {
|
75 |
+
$this->show_internet_explorer_notice();
|
76 |
+
return;
|
77 |
+
}
|
78 |
|
79 |
$metabox = new WPSEO_Taxonomy_Metabox( $this->taxonomy, $term );
|
80 |
$metabox->display();
|
81 |
}
|
82 |
|
83 |
+
/**
|
84 |
+
* Renders the content for the internet explorer metabox.
|
85 |
+
*/
|
86 |
+
private function show_internet_explorer_notice() {
|
87 |
+
$product_title = 'Yoast SEO';
|
88 |
+
if ( file_exists( WPSEO_PATH . 'premium/' ) ) {
|
89 |
+
$product_title .= ' Premium';
|
90 |
+
}
|
91 |
+
|
92 |
+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $product_title is hardcoded.
|
93 |
+
printf( '<div id="wpseo_meta" class="postbox yoast wpseo-taxonomy-metabox-postbox"><h2><span>%1$s</span></h2>', $product_title );
|
94 |
+
|
95 |
+
echo '<div class="inside">';
|
96 |
+
echo '<div class="yoast-alert-box yoast-alert-box__warning">';
|
97 |
+
echo '<span class="icon">';
|
98 |
+
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>';
|
99 |
+
echo '</span>';
|
100 |
+
echo '<div style="float: left">';
|
101 |
+
printf(
|
102 |
+
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' ),
|
103 |
+
'<a href="https://www.mozilla.org/firefox/new/">',
|
104 |
+
'<a href="https://www.google.com/intl/nl/chrome/">',
|
105 |
+
'<a href="https://www.microsoft.com/windows/microsoft-edge">',
|
106 |
+
'</a>'
|
107 |
+
);
|
108 |
+
echo '</div></div>';
|
109 |
+
echo '</div></div>';
|
110 |
+
}
|
111 |
+
|
112 |
/**
|
113 |
* Queue assets for taxonomy screens.
|
114 |
*
|
115 |
* @since 1.5.0
|
116 |
*/
|
117 |
public function admin_enqueue_scripts() {
|
118 |
+
|
119 |
$pagenow = $GLOBALS['pagenow'];
|
120 |
|
121 |
if ( ! ( self::is_term_edit( $pagenow ) || self::is_term_overview( $pagenow ) ) ) {
|
125 |
$asset_manager = new WPSEO_Admin_Asset_Manager();
|
126 |
$asset_manager->enqueue_style( 'scoring' );
|
127 |
|
|
|
|
|
|
|
128 |
$tag_id = filter_input( INPUT_GET, 'tag_ID' );
|
129 |
if (
|
130 |
self::is_term_edit( $pagenow ) &&
|
admin/views/tool-bulk-editor.php
CHANGED
@@ -76,31 +76,6 @@ if ( ! empty( $_REQUEST['_wp_http_referer'] ) && isset( $_SERVER['REQUEST_URI']
|
|
76 |
exit;
|
77 |
}
|
78 |
|
79 |
-
/**
|
80 |
-
* Outputs a help center.
|
81 |
-
*/
|
82 |
-
function wpseo_render_help_center() {
|
83 |
-
$tabs = new WPSEO_Option_Tabs( '', '' );
|
84 |
-
|
85 |
-
$bulk_editor_tab_title = new WPSEO_Option_Tab(
|
86 |
-
'title',
|
87 |
-
__( 'Bulk editor', 'wordpress-seo' ),
|
88 |
-
array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-tools-bulk-editor' ) )
|
89 |
-
);
|
90 |
-
$tabs->add_tab( $bulk_editor_tab_title );
|
91 |
-
|
92 |
-
$bulk_editor_tab_description = new WPSEO_Option_Tab(
|
93 |
-
'description',
|
94 |
-
__( 'Bulk editor', 'wordpress-seo' ),
|
95 |
-
array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-tools-bulk-editor' ) )
|
96 |
-
);
|
97 |
-
$tabs->add_tab( $bulk_editor_tab_description );
|
98 |
-
|
99 |
-
$helpcenter = new WPSEO_Help_Center( '', $tabs, WPSEO_Utils::is_yoast_seo_premium() );
|
100 |
-
$helpcenter->localize_data();
|
101 |
-
$helpcenter->mount();
|
102 |
-
}
|
103 |
-
|
104 |
/**
|
105 |
* Renders a bulk editor tab.
|
106 |
*
|
@@ -136,8 +111,6 @@ function wpseo_get_rendered_tab( $table, $id ) {
|
|
136 |
href="#top#description"><?php esc_html_e( 'Description', 'wordpress-seo' ); ?></a>
|
137 |
</h2>
|
138 |
|
139 |
-
<?php wpseo_render_help_center(); ?>
|
140 |
-
|
141 |
<div class="tabwrapper">
|
142 |
<?php wpseo_get_rendered_tab( $wpseo_bulk_titles_table, 'title' ); ?>
|
143 |
<?php wpseo_get_rendered_tab( $wpseo_bulk_description_table, 'description' ); ?>
|
76 |
exit;
|
77 |
}
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
/**
|
80 |
* Renders a bulk editor tab.
|
81 |
*
|
111 |
href="#top#description"><?php esc_html_e( 'Description', 'wordpress-seo' ); ?></a>
|
112 |
</h2>
|
113 |
|
|
|
|
|
114 |
<div class="tabwrapper">
|
115 |
<?php wpseo_get_rendered_tab( $wpseo_bulk_titles_table, 'title' ); ?>
|
116 |
<?php wpseo_get_rendered_tab( $wpseo_bulk_description_table, 'description' ); ?>
|
admin/views/tool-file-editor.php
CHANGED
@@ -98,20 +98,9 @@ if ( isset( $msg ) && ! empty( $msg ) ) {
|
|
98 |
echo '<div id="message" class="notice notice-success"><p>', esc_html( $msg ), '</p></div>';
|
99 |
}
|
100 |
|
101 |
-
$helpcenter_tab = new WPSEO_Option_Tab(
|
102 |
-
'bulk-editor',
|
103 |
-
__( 'Bulk editor', 'wordpress-seo' ),
|
104 |
-
array( 'video_url' => WPSEO_Shortlinker::get( 'https://yoa.st/screencast-tools-file-editor' ) )
|
105 |
-
);
|
106 |
-
|
107 |