| 1 |
<?php |
| 2 |
namespace ULTP; |
| 3 |
|
| 4 |
defined('ABSPATH') || exit; |
| 5 |
|
| 6 |
class Options{ |
| 7 |
public function __construct() { |
| 8 |
add_action( 'admin_menu', array( $this, 'menu_page_callback' ) ); |
| 9 |
add_action( 'in_admin_header', array($this, 'remove_all_notices') ); |
| 10 |
add_filter( 'plugin_row_meta', array( $this, 'plugin_settings_meta' ), 10, 2 ); |
| 11 |
add_filter( 'plugin_action_links_'.ULTP_BASE, array( $this, 'plugin_action_links_callback' ) ); |
| 12 |
} |
| 13 |
|
| 14 |
|
| 15 |
public function plugin_settings_meta( $links, $file ) { |
| 16 |
if ( strpos( $file, 'ultimate-post.php' ) !== false ) { |
| 17 |
$new_links = array( |
| 18 |
'ultp_docs' => '<a href="https://docs.wpxpo.com/" target="_blank">'.__('Docs', 'ultimate-post').'</a>', |
| 19 |
'ultp_tutorial' => '<a href="https://www.youtube.com/watch?v=JZxIflYKOuM&list=PLPidnGLSR4qcAwVwIjMo1OVaqXqjUp_s4" target="_blank">'.__('Tutorials', 'ultimate-post').'</a>', |
| 20 |
'ultp_support' => '<a href="https://www.wpxpo.com/contact/?utm_campaign=go_premium" target="_blank">'.__('Support', 'ultimate-post').'</a>' |
| 21 |
); |
| 22 |
$links = array_merge( $links, $new_links ); |
| 23 |
} |
| 24 |
return $links; |
| 25 |
} |
| 26 |
|
| 27 |
|
| 28 |
public function plugin_action_links_callback ( $links ) { |
| 29 |
$upgrade_link = array(); |
| 30 |
$setting_link = array(); |
| 31 |
if(!defined('ULTP_PRO_VER')){ |
| 32 |
$upgrade_link = array( |
| 33 |
'ultp_pro' => '<a href="https://www.wpxpo.com/gutenberg-post-blocks/?utm_campaign=go_premium" target="_blank"><span style="color: #e83838; font-weight: bold;">'.__('Go Pro', 'ultimate-post').'</span></a>' |
| 34 |
); |
| 35 |
} |
| 36 |
$setting_link['ultp_settings'] = '<a href="'. menu_page_url('ultp-option-settings', false) .'">'. __('Settings', 'wp-megamenu') .'</a>'; |
| 37 |
return array_merge( $setting_link, $links, $upgrade_link); |
| 38 |
} |
| 39 |
|
| 40 |
|
| 41 |
public static function menu_page_callback() { |
| 42 |
add_menu_page( |
| 43 |
esc_html__( 'Post Blocks', 'ultimate-post' ), |
| 44 |
esc_html__( 'Post Blocks', 'ultimate-post' ), |
| 45 |
'manage_options', |
| 46 |
'ultp-settings', |
| 47 |
'', |
| 48 |
ULTP_URL.'assets/img/menu-panel.svg' |
| 49 |
); |
| 50 |
|
| 51 |
require_once ULTP_PATH . 'classes/options/Overview.php'; |
| 52 |
require_once ULTP_PATH . 'classes/options/Features.php'; |
| 53 |
require_once ULTP_PATH . 'classes/options/Addons.php'; |
| 54 |
require_once ULTP_PATH . 'classes/options/Settings.php'; |
| 55 |
require_once ULTP_PATH . 'classes/options/Contact.php'; |
| 56 |
new \ULTP\Options_Overview(); |
| 57 |
new \ULTP\Options_Features(); |
| 58 |
new \ULTP\Options_Addons(); |
| 59 |
new \ULTP\Options_Settings(); |
| 60 |
new \ULTP\Options_Contact(); |
| 61 |
|
| 62 |
if( !function_exists('ultimate_post_pro') ){ |
| 63 |
global $submenu; |
| 64 |
$upgrade_link = 'https://www.wpxpo.com/gutenberg-post-blocks/?ultp=plugins'; |
| 65 |
$submenu['ultp-settings'][] = array( '<span class="ultp-dashboard-upgrade"><span class="dashicons dashicons-update"></span> Upgrade</span>', 'manage_options', $upgrade_link ); |
| 66 |
} |
| 67 |
} |
| 68 |
|
| 69 |
// Remove All Notification From Menu Page |
| 70 |
public static function remove_all_notices() { |
| 71 |
if ( isset( $_GET['page'] ) && ( $_GET['page'] === 'ultp-settings' || $_GET['page'] === 'ultp-features' || $_GET['page'] === 'ultp-addons' || $_GET['page'] === 'ultp-option-settings' || $_GET['page'] === 'ultp-contact' || $_GET['page'] === 'ultp-license' ) ) { |
| 72 |
remove_all_actions( 'admin_notices' ); |
| 73 |
remove_all_actions( 'all_admin_notices' ); |
| 74 |
} |
| 75 |
} |
| 76 |
} |
| 77 |
|
| 78 |
|