コード例 #1
0
ファイル: simple_mock_test.php プロジェクト: sebs/simpletest
 function testLongList()
 {
     $list = new ParameterList(array("0", 0, "wild", false), "wild");
     $this->assertTrue($list->isMatch(array("0", 0, 37, false)));
     $this->assertFalse($list->isMatch(array("0", 0, 37, true)));
     $this->assertFalse($list->isMatch(array("0", 0, 37)));
 }
コード例 #2
0
ファイル: RunData.php プロジェクト: jbzdak/wikidot
 /**
  * Initializes a RunData object.
  */
 public function init()
 {
     $parameterList = new ParameterList();
     $parameterList->initParameterList($this);
     $this->parameterList = $parameterList;
     $this->setTemplateFromParameterList();
     //set action
     $action = $this->parameterList->getParameterValue('action');
     $parameterArray = $this->parameterList->asArray();
     // now parse some importand parameters: language, skin
     if ($parameterArray["lang"] != null) {
         $this->language = $parameterArray["lang"];
     } else {
         $this->language = GlobalProperties::$DEFAULT_LANGUAGE;
     }
     if ($parameterArray["skin"] != null) {
         $this->page->setSkin($parameterArray["skin"]);
     }
     if ($action !== null && preg_match('/^[a-z0-9_\\/]+$/i', $action) == 1) {
         $this->parameterList->delParameter['action'];
         $this->action = str_replace("__", "/", $action);
         // set action event
         // this on is more complicated - extract event from a key in the parameter list
         // of the form event_someevent
         //first check if event=foobar is present
         foreach ($parameterArray as $key => $value) {
             if ($key == 'event') {
                 $this->actionEvent = $value . 'Event';
             }
         }
         foreach ($parameterArray as $key => $value) {
             if (ereg('event_', $key)) {
                 $this->actionEvent = str_replace('event_', '', $key) . 'Event';
                 break;
             }
         }
     }
     if (!preg_match(';\\.' . GlobalProperties::$URL_DOMAIN_PREG . '$;', $_SERVER['HTTP_HOST'])) {
         GlobalProperties::$SESSION_COOKIE_NAME .= "_" . substr(md5($_SERVER['HTTP_HOST']), 3, 8);
         GlobalProperties::$SESSION_COOKIE_DOMAIN = '.' . $_SERVER['HTTP_HOST'];
     }
     // initialize cookies...
     $this->cookies = $_COOKIE;
     // store original request uri and request method:
     $this->requestUri = $_SERVER['REQUEST_URI'];
     $this->requestMethod = $_SERVER['REQUEST_METHOD'];
 }