/** * Adds a Global Alternative Experiment in the appropriate property. * * @param NelioABGlobalAlternativeExperiment $exp The Alternative Experiment to be added. * @param int $alt_index The index of the alternative that this visitor is supposed to see. * If 0, the original version is added; if 1, the first * alternative; if 2, the second; and so on. * * @since 4.0.0 */ private static function add_global_exp($exp, $alt_index) { $alt = $exp->get_original(); if ($alt_index > 0) { --$alt_index; $alts = $exp->get_alternatives(); if ($alt_index < count($alts)) { $alt = $alts[$alt_index]; } } switch ($exp->get_type()) { case NelioABExperiment::CSS_ALT_EXP: self::$css_info = array('exp' => $exp, 'alt' => $alt); break; case NelioABExperiment::MENU_ALT_EXP: self::$menu_info = array('exp' => $exp, 'alt' => $alt); break; case NelioABExperiment::THEME_ALT_EXP: self::$theme_info = array('exp' => $exp, 'alt' => $alt); break; case NelioABExperiment::WIDGET_ALT_EXP: self::$widget_info = array('exp' => $exp, 'alt' => $alt); break; } }