<?php require_once '../../../web_construction_set/autoload.php'; $proxy = new \WebConstructionSet\ContentModifier\Proxy($_SERVER['QUERY_STRING']); $mod = new \WebConstructionSet\ContentModifier\Proxy\Modifier\Html(); $mod->base(function ($href) { $href = preg_replace('/^\\s+/', '', $href); if (preg_match('~^\\w+://~', $href)) { return $href; } if (preg_match('~^//~', $href)) { return $href; } if (preg_match('~^/~', $href)) { return \WebConstructionSet\Url\Tools::makeServerUrl($_SERVER['QUERY_STRING']) . $href; } if ($href) { return dirname($_SERVER['QUERY_STRING']) . '/' . $href; } return $_SERVER['QUERY_STRING']; }); $jq = new \WebConstructionSet\ContentModifier\JQuery(); $mod->addScript(null, $jq->getJs('jQuery_proxy')); $mod->addScript(\WebConstructionSet\Url\Tools::getNeighbourUrl('proxy.js')); $proxy->addModifier($mod); $proxy->run();
switch ($_GET['selector_type']) { case 'class': $selector = new \WebConstructionSet\ContentModifier\Js\Selector\HtmlClass($_GET['selector']); break; case 'id': $selector = new \WebConstructionSet\ContentModifier\Js\Selector\Id($_GET['selector']); break; case 'composite': $selector = new \WebConstructionSet\ContentModifier\Js\Selector\Composite(explode(',', $_GET['selector'])); break; default: echo "// unknown selector_type"; exit; } switch ($_GET['modifier_type']) { case 'append': $modifier = new \WebConstructionSet\ContentModifier\Js\Modifier\Append($_GET['modifier']); break; case 'replace': $modifier = new \WebConstructionSet\ContentModifier\Js\Modifier\Replace($_GET['modifier']); break; default: echo "// unknown modifier_type"; exit; } $js = new \WebConstructionSet\ContentModifier\Js(); $js->addModifier($selector, $modifier); $jq = new \WebConstructionSet\ContentModifier\JQuery(); $jqObjName = 'jsTest'; echo $jq->getJs($jqObjName); echo $js->getJs($jqObjName);