ads
1 week ago
groups
1 week ago
metaboxes
1 year ago
pages
3 months ago
placements
1 week ago
class-action-links.php
1 week ago
class-addon-box.php
1 year ago
class-addon-updater.php
3 months ago
class-admin-menu.php
1 week ago
class-admin-notices.php
1 year ago
class-ajax.php
3 months ago
class-assets.php
1 week ago
class-authors.php
1 year ago
class-edd-updater.php
4 weeks ago
class-list-filters.php
1 week ago
class-marketing.php
1 year ago
class-metabox-ad-settings.php
1 year ago
class-metabox-ad.php
1 year ago
class-misc.php
1 week ago
class-page-quick-edit.php
1 year ago
class-plugin-installer.php
1 year ago
class-post-list.php
1 year ago
class-post-types.php
1 week ago
class-screen-options.php
3 months ago
class-settings.php
1 year ago
class-shortcode-creator.php
1 year ago
class-system-info.php
1 year ago
class-tinymce.php
2 years ago
class-translation-promo.php
1 year ago
class-upgrades.php
1 year ago
class-version-control.php
3 months ago
class-welcome.php
1 year ago
class-wordpress-dashboard.php
1 year ago
index.php
2 years ago
class-marketing.php
81 lines
| 1 | <?php |
| 2 | /** |
| 3 | * The class is responsible for adding marketing widgets to the plugin. |
| 4 | * |
| 5 | * @package AdvancedAds |
| 6 | * @author Advanced Ads <info@wpadvancedads.com> |
| 7 | * @since 1.48.0 |
| 8 | */ |
| 9 | |
| 10 | namespace AdvancedAds\Admin; |
| 11 | |
| 12 | use AdvancedAds\Constants; |
| 13 | use AdvancedAds\Framework\Interfaces\Integration_Interface; |
| 14 | |
| 15 | defined( 'ABSPATH' ) || exit; |
| 16 | |
| 17 | /** |
| 18 | * Marketing. |
| 19 | */ |
| 20 | class Marketing implements Integration_Interface { |
| 21 | |
| 22 | /** |
| 23 | * Hook into WordPress. |
| 24 | * |
| 25 | * @return void |
| 26 | */ |
| 27 | public function hooks(): void { |
| 28 | add_action( 'add_meta_boxes_' . Constants::POST_TYPE_AD, [ $this, 'add_meta_boxes' ] ); |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Add meta boxes |
| 33 | * |
| 34 | * @return void |
| 35 | */ |
| 36 | public function add_meta_boxes(): void { |
| 37 | if ( ! defined( 'AAP_VERSION' ) ) { |
| 38 | add_meta_box( |
| 39 | 'advads-pro-pitch', |
| 40 | __( 'Increase your ad revenue', 'advanced-ads' ), |
| 41 | [ $this, 'display_metabox' ], |
| 42 | Constants::POST_TYPE_AD, |
| 43 | 'side', |
| 44 | 'low' |
| 45 | ); |
| 46 | } |
| 47 | |
| 48 | if ( ! defined( 'AAT_VERSION' ) ) { |
| 49 | add_meta_box( |
| 50 | 'advads-tracking-pitch', |
| 51 | __( 'Statistics', 'advanced-ads' ), |
| 52 | [ $this, 'display_metabox' ], |
| 53 | Constants::POST_TYPE_AD, |
| 54 | 'normal', |
| 55 | 'low' |
| 56 | ); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Display metaboxes by their id. |
| 62 | * |
| 63 | * @param WP_Post $post WP_Post object. |
| 64 | * @param array $box meta box information. |
| 65 | * |
| 66 | * @return void |
| 67 | */ |
| 68 | public function display_metabox( $post, $box ): void { |
| 69 | $views = [ |
| 70 | 'advads-pro-pitch' => 'marketing/ad-metabox-all-access.php', |
| 71 | 'advads-tracking-pitch' => 'marketing/ad-metabox-tracking.php', |
| 72 | ]; |
| 73 | |
| 74 | $view = $views[ $box['id'] ] ?? false; |
| 75 | |
| 76 | if ( $view ) { |
| 77 | require_once ADVADS_ABSPATH . 'views/' . $view; |
| 78 | } |
| 79 | } |
| 80 | } |
| 81 |