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:
<?php
class Landing_Pages_Admin_Menus {
public function __construct() {
self::add_hooks();
}
public static function add_hooks() {
add_action('admin_menu', array(__CLASS__, 'add_sub_menus') );
add_action('admin_init', array(__CLASS__, 'redirect_inbound_pro_settings') );
}
public static function add_sub_menus() {
if ( !class_exists('Inbound_Pro_Plugin') ) {
add_submenu_page('edit.php?post_type=landing-page', __('Settings', 'landing-pages'), __('Settings', 'landing-pages'), 'edit_landing_pages', 'lp_global_settings', array('Landing_Pages_Settings' , 'display_settings'));
add_submenu_page('edit.php?post_type=landing-page', __('Upgrade to Pro' , 'landing-pages'),__('Upgrade to Pro' , 'landing-pages'), 'edit_landing_pages', 'lp_store', array( 'Inbound_Now_Store' , 'store_display' ),100);
} else {
add_submenu_page('edit.php?post_type=landing-page', __('Settings', 'landing-pages'), __('Settings', 'landing-pages'), 'edit_landing_pages', 'inbound-pro-landing-pages', array( 'Landing_Pages_Settings' , 'redirect_settings' ));
}
add_submenu_page('edit.php?post_type=landing-page', __('Upload Templates', 'landing-pages'), __('Upload Templates', 'landing-pages'), 'edit_landing_pages', 'lp_manage_templates', 'lp_manage_templates', 100);
}
public static function redirect_inbound_pro_settings() {
if ( !isset($_GET['page']) || $_GET['page'] != 'inbound-pro-landing-pages') {
return;
}
header('Location: ' . admin_url('admin.php?page=inbound-pro&setting=Landing+Pages'));
exit;
}
}
new Landing_Pages_Admin_Menus;