wordSeparator() static public method

*! \static Returns the current word separator, if none is found it will read from site.ini URLTranslator/WordSeparator \sa setWordSeparator
static public wordSeparator ( )
コード例 #1
0
 /**
  * Append the node ID of the object being published
  * So its URL alias will look like :
  * someurlalias-<nodeID>
  *
  * @param string The text of the URL alias
  * @param object The eZContentObject object being published
  * @params object The eZContentObjectTreeNode in which the eZContentObject is published
  * @return string The transformed URL alias with the nodeID
  */
 public function process($text, &$languageObject, &$caller)
 {
     if (!$caller instanceof eZContentObjectTreeNode) {
         eZDebug::writeError('The caller variable was not an eZContentObjectTreeNode', __METHOD__);
         return $text;
     }
     $ini = eZINI::instance('site.ini');
     $applyOnClassList = $ini->variable('AppendNodeIDFilterSettings', 'ApplyOnClass');
     $classIdentifier = $caller->attribute('class_identifier');
     if (in_array($classIdentifier, $applyOnClassList)) {
         $separator = eZCharTransform::wordSeparator();
         $text .= $separator . $caller->attribute('node_id');
     }
     return $text;
 }
コード例 #2
0
 static function commandUrlCleanupIRI($text, $charsetName)
 {
     // With IRI support we keep all characters except some reserved ones,
     // they are space, tab, ampersand, semi-colon, forward slash, colon, equal sign, question mark,
     //          square brackets, parenthesis, plus.
     //
     // Note: Spaces and tabs are turned into a dash to make it easier for people to
     //       paste urls from the system and have the whole url recognized
     //       instead of being broken off
     $sep = eZCharTransform::wordSeparator();
     $sepQ = preg_quote($sep);
     $prepost = " ." . $sepQ;
     if ($sep != "-") {
         $prepost .= "-";
     }
     $text = preg_replace(array("#[ \t\\\\%\\#&;/:=?\\[\\]()+]+#", "#\\.\\.+#", "#[{$sepQ}]+#", "#^[{$prepost}]+|[!{$prepost}]+\$#"), array($sep, $sep, $sep, ""), $text);
     return $text;
 }