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 / submenu / advanced.php

advanced.php in WPSSO Core – Complete Schema Markup and Meta Tags 22.7.0, at lib/submenu/advanced.php

303 lines 10.5 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 ( ! class_exists( 'WpssoSubmenuAdvanced' ) && class_exists( 'WpssoAdmin' ) ) {
14
15 class WpssoSubmenuAdvanced extends WpssoAdmin {
16
17 public function __construct( &$plugin, $id, $name, $lib, $ext ) {
18
19 $this->p =& $plugin;
20
21 if ( $this->p->debug->enabled ) {
22
23 $this->p->debug->mark();
24 }
25
26 $this->menu_id = $id;
27 $this->menu_name = $name;
28 $this->menu_lib = $lib;
29 $this->menu_ext = $ext;
30
31 $this->menu_metaboxes = array(
32 'plugin' => _x( 'Plugin Settings', 'metabox title', 'wpsso' ),
33 'services' => _x( 'Service APIs', 'metabox title', 'wpsso' ),
34 'doc_types' => _x( 'Document Types', 'metabox title', 'wpsso' ),
35 'schema_defs' => _x( 'Schema Defaults', 'metabox title', 'wpsso' ),
36 'metadata' => _x( 'Attributes and Metadata', 'metabox title', 'wpsso' ),
37 'user_about' => _x( 'About the User', 'metabox title', 'wpsso' ),
38 'contact_fields' => _x( 'Contact Fields', 'metabox title', 'wpsso' ),
39 'head_tags' => _x( 'HTML Tags', 'metabox title', 'wpsso' ),
40 );
41 }
42
43 /*
44 * Add metaboxes for this settings page.
45 *
46 * See WpssoAdmin->load_settings_page().
47 */
48 protected function add_settings_page_metaboxes( $callback_args = array() ) {
49
50 if ( $this->p->debug->enabled ) {
51
52 $this->p->debug->mark();
53 }
54
55 $this->maybe_show_language_notice();
56
57 $callback_args[ 'select' ] = array(
58 'article_sections' => $this->p->util->get_article_sections(),
59 'google_prod_cats' => $this->p->util->get_google_product_categories(),
60 'mrp' => $this->p->util->get_form_cache( 'mrp_names', $add_none = true ),
61 'og_types' => $this->p->util->get_form_cache( 'og_types_select' ),
62 'org' => $this->p->util->get_form_cache( 'org_names', $add_none = true ),
63 'person' => $this->p->util->get_form_cache( 'person_names', $add_none = true ),
64 'place' => $this->p->util->get_form_cache( 'place_names', $add_none = true ),
65 'place_custom' => $this->p->util->get_form_cache( 'place_names_custom', $add_none = true ),
66 'place_types' => $this->p->util->get_form_cache( 'place_types_select' ),
67 'schema_types' => $this->p->util->get_form_cache( 'schema_types_select' ),
68 );
69
70 parent::add_settings_page_metaboxes( $callback_args );
71 }
72
73 /*
74 * Callback method must be public for add_meta_box() hook.
75 *
76 * See WpssoAdmin->add_settings_page_metaboxes().
77 */
78 public function show_metabox_plugin( $obj, $mb ) {
79
80 if ( $this->p->debug->enabled ) {
81
82 $this->p->debug->mark();
83 }
84
85 $tabs = array(
86 'settings' => _x( 'Plugin Admin', 'metabox tab', 'wpsso' ),
87 'integration' => _x( 'Integration', 'metabox tab', 'wpsso' ),
88 'default_text' => _x( 'Default Text', 'metabox tab', 'wpsso' ),
89 'image_sizes' => _x( 'Image Sizes', 'metabox tab', 'wpsso' ),
90 'interface' => _x( 'Interface', 'metabox tab', 'wpsso' ),
91 );
92
93 $this->show_metabox_tabbed( $obj, $mb, $tabs );
94 }
95
96 /*
97 * Callback method must be public for add_meta_box() hook.
98 *
99 * See WpssoAdmin->add_settings_page_metaboxes().
100 */
101 public function show_metabox_services( $obj, $mb ) {
102
103 if ( $this->p->debug->enabled ) {
104
105 $this->p->debug->mark();
106 }
107
108 $tabs = array(
109 'media' => _x( 'Media Services', 'metabox tab', 'wpsso' ),
110 'shortening' => _x( 'Shortening Services', 'metabox tab', 'wpsso' ),
111 'ratings_reviews' => _x( 'Ratings and Reviews', 'metabox tab', 'wpsso' ),
112 );
113
114 $this->show_metabox_tabbed( $obj, $mb, $tabs );
115 }
116
117 /*
118 * Callback method must be public for add_meta_box() hook.
119 *
120 * See WpssoAdmin->add_settings_page_metaboxes().
121 */
122 public function show_metabox_doc_types( $obj, $mb ) {
123
124 if ( $this->p->debug->enabled ) {
125
126 $this->p->debug->mark();
127 }
128
129 $tabs = array(
130 'og_types' => _x( 'Open Graph', 'metabox tab', 'wpsso' ),
131 'schema_types' => _x( 'Schema', 'metabox tab', 'wpsso' ),
132 );
133
134 $this->show_metabox_tabbed( $obj, $mb, $tabs );
135 }
136
137 /*
138 * Callback method must be public for add_meta_box() hook.
139 *
140 * See WpssoAdmin->add_settings_page_metaboxes().
141 */
142 public function show_metabox_schema_defs( $obj, $mb ) {
143
144 if ( $this->p->debug->enabled ) {
145
146 $this->p->debug->mark();
147 }
148
149 $tabs = array(
150 'article' => _x( 'Article', 'metabox tab', 'wpsso' ),
151 'book' => _x( 'Book', 'metabox tab', 'wpsso' ),
152 'creative_work' => _x( 'Creative Work', 'metabox tab', 'wpsso' ),
153 'event' => _x( 'Event', 'metabox tab', 'wpsso' ),
154 'job_posting' => _x( 'Job Posting', 'metabox tab', 'wpsso' ),
155 'place' => _x( 'Place', 'metabox tab', 'wpsso' ),
156 'product' => _x( 'Product', 'metabox tab', 'wpsso' ),
157 'profile_page' => _x( 'Profile Page', 'metabox tab', 'wpsso' ),
158 'review' => _x( 'Review', 'metabox tab', 'wpsso' ),
159 'service' => _x( 'Service', 'metabox tab', 'wpsso' ),
160 );
161
162 $this->show_metabox_tabbed( $obj, $mb, $tabs );
163 }
164
165 /*
166 * Callback method must be public for add_meta_box() hook.
167 *
168 * See WpssoAdmin->add_settings_page_metaboxes().
169 */
170 public function show_metabox_contact_fields( $obj, $mb ) {
171
172 if ( $this->p->debug->enabled ) {
173
174 $this->p->debug->mark();
175 }
176
177 $args = isset( $mb[ 'args' ] ) ? $mb[ 'args' ] : array();
178 $metabox_id = isset( $args[ 'metabox_id' ] ) ? $args[ 'metabox_id' ] : '';
179
180 /*
181 * Translate contact method field labels for current language.
182 */
183 SucomUtilOptions::transl_key_values( '/^plugin_(cm_.*_label|.*_prefix)$/', $this->p->options, 'wpsso' );
184
185 $info_msg = $this->p->msgs->get( 'info-' . $metabox_id );
186
187 $this->p->util->metabox->do_table( array( '<td>' . $info_msg . '</td>' ), $class_href_key = 'metabox-info metabox-' . $metabox_id . '-info' );
188
189 $tabs = array(
190 'default_cm' => _x( 'Default Contacts', 'metabox tab', 'wpsso' ),
191 'custom_cm' => _x( 'Custom Contacts', 'metabox tab', 'wpsso' ),
192 );
193
194 $this->show_metabox_tabbed( $obj, $mb, $tabs );
195 }
196
197 /*
198 * Callback method must be public for add_meta_box() hook.
199 *
200 * See WpssoAdmin->add_settings_page_metaboxes().
201 */
202 public function show_metabox_metadata( $obj, $mb ) {
203
204 if ( $this->p->debug->enabled ) {
205
206 $this->p->debug->mark();
207 }
208
209 $tabs = array(
210 'product_attrs' => _x( 'Product Attributes', 'metabox tab', 'wpsso' ),
211 'custom_fields' => _x( 'Custom Fields', 'metabox tab', 'wpsso' ),
212 );
213
214 $this->show_metabox_tabbed( $obj, $mb, $tabs );
215 }
216
217 /*
218 * Callback method must be public for add_meta_box() hook.
219 *
220 * See WpssoAdmin->add_settings_page_metaboxes().
221 */
222 public function show_metabox_head_tags( $obj, $mb ) {
223
224 if ( $this->p->debug->enabled ) {
225
226 $this->p->debug->mark();
227 }
228
229 $metabox_id = isset( $mb[ 'args' ][ 'metabox_id' ] ) ? $mb[ 'args' ][ 'metabox_id' ] : '';
230
231 $info_msg = $this->p->msgs->get( 'info-' . $metabox_id );
232
233 $this->p->util->metabox->do_table( array( '<td>' . $info_msg . '</td>' ), $class_href_key = 'metabox-info metabox-' . $metabox_id . '-info' );
234
235 $tabs = array(
236 'facebook' => _x( 'Facebook', 'metabox tab', 'wpsso' ),
237 'open_graph' => _x( 'Open Graph', 'metabox tab', 'wpsso' ),
238 'twitter' => _x( 'X (Twitter)', 'metabox tab', 'wpsso' ),
239 'seo_other' => _x( 'SEO / Other', 'metabox tab', 'wpsso' ),
240 );
241
242 $this->show_metabox_tabbed( $obj, $mb, $tabs );
243 }
244
245 protected function get_table_rows( $page_id, $metabox_id, $tab_key = '', $args = array() ) {
246
247 $table_rows = array();
248 $match_rows = trim( $page_id . '-' . $metabox_id . '-' . $tab_key, '-' );
249
250 switch ( $match_rows ) {
251
252 case 'advanced-plugin-settings':
253 case 'site-advanced-plugin-settings':
254
255 $cache_val = $this->p->get_const_status( 'CACHE_DISABLE' ) ? 1 : 0;
256 $debug_val = $this->p->get_const_status( 'DEBUG_HTML' ) ? 1 : 0;
257 $cache_status = $this->p->get_const_status_transl( 'CACHE_DISABLE' );
258 $debug_status = $this->p->get_const_status_transl( 'DEBUG_HTML' );
259
260 $table_rows[ 'plugin_clean_on_uninstall' ] = '' .
261 $this->form->get_th_html( _x( 'Remove Settings on Uninstall', 'option label', 'wpsso' ),
262 $css_class = '', $css_id = 'plugin_clean_on_uninstall' ) .
263 '<td>' . $this->form->get_checkbox( 'plugin_clean_on_uninstall' ) . '</td>' .
264 self::get_option_site_use( 'plugin_clean_on_uninstall', $this->form, $args[ 'network' ] );
265
266 $table_rows[ 'plugin_schema_json_min' ] = '' .
267 $this->form->get_th_html( _x( 'Minimize Schema JSON-LD', 'option label', 'wpsso' ),
268 $css_class = '', $css_id = 'plugin_schema_json_min' ) .
269 '<td>' . $this->form->get_checkbox( 'plugin_schema_json_min' ) . '</td>' .
270 self::get_option_site_use( 'plugin_schema_json_min', $this->form, $args[ 'network' ] );
271
272 $table_rows[ 'plugin_load_mofiles' ] = '' .
273 $this->form->get_th_html( _x( 'Use Plugin MO Translations', 'option label', 'wpsso' ),
274 $css_class = '', $css_id = 'plugin_load_mofiles' ) .
275 '<td>' . $this->form->get_checkbox( 'plugin_load_mofiles' ) . '</td>' .
276 self::get_option_site_use( 'plugin_load_mofiles', $this->form, $args[ 'network' ] );
277
278 $table_rows[ 'plugin_debug_html' ] = '' .
279 $this->form->get_th_html( _x( 'Add Debug Messages to HTML', 'option label', 'wpsso' ),
280 $css_class = '', $css_id = 'plugin_debug_html' ) .
281 '<td>' . ( ! $args[ 'network' ] && $debug_status ?
282 $this->form->get_hidden( 'plugin_debug_html', 0 ) . // Uncheck if a constant is defined.
283 $this->form->get_no_checkbox( 'plugin_debug_html', $css_class = '', $css_id = '', $debug_val ) . ' ' . $debug_status :
284 $this->form->get_checkbox( 'plugin_debug_html' ) ) . '</td>' .
285 self::get_option_site_use( 'plugin_debug_html', $this->form, $args[ 'network' ] );
286
287 $table_rows[ 'plugin_cache_disable' ] = '' .
288 $this->form->get_th_html( _x( 'Disable Cache for Debugging', 'option label', 'wpsso' ),
289 $css_class = '', $css_id = 'plugin_cache_disable' ) .
290 '<td>' . ( ! $args[ 'network' ] && $cache_status ?
291 $this->form->get_hidden( 'plugin_cache_disable', 0 ) . // Uncheck if a constant is defined.
292 $this->form->get_no_checkbox( 'plugin_cache_disable', $css_class = '', $css_id = '', $cache_val ) . ' ' . $cache_status :
293 $this->form->get_checkbox( 'plugin_cache_disable' ) ) . '</td>' .
294 self::get_option_site_use( 'plugin_cache_disable', $this->form, $args[ 'network' ] );
295
296 break;
297 }
298
299 return $table_rows;
300 }
301 }
302 }
303