public function testValues() { CopixConfig::instance()->url_requestedscript_variable = 'PHP_SELF'; // Verifions que l'on retourne le bon hote $this->assertEquals($_SERVER['HTTP_HOST'], CopixUrl::getRequestedDomain()); $this->assertRegexp('/^\\/.*test\\.php$/', CopixUrl::getRequestedScript()); $this->assertEquals('test.php', CopixUrl::getRequestedScriptName()); $this->assertEquals('http://', CopixUrl::getRequestedProtocol()); $currentUrl = CopixUrl::getCurrentUrl(); }
/** * Plugin smarty type fonction * Purpose: get the current url. * * Input: assign = (optional) name of the template variable we'll assign * the output to instead of displaying it directly * * Examples: */ function smarty_function_currenturl($params, &$this) { $assign = CopixUrl::getCurrentUrl(); if (isset($params['assign'])) { $this->assign($params['assign'], $assign); return ''; } else { return $assign; } }
/** * Plugin smarty type fonction * Purpose: get the current url. * * Input: assign = (optional) name of the template variable we'll assign * the output to instead of displaying it directly * * Examples: */ function smarty_function_currenturl($params, &$me) { if (isset($params['notxml'])) { $isxml = $params['notxml'] == 'true' ? false : true; } else { $isxml = true; } $assign = CopixUrl::getCurrentUrl($isxml); if (isset($params['assign'])) { $me->assign($params['assign'], $assign); return ''; } else { return $assign; } }
function smarty_function_commentthis($params, &$smarty) { extract($params); if (empty($displaytype)) { $displaytype = 'list'; } if (empty($type)) { $smarty->trigger_error('commentthis: missing type parameter'); } if (empty($id)) { $smarty->trigger_error('commentthis: missing id parameter'); } if (empty($dest)) { $dest = CopixUrl::get('comment||getList', array('type' => $type, 'id' => $id, 'back' => $back)); } $dao =& CopixDAOFactory::create('comment|Comment'); $services =& CopixClassesFactory::create('comment|commentservices'); $services->enableComment($id, $type); switch ($displaytype) { case 'link': $nbComment = $dao->getNbComment($id, $type); $toReturn = '<a href=' . $dest . '>' . $nbComment . ' '; $toReturn .= $nbComment > 1 ? CopixI18N::get('comment|comment.messages.comments') : CopixI18N::get('comment|comment.messages.comment'); $toReturn .= '</a>'; break; case 'form': $back = CopixUrl::getCurrentUrl(); CopixActionGroup::process('comment|comment::doPrepareAdd', array('type' => $type, 'id' => $id, 'back' => $back)); $toEdit = CopixActionGroup::process('comment|comment::_getSessionComment'); $toReturn = CopixZone::process('comment|AddComment', array('toEdit' => $toEdit)); break; case 'list': default: $toReturn = CopixZone::process('comment|CommentList', array('type' => $type, 'id' => $id)); break; } return $toReturn; }