PluginProbe
WPSSO Core – Complete Schema Markup and Meta Tags / 22.7.0
WPSSO Core – Complete Schema Markup and Meta Tags v22.7.0
22.7.0 22.6.1 22.6.0 22.5.3 22.5.2 22.5.1 22.4.0 22.3.0 22.2.1 22.2.0 22.1.3 22.1.2 22.1.1 22.1.0 22.0.0 21.13.3 21.13.2 trunk 21.13.1
wpsso / lib / admin-head-suggest-options.php

admin-head-suggest-options.php in WPSSO Core – Complete Schema Markup and Meta Tags 22.7.0, at lib/admin-head-suggest-options.php

160 lines 4.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * License: GPLv3
4 * License URI: https://www.gnu.org/licenses/gpl.txt
5 * Copyright 2012-2026 Jean-Sebastien Morisset (https://wpsso.com/)
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9
10 die( 'These aren\'t the droids you\'re looking for.' );
11 }
12
13 if ( ! defined( 'WPSSO_PLUGINDIR' ) ) {
14
15 die( 'Do. Or do not. There is no try.' );
16 }
17
18 if ( ! class_exists( 'WpssoAdminHeadSuggestOptions' ) ) {
19
20 class WpssoAdminHeadSuggestOptions {
21
22 private $p; // Wpsso class object.
23
24 /*
25 * Instantiated by WpssoAdminHeadSuggest->__construct().
26 */
27 public function __construct( &$plugin ) {
28
29 $this->p =& $plugin;
30 }
31
32 public function suggest( $suggest_max = 2 ) {
33
34 if ( $this->p->debug->enabled ) {
35
36 $this->p->debug->log_args( array(
37 'suggest_max' => $suggest_max,
38 ) );
39 }
40
41 $suggested = 0;
42
43 if ( ! current_user_can( 'manage_options' ) ) return $suggested;
44
45 /*
46 * Suggest integration and seo options, in that order.
47 */
48 foreach ( array( 'integration', 'seo' ) as $suffix ) {
49
50 $methodname = 'suggest_options_' . $suffix;
51 $suggested = $suggested + $this->$methodname( $suggest_max - $suggested );
52
53 if ( $this->p->debug->enabled ) {
54
55 $this->p->debug->log( $methodname . ' suggested = ' . $suggested );
56 }
57
58 if ( $suggested >= $suggest_max ) break;
59 }
60
61 if ( $this->p->debug->enabled ) {
62
63 $this->p->debug->log( 'return suggested = ' . $suggested );
64 }
65
66 return $suggested;
67 }
68
69 private function suggest_options_integration( $suggest_max ) {
70
71 $suggested = 0;
72
73 /*
74 * Image Dimension Checks.
75 */
76 if ( empty( $this->p->options[ 'plugin_check_img_dims' ] ) ) {
77
78 $notice_key = 'notice-check-img-dims-disabled';
79
80 if ( $this->p->notice->is_admin_pre_notices( $notice_key ) ) {
81
82 if ( $notice_msg = $this->p->msgs->get( $notice_key ) ) {
83
84 $this->p->notice->inf( $notice_msg, null, $notice_key, $dismiss_time = true );
85
86 if ( ++$suggested >= $suggest_max ) return $suggested;
87 }
88 }
89 }
90
91 /*
92 * Inherit Featured Image for WooCommerce.
93 */
94 if ( ! empty( $this->p->avail[ 'ecom' ][ 'woocommerce' ] ) ) { // WooCommerce plugin is active.
95
96 if ( empty( $this->p->options[ 'plugin_inherit_featured' ] ) ) {
97
98 $notice_key = 'notice-wc-inherit-featured-disabled';
99
100 if ( $this->p->notice->is_admin_pre_notices( $notice_key ) ) {
101
102 if ( $notice_msg = $this->p->msgs->get( $notice_key ) ) {
103
104 $this->p->notice->inf( $notice_msg, null, $notice_key, $dismiss_time = true );
105
106 if ( ++$suggested >= $suggest_max ) return $suggested;
107 }
108 }
109 }
110 }
111
112 return $suggested;
113 }
114
115 private function suggest_options_seo( $suggest_max ) {
116
117 $suggested = 0;
118
119 if ( empty( $this->p->avail[ 'seo' ][ 'any' ] ) ) { // An SEO plugin is not active.
120
121 /*
122 * If the option is not checked and not disabled, then show a notice and return.
123 */
124 foreach ( array(
125 'add_link_rel_canonical' => 'link rel canonical',
126 'add_link_rel_shortlink' => 'link rel shortlink',
127 'add_meta_name_description' => 'meta name description',
128 'add_meta_name_robots' => 'meta name robots',
129 ) as $opt_key => $tag_name ) {
130
131 $notice_key = 'suggest-options-seo-' . $opt_key;
132
133 if ( ! empty( $this->p->options[ $opt_key ] ) ) continue;
134
135 if ( ! empty( $this->p->options[ $opt_key . ':disabled' ] ) ) continue;
136
137 if ( ! $this->p->notice->is_admin_pre_notices( $notice_key ) ) continue;
138
139 $seo_other_tab_link = $this->p->util->get_admin_url( 'advanced#sucom-tabset_head_tags-tab_seo_other',
140 _x( 'SSO', 'menu title', 'wpsso' ) . ' &gt; ' .
141 _x( 'Advanced Settings', 'lib file description', 'wpsso' ) . ' &gt; ' .
142 _x( 'HTML Tags', 'metabox title', 'wpsso' ) . ' &gt; ' .
143 _x( 'SEO / Other', 'metabox tab', 'wpsso' ) );
144
145 $notice_msg = sprintf( __( 'Please note that the %s HTML tag is currently disabled and a known SEO plugin has not been detected.',
146 'wpsso' ), '<code>' . $tag_name . '</code>' ) . ' ';
147
148 $notice_msg .= sprintf( __( 'If another SEO plugin or your theme templates are not adding the %1$s HTML tag to your webpages, you should enable this option under the %2$s tab.', 'wpsso' ), '<code>' . $tag_name . '</code>', $seo_other_tab_link ) . ' ';
149
150 $this->p->notice->inf( $notice_msg, null, $notice_key, $dismiss_time = true );
151
152 if ( ++$suggested >= $suggest_max ) return $suggested;
153 }
154 }
155
156 return $suggested;
157 }
158 }
159 }
160