本文整理汇总了PHP中CopixUrl::escapeSpecialChars方法的典型用法代码示例。如果您正苦于以下问题:PHP CopixUrl::escapeSpecialChars方法的具体用法?PHP CopixUrl::escapeSpecialChars怎么用?PHP CopixUrl::escapeSpecialChars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CopixUrl
的用法示例。
在下文中一共展示了CopixUrl::escapeSpecialChars方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
/**
* Simple fonction de get pour tester les URL significatives
*/
public function get($dest, $parameters, $mode)
{
$toReturn = new CopixUrlHandlerGetResponse();
if ($dest['module'] == 'copixtest' && $dest['group'] == 'google') {
$toReturn->externUrl = 'http://www.google.fr';
return $toReturn;
}
if (isset($parameters['var'])) {
$toReturn->path = array_merge($dest, array('var' => CopixUrl::escapeSpecialChars($parameters['var'])));
unset($parameters['var']);
}
$toReturn->vars = $parameters;
return $toReturn;
}
示例2: get
/**
* Recupère les éléments de l'URL
*
* @param $dest
* @param $parameters
* @param $mode
* @return StdClass object
*/
public function get($dest, $parameters, $mode)
{
if ($mode == 'none') {
return false;
} else {
$toReturn = new stdClass();
if (isset($parameters['wsname'])) {
$toReturn->path = array_merge($dest, array('wsname' => CopixUrl::escapeSpecialChars($parameters['wsname'])));
unset($parameters['wsname']);
} else {
$toReturn->path = $dest;
}
$toReturn->vars = $parameters;
return $toReturn;
}
}
示例3: cleanCode
public function cleanCode(&$content, $title = "")
{
$content = preg_replace('/<</', '«', $content);
$content = preg_replace('/>>/', '»', $content);
$content = preg_replace('/\\(c\\)/', '©', $content);
$content = preg_replace('/\\(r\\)/', '®', $content);
$content = preg_replace('/¿/', '¿', $content);
//money
$content = preg_replace('/€/', '€', $content);
$content = preg_replace('/¥/', '¥', $content);
$content = preg_replace('/¢/', '¢', $content);
$content = preg_replace('/£/', '£', $content);
//arrows
$content = preg_replace('/-->/', '→', $content);
$content = preg_replace('/<--/', '←', $content);
$content = preg_replace('/<->/', '↔', $content);
$content = preg_replace('/==>/', '⇒', $content);
$content = preg_replace('/<==/', '⇐', $content);
$content = preg_replace('/<=>/', '⇔', $content);
//math
//$content = preg_replace('/`(.*?)`/', '&\\1;', $content);
$content = preg_replace('/=</', '≤', $content);
$content = preg_replace('/>=/', '≥', $content);
$content = preg_replace('/!=/', '≠', $content);
$content = preg_replace('/~=/', '≅', $content);
//remove tags
$content = str_replace('<', '_lower_', $content);
$content = str_replace('>', '_greater_', $content);
//now replace _lower_ and _greater_ codes...
$content = str_replace('_lower_', '<', $content);
$content = str_replace('_greater_', '>', $content);
//recreate some tags
$content = str_replace('_end_strike_', "</del>", $content);
$content = str_replace('_strike_', "<del>", $content);
//rule
$content = preg_replace('/\\n*\\-{4}\\n*/', "<hr />", $content);
//code
$content = preg_replace('/\'\'(.*?)\'\'/', "<code>\\1</code>", $content);
//links
$links = array();
preg_match_all('/\\[\\[(.*?)\\]\\]/', $content, $links);
$foundlinks = $links[1];
$i = 0;
foreach ($foundlinks as $foundlink) {
//seek if we have | to set caption
$elem = explode("|", $foundlink);
$link = $elem[0];
$caption = isset($elem[1]) ? $elem[1] : $elem[0];
$style = "wiki_exists";
//anchors
$anchor = explode("#", $link);
$link = strlen($anchor[0]) ? $anchor[0] : $title;
if (isset($anchor[1])) {
$anchor = $anchor[1];
} else {
$anchor = "";
}
//is it an external link ?
if (!preg_match('/http:/', $link)) {
//no, so i think this is a wiki link
//page exists ?
$parts = explode('/', $link);
$heading = '';
$lang = '';
if (count($parts) == 3) {
$heading = $parts[0];
$link = $parts[1];
} elseif (count($parts) == 2) {
$heading = $parts[0];
$link = $parts[1];
}
$dao = _ioDao('wikipages');
$res = $dao->findBy(_daoSp()->startGroup()->addCondition('title_wiki', "=", CopixUrl::escapeSpecialChars($link))->addCondition('heading_wiki', '=', $heading)->endGroup());
if (!$res) {
$style = "wiki_no_exists";
} else {
$anchor = preg_replace("/[^a-zA-Z0-9]/", $this->anchor_separator, $anchor);
}
$link = _url('wiki||show', array('title' => $link, 'heading' => $heading));
}
$link .= isset($anchor) && strlen($anchor) ? "#" . $anchor : "";
//now, replace link
$link = "<a href=\"" . $link . "\" title=\"" . $caption . "\" class=\"{$style}\">{$caption}</a>";
//link has "//" but this is used for italic... so we have to
//change it for now... see end function to restore links
$link = str_replace("//", "_double_slashes_", $link);
$content = str_replace($links[0][$i], $link, $content);
$i++;
}
//images
$images = array();
preg_match_all('/\\{\\{(.*?)\\}\\}/', $content, $images);
$foundimages = $images[1];
$i = 0;
foreach ($foundimages as $foundimg) {
$elem = explode(":", $foundimg);
if ($elem[0] == "file") {
//case of file
$class = "wiki_dl_file";
$image = "<a href=\"" . _url('wiki|file|getfile', array('title' => $elem[1])) . "\" title=\"" . $elem[1] . "\" class=\"{$class}\">" . $elem[1] . "</a>";
//.........这里部分代码省略.........
示例4: testEscapeSpecialChars
public function testEscapeSpecialChars()
{
$pString = 'àéïöùy';
$this->assertEquals(CopixUrl::escapeSpecialChars($pString), 'aeiouy');
$this->assertEquals(CopixUrl::escapeSpecialChars('Une ville du sud'), 'Une_ville_du_sud');
$this->assertEquals(CopixUrl::escapeSpecialChars('Une ville / Un Village'), 'Une_ville__Un_Village');
$this->assertEquals(CopixUrl::escapeSpecialChars('Une ville / Un Village', true), 'Une_ville_Un_Village');
}