PostSettings.php
1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
namespace AIOSEO\Plugin\Lite\Admin;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
use AIOSEO\Plugin\Common\Admin as CommonAdmin;
/**
* Abstract class that Pro and Lite both extend.
*
* @since 4.0.0
*/
class PostSettings extends CommonAdmin\PostSettings {
/**
* Initialize the admin.
*
* @since 4.0.0
*
* @return void
*/
public function __construct() {
parent::__construct();
}
/**
* Add upsell to terms.
*
* @since 4.0.0
*
* @return void
*/
public function init() {
if ( is_admin() ) {
$taxonomies = aioseo()->helpers->getPublicTaxonomies();
foreach ( $taxonomies as $taxonomy ) {
add_action( $taxonomy['name'] . '_edit_form', [ $this, 'addTaxonomyUpsell' ] );
add_action( 'after-' . $taxonomy['name'] . '-table', [ $this, 'addTaxonomyUpsell' ] );
}
}
}
/**
* Add Taxonomy Upsell
*
* @since 4.0.0
*
* @return void
*/
public function addTaxonomyUpsell() {
$screen = get_current_screen();
if (
! isset( $screen->parent_base ) ||
'edit' !== $screen->parent_base ||
empty( $screen->taxonomy )
) {
return;
}
include_once AIOSEO_DIR . '/app/Lite/Views/taxonomy-upsell.html';
}
}