PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 18.8
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v18.8
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 18.8, at src/helpers/aioseo-helper.php

68 lines 1.3 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 use Yoast\WP\SEO\Helpers\Wpdb_Helper;
7
8 /**
9 * The AIOSEO Helper.
10 */
11 class Aioseo_Helper {
12
13 /**
14 * The WordPress database instance.
15 *
16 * @var wpdb
17 */
18 protected $wpdb;
19
20 /**
21 * The wpdb helper.
22 *
23 * @var Wpdb_Helper
24 */
25 protected $wpdb_helper;
26
27 /**
28 * Class constructor.
29 *
30 * @param wpdb $wpdb The WordPress database instance.
31 * @param Wpdb_Helper $wpdb_helper The wpdb helper.
32 */
33 public function __construct(
34 wpdb $wpdb,
35 Wpdb_Helper $wpdb_helper
36 ) {
37 $this->wpdb = $wpdb;
38 $this->wpdb_helper = $wpdb_helper;
39 }
40
41 /**
42 * Retrieves the AIOSEO table name along with the db prefix.
43 *
44 * @return string The AIOSEO table name along with the db prefix.
45 */
46 public function get_table() {
47 return $this->wpdb->prefix . 'aioseo_posts';
48 }
49
50 /**
51 * Determines if the AIOSEO database table exists.
52 *
53 * @return bool True if the table is found.
54 */
55 public function aioseo_exists() {
56 return $this->wpdb_helper->table_exists( $this->get_table() ) === true;
57 }
58
59 /**
60 * Retrieves the option where the global settings exist.
61 *
62 * @return array The option where the global settings exist.
63 */
64 public function get_global_option() {
65 return \json_decode( \get_option( 'aioseo_options', '' ), true );
66 }
67 }
68