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
← All changes | lib/admin-head-suggest.php +72 -0 22.2.022.7.0 View file →
@@ -1,0 +1,72 @@
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( 'WpssoAdminHeadSuggest' ) ) {
19 +
20 + class WpssoAdminHeadSuggest {
21 +
22 + private $p; // Wpsso class object.
23 +
24 + /*
25 + * Instantiated by WpssoAdminHead->__construct().
26 + */
27 + public function __construct( &$plugin ) {
28 +
29 + $this->p =& $plugin;
30 +
31 + if ( $this->p->debug->enabled ) {
32 +
33 + $this->p->debug->mark();
34 + }
35 +
36 + add_action( 'admin_head', array( $this, 'suggest' ), 100, 0 );
37 + }
38 +
39 + public function suggest( $suggest_max = 2 ) {
40 +
41 + if ( $this->p->debug->enabled ) {
42 +
43 + $this->p->debug->log_args( array(
44 + 'suggest_max' => $suggest_max,
45 + ) );
46 + }
47 +
48 + $suggested = 0;
49 +
50 + /*
51 + * Suggest options, addons, and attributes, in that order.
52 + */
53 + foreach ( array( 'options', 'addons', 'attributes' ) as $suffix ) {
54 +
55 + require_once WPSSO_PLUGINDIR . 'lib/admin-head-suggest-' . $suffix . '.php';
56 +
57 + $classname = 'wpssoadminheadsuggest' . $suffix;
58 + $suggest_obj = new $classname( $this->p );
59 + $suggested = $suggested + $suggest_obj->suggest( $suggest_max - $suggested );
60 +
61 + if ( $suggested >= $suggest_max ) break;
62 + }
63 +
64 + if ( $this->p->debug->enabled ) {
65 +
66 + $this->p->debug->log( 'return suggested = ' . $suggested );
67 + }
68 +
69 + return $suggested;
70 + }
71 + }
72 +}