PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.2
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.2
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / src / helpers / aioseo-helper.php

aioseo-helper.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.2, at src/helpers/aioseo-helper.php

64 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Yoast\WP\SEO\Helpers;
4
5 use wpdb;
6
7 /**
8 * The AIOSEO Helper.
9 */
10 class Aioseo_Helper {
11
12 /**
13 * The WordPress database instance.
14 *
15 * @var wpdb
16 */
17 protected $wpdb;
18
19 /**
20 * The wpdb helper.
21 *
22 * @var Wpdb_Helper
23 */
24 protected $wpdb_helper;
25
26 /**
27 * Class constructor.
28 *
29 * @param wpdb $wpdb The WordPress database instance.
30 * @param Wpdb_Helper $wpdb_helper The wpdb helper.
31 */
32 public function __construct( wpdb $wpdb, Wpdb_Helper $wpdb_helper ) {
33 $this->wpdb = $wpdb;
34 $this->wpdb_helper = $wpdb_helper;
35 }
36
37 /**
38 * Retrieves the AIOSEO table name along with the db prefix.
39 *
40 * @return string The AIOSEO table name along with the db prefix.
41 */
42 public function get_table() {
43 return $this->wpdb->prefix . 'aioseo_posts';
44 }
45
46 /**
47 * Determines if the AIOSEO database table exists.
48 *
49 * @return bool True if the table is found.
50 */
51 public function aioseo_exists() {
52 return $this->wpdb_helper->table_exists( $this->get_table() ) === true;
53 }
54
55 /**
56 * Retrieves the option where the global settings exist.
57 *
58 * @return array The option where the global settings exist.
59 */
60 public function get_global_option() {
61 return \json_decode( \get_option( 'aioseo_options', '' ), true );
62 }
63 }
64