function magiczoom($content, $currentController = false, $type = false, $info = false) { if ($currentController->config->get('magiczoom_status') != 0) { $tool =& magiczoom_load_core_class($currentController); //set_params_from_config($currentController->config); $enabled_on_this_page = false; unset($GLOBALS['magictoolbox']['items']); $tool->params->set('disable-zoom', 'No'); if ($tool->type == 'standard') { //do not apply MSS-like modules to category & product pages if ($type && $type == 'category' && !$tool->params->checkValue('use-effect-on-category-page', 'No')) { $enabled_on_this_page = true; } if ($type && $type == 'manufacturers' && !$tool->params->checkValue('use-effect-on-manufacturers-page', 'No')) { $enabled_on_this_page = true; } if ($type && $type == 'product' && !$tool->params->checkValue('use-effect-on-product-page', 'No')) { $enabled_on_this_page = true; $tool->params->set('disable-zoom', $GLOBALS['magictoolbox']['product-disable-zoom']); } } if ($tool->type == 'circle') { //Apply 360 only to Products Page if ($type && $type == 'product') { $enabled_on_this_page = true; } } else { if ($type && ($type == 'latest_home_category' || $type == 'latest_home' || $type == 'latest_right' || $type == 'latest_left' || $type == 'latest_content_top' || $type == 'latest_content_bottom' || $type == 'latest_column_left' || $type == 'latest_column_right') && !$tool->params->checkValue('use-effect-on-latest-box', 'No')) { $enabled_on_this_page = true; } if ($type && ($type == 'featured_home' || $type == 'featured_right' || $type == 'featured_left' || $type == 'featured_left' || $type == 'featured_content_top' || $type == 'featured_content_bottom' || $type == 'featured_column_left' || $type == 'featured_column_right') && !$tool->params->checkValue('use-effect-on-featured-box', 'No')) { $enabled_on_this_page = true; } if ($type && ($type == 'special_home' || $type == 'special_right' || $type == 'special_left' || $type == 'special_content_top' || $type == 'special_content_bottom' || $type == 'special_column_left' || $type == 'special_column_right') && !$tool->params->checkValue('use-effect-on-special-box', 'No')) { $enabled_on_this_page = true; } if ($type && ($type == 'bestseller_home' || $type == 'bestseller_right' || $type == 'bestseller_left' || $type == 'bestseller_content_top' || $type == 'bestseller_content_bottom' || $type == 'bestseller_column_left' || $type == 'bestseller_column_right') && !$tool->params->checkValue('use-effect-on-bestsellers-box', 'No')) { $enabled_on_this_page = true; } } //if ($type == 'product' || $type == 'category') { //hack! TODO: load headers only if we need them // $content = set_headers($content); //} if ($enabled_on_this_page) { if ($type) { $GLOBALS['magictoolbox']['page_type'] = $type; } if ($info) { $GLOBALS['magictoolbox']['prods_info'] = $info; } $content = set_headers($content); $content = parse_contents($content, $currentController); if ($type == 'product' && $tool->type == 'standard' && isset($GLOBALS['magictoolbox']['MagicZoom']['main'])) { // template helper class require_once dirname(__FILE__) . '/magictoolbox.templatehelper.class.php'; MagicToolboxTemplateHelperClass::setPath(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'templates'); MagicToolboxTemplateHelperClass::setOptions($tool->params); $html = MagicToolboxTemplateHelperClass::render(array('main' => $GLOBALS['magictoolbox']['MagicZoom']['main'], 'thumbs' => count($GLOBALS['magictoolbox']['MagicZoom']['selectors']) > 1 ? $GLOBALS['magictoolbox']['MagicZoom']['selectors'] : array(), 'pid' => $GLOBALS['magictoolbox']['prods_info']['product_id'])); $content = str_replace('MAGICTOOLBOX_PLACEHOLDER', $html, $content); } } } return $content; }
function process($url, $validname) { global $wrap; $contents = cURL_it($validname, $url); if ($contents) { print ""; } else { print "{$wrap} bad post [{$validname}] {$wrap} "; } $arr = parse_contents($contents); return $arr; }
if ($fn == '.' || $fn == '..' || $fn == 'tap.php') { continue; } array_push($files, $fn); } $tests += count($files); plan($tests); foreach ($files as $fn) { $file = join(DIRECTORY_SEPARATOR, array($td, $fn)); $file = '"' . preg_replace('/\\"/', '\\"', $file) . '"'; $exec = "(cd {$tdq} && {$bin} {$file})"; ob_start(); system($exec, $res); $test = ob_get_contents(); ob_end_clean(); $out = parse_contents($fn, $test); preg_match('/^(\\d+)\\/(\\d+)\\/(\\d+)$/', $out, $matches); $opass = $matches[1]; $ofail = $matches[2]; $oall = $matches[3]; $pass += $opass > $oall ? $oall : $opass; $fail += $ofail; $all += $oall; $name = "{$fn} ({$oall} subtests)"; if (!is($opass, $oall, $name)) { array_push($failed, $fn); } } notate("finished testing files"); is($pass, $all, "All {$all} subtests pass"); $allpass = is(count($failed), 0, 'Test failures is empty');