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: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80:
<?php
class CTA_Menus {
public function __construct() {
self::load_hooks();
}
public static function load_hooks() {
add_action('admin_menu', array(__CLASS__, 'add_sub_menus'));
add_action('admin_print_footer_scripts' , array( __CLASS__ , 'print_scripts' ) );
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=wp-call-to-action', __( 'Settings', 'inbound-pro' ), __( 'Settings', 'inbound-pro' ), 'edit_ctas', 'wp_cta_global_settings', array( 'CTA_Settings', 'display_stand_alone_settings'));
add_submenu_page('edit.php?post_type=wp-call-to-action', __( 'Upgrade to Pro', 'inbound-pro' ), __( 'Upgrade to Pro', 'inbound-pro' ), 'edit_ctas', 'wp_cta_store', array( __CLASS__ , 'store_display'));
} else {
add_submenu_page('edit.php?post_type=wp-call-to-action', __('Settings', 'inbound-pro'), __('Settings', 'inbound-pro'), 'edit_ctas', 'inbound-pro-cta', array( 'CTA_Menus' , 'redirect_settings' ));
}
add_submenu_page('edit.php?post_type=wp-call-to-action', __( 'Upload Templates', 'inbound-pro' ), __( 'Upload Templates', 'inbound-pro' ), 'edit_ctas', 'wp_cta_manage_templates', array( 'CTA_Template_Manager', 'display_management_page'));
}
public static function store_display() {
}
public static function print_scripts() {
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
jQuery('#menu-posts-wp-call-to-action a[href*="wp_cta_store"]').each(function() {
jQuery(this).attr('target','_blank');
jQuery(this).attr('href','http://www.inboundnow.com/upgrade');
});
});
</script>
<?php
}
public static function redirect_inbound_pro_settings() {
if ( !isset($_GET['page']) || $_GET['page'] != 'inbound-pro-cta') {
return;
}
header('Location: ' . admin_url('admin.php?page=inbound-pro&setting=cta'));
exit;
}
}
new CTA_Menus();