function _op_launch_menu_list() { static $menu_items; if (!isset($menu_items)) { $cookie = _op_launch_cookie(); $last_page = op_get_var($cookie, 'last_page', -1); $visited_pages = op_get_var($cookie, 'visited_pages', array()); $menu_items = array(); if (op_page_option('launch_funnel', 'enabled') == 'Y' && ($launch_info = _op_launch_define())) { extract($launch_info); //if($last_page == 'sales' $hide_coming_soon = op_launch_option('hide_coming_soon', 'enabled') == 'Y'; $type = $launch_info['funnel_page']; $funnel_pages = op_launch_option('funnel_pages'); $idx = $type == 'stage' ? $launch_info['stage_idx'] : 100; $highest = $idx; $stages = $funnel_pages['stages']; $sales = op_get_var($funnel_pages, 'sales', array()); $open_cart = _op_traverse_array($sales, array('page_setup', 'open_sales_cart')) == 'Y'; $hide_cart = _op_traverse_array($sales, array('page_setup', 'hide_cart')) == 'Y'; switch (_op_launch_type()) { case 1: foreach ($stages as $key => $stage) { if ($stage['publish_stage']['publish'] == 'Y') { $menu_items[] = _op_launch_menu_item('value_page', $stage, true, $idx == $key); } elseif (!$hide_coming_soon) { $menu_items[] = _op_launch_menu_item('value_page', $stage, false); } } if (($type === 'sales' || $open_cart) && !$hide_cart) { $menu_items[] = _op_launch_menu_item('sales_page', $sales, true, $type == 'sales'); } elseif (!$hide_coming_soon && !$hide_cart) { $menu_items[] = _op_launch_menu_item('sales_page', $sales, false); } break; case 2: global $post; if ($last_page === 'sales') { $highest = count($funnel_pages['stages']); } elseif ($last_page > $idx) { $highest = $last_page; } $found = false; $visited = null; foreach ($funnel_pages['stages'] as $key => $stage) { if ($stage['publish_stage']['publish'] == 'Y') { if (in_array($stage['value_page'], $visited_pages) || $found == false || $stage['value_page'] == $post->ID) { $menu_items[] = _op_launch_menu_item('value_page', $stage, true, $idx == $key); $visited[] = $stage['value_page']; } elseif (!$hide_coming_soon) { $menu_items[] = _op_launch_menu_item('value_page', $stage, false); } if ($stage['value_page'] == $post->ID) { $found = true; } } } if (($last_page === 'sales' || $type === 'sales' || $open_cart) && !$hide_cart) { if (in_array($funnel_pages['sales']['sales_page'], $visited_pages) || $funnel_pages['sales']['sales_page'] == $post->ID) { $menu_items[] = _op_launch_menu_item('sales_page', $sales, true, $type == 'sales'); } elseif (!$hide_coming_soon) { $menu_items[] = _op_launch_menu_item('sales_page', $sales, false); } } elseif (!$hide_coming_soon && !$hide_cart) { $menu_items[] = _op_launch_menu_item('sales_page', $sales, false); } if (is_array($visited) && 0 !== count($visited)) { require_once OP_FUNC . 'launch.php'; $lf = new OptimizePress_LaunchFunnels($post->ID, $launch_info); $lf->set_cookie($idx, $visited); } break; case 3: foreach ($stages as $key => $stage) { if ($stage['publish_stage']['publish'] == 'Y') { $menu_items[] = _op_launch_menu_item('value_page', $stage, true, $idx == $key); } elseif (!$hide_coming_soon) { $menu_items[] = _op_launch_menu_item('value_page', $stage, false); } } if (($last_page === 'sales' || $type === 'sales' || $open_cart) && !$hide_cart) { $menu_items[] = _op_launch_menu_item('sales_page', $sales, true, $type == 'sales'); } elseif (!$hide_coming_soon && !$hide_cart) { $menu_items[] = _op_launch_menu_item('sales_page', $sales, false); } break; case 4: if ($last_page === 'sales') { $highest = count($funnel_pages['stages']); } elseif ($last_page > $idx) { $highest = $last_page; } foreach ($funnel_pages['stages'] as $key => $stage) { if ($stage['publish_stage']['publish'] == 'Y') { if ($highest >= $key) { $menu_items[] = _op_launch_menu_item('value_page', $stage, true, $idx == $key); } elseif (!$hide_coming_soon) { $menu_items[] = _op_launch_menu_item('value_page', $stage, false); } } elseif (!$hide_coming_soon) { $menu_items[] = _op_launch_menu_item('value_page', $stage, false); } } if (($last_page === 'sales' || $type === 'sales' || $open_cart) && !$hide_cart) { $menu_items[] = _op_launch_menu_item('sales_page', $sales, true, $type == 'sales'); } elseif (!$hide_coming_soon && !$hide_cart) { $menu_items[] = _op_launch_menu_item('sales_page', $sales, false); } break; } } } return $menu_items; }
function get_cookie() { $this->cookie = _op_launch_cookie(); if (isset($this->cookie['gateway_key_' . $this->page_id])) { $this->in_gateway_key = $this->cookie['gateway_key_' . $this->page_id]; } elseif (isset($this->cookie['gateway_key'])) { $this->in_gateway_key = $this->cookie['gateway_key']; } }
function _op_launch_menu_list() { static $menu_items; if (!isset($menu_items)) { $cookie = _op_launch_cookie(); $last_page = op_get_var($cookie, 'last_page', -1); $visited_pages = op_get_var($cookie, 'visited_pages', array()); $menu_items = array(); if (op_page_option('launch_funnel', 'enabled') == 'Y' && ($launch_info = _op_launch_define())) { extract($launch_info); //if($last_page == 'sales' $hide_coming_soon = op_launch_option('hide_coming_soon', 'enabled') == 'Y'; $type = $launch_info['funnel_page']; $funnel_pages = op_launch_option('funnel_pages'); $idx = $type == 'stage' ? $launch_info['stage_idx'] : 0; $highest = $idx; $stages = $funnel_pages['stages']; $sales = op_get_var($funnel_pages, 'sales', array()); $open_cart = _op_traverse_array($sales, array('page_setup', 'open_sales_cart')) == 'Y'; $hide_cart = _op_traverse_array($sales, array('page_setup', 'hide_cart')) == 'Y'; switch (_op_launch_type()) { case 1: foreach ($stages as $key => $stage) { if ($stage['publish_stage']['publish'] == 'Y') { $menu_items[] = _op_launch_menu_item('value_page', $stage, true, $idx == $key); } elseif (!$hide_coming_soon) { $menu_items[] = _op_launch_menu_item('value_page', $stage, false); } } if (($type === 'sales' || $open_cart) && !$hide_cart) { $menu_items[] = _op_launch_menu_item('sales_page', $sales, true, $type == 'sales'); } elseif (!$hide_coming_soon && !$hide_cart) { $menu_items[] = _op_launch_menu_item('sales_page', $sales, false); } break; case 2: if ($last_page === 'sales') { $highest = count($funnel_pages['stages']); } elseif ($last_page > $idx) { $highest = $last_page; } foreach ($funnel_pages['stages'] as $key => $stage) { if ($stage['publish_stage']['publish'] == 'Y') { //if($highest >= $key){ if (in_array($stage['value_page'], $visited_pages)) { $menu_items[] = _op_launch_menu_item('value_page', $stage, true, $idx == $key); } elseif (!$hide_coming_soon) { $menu_items[] = _op_launch_menu_item('value_page', $stage, false); } } } if (($last_page === 'sales' || $type === 'sales' || $open_cart) && !$hide_cart) { if (in_array($funnel_pages['sales']['sales_page'], $visited_pages)) { $menu_items[] = _op_launch_menu_item('sales_page', $sales, true, $type == 'sales'); } elseif (!$hide_coming_soon) { $menu_items[] = _op_launch_menu_item('sales_page', $sales, false); } } elseif (!$hide_coming_soon && !$hide_cart) { $menu_items[] = _op_launch_menu_item('sales_page', $sales, false); } break; case 3: foreach ($stages as $key => $stage) { if ($stage['publish_stage']['publish'] == 'Y') { $menu_items[] = _op_launch_menu_item('value_page', $stage, true, $idx == $key); } elseif (!$hide_coming_soon) { $menu_items[] = _op_launch_menu_item('value_page', $stage, false); } } if (($last_page === 'sales' || $type === 'sales' || $open_cart) && !$hide_cart) { $menu_items[] = _op_launch_menu_item('sales_page', $sales, true, $type == 'sales'); } elseif (!$hide_coming_soon && !$hide_cart) { $menu_items[] = _op_launch_menu_item('sales_page', $sales, false); } break; case 4: if ($last_page === 'sales') { $highest = count($funnel_pages['stages']); } elseif ($last_page > $idx) { $highest = $last_page; } foreach ($funnel_pages['stages'] as $key => $stage) { if ($stage['publish_stage']['publish'] == 'Y') { if ($highest >= $key) { $menu_items[] = _op_launch_menu_item('value_page', $stage, true, $idx == $key); } elseif (!$hide_coming_soon) { $menu_items[] = _op_launch_menu_item('value_page', $stage, false); } } elseif (!$hide_coming_soon) { $menu_items[] = _op_launch_menu_item('value_page', $stage, false); } } if (($last_page === 'sales' || $type === 'sales' || $open_cart) && !$hide_cart) { $menu_items[] = _op_launch_menu_item('sales_page', $sales, true, $type == 'sales'); } elseif (!$hide_coming_soon && !$hide_cart) { $menu_items[] = _op_launch_menu_item('sales_page', $sales, false); } break; } } } return $menu_items; }