/** * Adds Inbound Rocket link to top-level admin bar */ function add_inboundrocket_link_to_admin_bar($wp_admin_bar) { global $wp_version; if (!current_user_can('activate_plugins')) { if (!array_key_exists('ir_grant_access_to_' . inboundrocket_get_user_role(), get_option('inboundrocket_options'))) { return FALSE; } } $args = array('id' => 'inboundrocket-admin-menu', 'title' => '<span class="ab-icon" ' . ($wp_version < 3.8 && !is_plugin_active('mp6/mp6.php') ? ' style="margin-top: 3px;"' : '') . '><img src="' . content_url() . '/plugins/inbound-rocket/img/inboundrocket-svg-icon.svg" style="height:16px; width:16px;"></span><span class="ab-label">Inbound Rocket</span>', 'parent' => FALSE, 'href' => admin_url('admin.php?page=inboundrocket_stats'), 'meta' => array('title' => 'Inbound Rocket')); $wp_admin_bar->add_node($args); }
/** * Checks whether or not to ignore the logged in user in the Inbound Rocket tracking scripts * */ function inboundrocket_ignore_logged_in_user() { // ignore logged in users if defined in settings if (is_user_logged_in()) { $options = get_option('inboundrocket_options'); if (array_key_exists('ir_do_not_track_' . inboundrocket_get_user_role(), $options)) { return TRUE; } else { return FALSE; } } else { return FALSE; } }
/** * Adds Inbound Rocket menu to /wp-admin sidebar */ function inboundrocket_add_menu_items() { $options = get_option('inboundrocket_options'); global $submenu; global $wp_version; $capability = 'activate_plugins'; if (!current_user_can('activate_plugins')) { if (!array_key_exists('ir_grant_access_to_' . inboundrocket_get_user_role(), $options)) { return FALSE; } else { if (current_user_can('manage_network')) { // super admin $capability = 'manage_network'; } else { if (current_user_can('edit_pages')) { // editor $capability = 'edit_pages'; } else { if (current_user_can('publish_posts')) { // author $capability = 'publish_posts'; } else { if (current_user_can('edit_posts')) { // contributor $capability = 'edit_posts'; } else { if (current_user_can('read')) { // subscriber $capability = 'read'; } } } } } } } self::check_admin_action(); if (ini_get('allow_url_fopen')) { $inboundrocket_icon = $wp_version < 3.8 && !is_plugin_active('mp6/mp6.php') ? INBOUNDROCKET_PATH . '/img/inboundrocket-icon-32x32.png' : 'data:image/svg+xml;base64,' . base64_encode(@file_get_contents(INBOUNDROCKET_PATH . '/img/inboundrocket-svg-icon.svg')); } else { $inboundrocket_icon = INBOUNDROCKET_PATH . '/img/inboundrocket-icon-32x32.png'; } add_menu_page('Inbound Rocket', 'Inbound Rocket', $capability, 'inboundrocket_stats', array($this, 'inboundrocket_build_stats_page'), $inboundrocket_icon, '25.10167'); foreach ($this->admin_power_ups as $power_up) { if ($power_up->activated) { $power_up->admin_init(); // Creates the menu icon for power-up if it's set. Overrides the main Inbound Rocket menu to hit the contacts power-up if ($power_up->menu_text) { add_submenu_page('inboundrocket_stats', $power_up->menu_text, $power_up->menu_text, $capability, 'inboundrocket_' . $power_up->menu_link, array($power_up, 'power_up_setup_callback')); } } } add_submenu_page('inboundrocket_stats', __('Lead Lists', 'inboundrocket'), __('Lead Lists', 'inboundrocket'), $capability, 'inboundrocket_lead_lists', array(&$this, 'inboundrocket_build_lead_list_page')); add_submenu_page('inboundrocket_stats', __('Settings', 'inboundrocket'), __('Settings', 'inboundrocket'), 'activate_plugins', 'inboundrocket_settings', array(&$this, 'inboundrocket_plugin_options')); add_submenu_page('inboundrocket_stats', __('Power-ups', 'inboundrocket'), __('Power-ups', 'inboundrocket'), 'activate_plugins', 'inboundrocket_power_ups', array(&$this, 'inboundrocket_power_ups_page')); if (!inboundrocket_check_premium_user()) { add_submenu_page('inboundrocket_stats', __('Upgrade to Premium', 'inboundrocket'), __('Upgrade to Premium', 'inboundrocket'), 'activate_plugins', 'inboundrocket_premium_upgrade', array(&$this, 'inboundrocket_premium_upgrade_page')); } $submenu['inboundrocket_stats'][0][0] = 'Stats'; }