当前位置: 首页>>代码示例>>PHP>>正文


PHP CopixUrl::escapeSpecialChars方法代码示例

本文整理汇总了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;
 }
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:17,代码来源:copixtest.urlhandler.php

示例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;
     }
 }
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:24,代码来源:wsserver.urlhandler.php

示例3: cleanCode

 public function cleanCode(&$content, $title = "")
 {
     $content = preg_replace('/<</', '&laquo;', $content);
     $content = preg_replace('/>>/', '&raquo;', $content);
     $content = preg_replace('/\\(c\\)/', '&copy;', $content);
     $content = preg_replace('/\\(r\\)/', '&reg;', $content);
     $content = preg_replace('/¿/', '&iquest;', $content);
     //money
     $content = preg_replace('/€/', '&euro;', $content);
     $content = preg_replace('/¥/', '&yen;', $content);
     $content = preg_replace('/¢/', '&cent;', $content);
     $content = preg_replace('/£/', '&pound;', $content);
     //arrows
     $content = preg_replace('/-->/', '&rarr;', $content);
     $content = preg_replace('/<--/', '&larr;', $content);
     $content = preg_replace('/<->/', '&harr;', $content);
     $content = preg_replace('/==>/', '&rArr;', $content);
     $content = preg_replace('/<==/', '&lArr;', $content);
     $content = preg_replace('/<=>/', '&hArr;', $content);
     //math
     //$content = preg_replace('/`(.*?)`/', '&\\1;', $content);
     $content = preg_replace('/=</', '&le;', $content);
     $content = preg_replace('/>=/', '&ge;', $content);
     $content = preg_replace('/!=/', '&ne;', $content);
     $content = preg_replace('/~=/', '&cong;', $content);
     //remove tags
     $content = str_replace('<', '_lower_', $content);
     $content = str_replace('>', '_greater_', $content);
     //now replace _lower_ and _greater_ codes...
     $content = str_replace('_lower_', '&lt;', $content);
     $content = str_replace('_greater_', '&gt;', $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>";
//.........这里部分代码省略.........
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:101,代码来源:wiki.class.php

示例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');
 }
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:8,代码来源:copixtest_copixurltest.class.php


注:本文中的CopixUrl::escapeSpecialChars方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。