コード例 #1
0
ファイル: trim.php プロジェクト: RangerWalt/ecci
/**
* UTF-8 aware replacement for trim()
* Note: you only need to use this if you are supplying the charlist
* optional arg and it contains UTF-8 characters. Otherwise trim will
* work normally on a UTF-8 string
* @author Andreas Gohr <*****@*****.**>
* @see http://www.php.net/trim
* @see http://dev.splitbrain.org/view/darcs/dokuwiki/inc/utf8.php
* @return string
* @package utf8
* @subpackage strings
*/
function utf8_trim($str, $charlist = FALSE)
{
    if ($charlist === FALSE) {
        return trim($str);
    }
    return utf8_ltrim(utf8_rtrim($str, $charlist), $charlist);
}
コード例 #2
0
ファイル: string.php プロジェクト: nogsus/joomla-platform
 /**
  * UTF-8 aware replacement for ltrim()
  *
  * Strip whitespace (or other characters) from the beginning of a string
  * You only need to use this if you are supplying the charlist
  * optional arg and it contains UTF-8 characters. Otherwise ltrim will
  * work normally on a UTF-8 string
  *
  * @param   string  $str       The string to be trimmed
  * @param   string  $charlist  The optional charlist of additional characters to trim
  *
  * @return  string  The trimmed string
  *
  * @see     http://www.php.net/ltrim
  * @since   11.1
  */
 public static function ltrim($str, $charlist = false)
 {
     if (empty($charlist) && $charlist !== false) {
         return $str;
     }
     jimport('phputf8.trim');
     if ($charlist === false) {
         return utf8_ltrim($str);
     } else {
         return utf8_ltrim($str, $charlist);
     }
 }
コード例 #3
0
ファイル: moderate.php プロジェクト: mtechnik/pantherforum
     }
     if (strlen($title) < 1) {
         message($lang_common['Bad request']);
     }
     $close = isset($_POST['close']) ? intval($_POST['close']) : '2';
     $stick = isset($_POST['stick']) ? intval($_POST['stick']) : '2';
     $archive = isset($_POST['archive']) ? intval($_POST['archive']) : '2';
     $move = isset($_POST['forum']) ? intval($_POST['forum']) : '0';
     $leave_redirect = isset($_POST['redirect']) ? intval($_POST['redirect']) : '0';
     $insert = array('title' => $title, 'close' => $close, 'stick' => $stick, 'archive' => $archive, 'move' => $move, 'leave_redirect' => $leave_redirect, 'reply_message' => $message, 'add_start' => $add_start, 'add_end' => $add_end, 'send_email' => $send_email, 'increment_posts' => $increment);
     $db->insert('multi_moderation', $insert);
     redirect(panther_link($panther_url['admin_moderate']), $lang_admin_moderate['added redirect']);
 } elseif ($action == 'edit' && $id > '0') {
     $message = isset($_POST['message']) ? panther_trim($_POST['message']) : null;
     $title = isset($_POST['title']) ? panther_trim($_POST['title']) : null;
     $add_start = isset($_POST['add_start']) ? utf8_ltrim($_POST['add_start']) : null;
     $add_end = isset($_POST['add_end']) ? utf8_rtrim($_POST['add_end']) : null;
     if (strlen($title) > 50) {
         message($lang_admin_moderate['title too long']);
     }
     if (strlen($add_start) > 50 || strlen($add_end) > 50) {
         message($lang_admin_moderate['addition too long']);
     }
     if (strlen($title) < 1) {
         message($lang_common['Bad request']);
     }
     $close = isset($_POST['close']) ? intval($_POST['close']) : '2';
     $stick = isset($_POST['stick']) ? intval($_POST['stick']) : '2';
     $archive = isset($_POST['archive']) ? intval($_POST['archive']) : '2';
     $move = isset($_POST['forum']) ? intval($_POST['forum']) : '0';
     $leave_redirect = isset($_POST['redirect']) ? intval($_POST['redirect']) : '0';
コード例 #4
0
 /**
  * UTF-8 aware replacement for ltrim()
  *
  * Strip whitespace (or other characters) from the beginning of a string
  * You only need to use this if you are supplying the charlist
  * optional arg and it contains UTF-8 characters. Otherwise ltrim will
  * work normally on a UTF-8 string
  *
  * @param   string  $str       The string to be trimmed
  * @param   string  $charlist  The optional charlist of additional characters to trim
  *
  * @return  string  The trimmed string
  *
  * @see     http://www.php.net/ltrim
  * @since   2.0
  */
 public static function ltrim($str, $charlist = null)
 {
     if (empty($charlist) && $charlist !== null) {
         return $str;
     }
     if (!function_exists('utf8_ltrim')) {
         require_once __DIR__ . '/phputf8/trim.php';
     }
     if ($charlist === null) {
         return utf8_ltrim($str);
     }
     return utf8_ltrim($str, $charlist);
 }
コード例 #5
0
ファイル: string.php プロジェクト: joebushi/joomla
 /**
  * UTF-8 aware replacement for ltrim()
  * Strip whitespace (or other characters) from the beginning of a string
  * Note: you only need to use this if you are supplying the charlist
  * optional arg and it contains UTF-8 characters. Otherwise ltrim will
  * work normally on a UTF-8 string
  *
  * @static
  * @access public
  * @param string the string to be trimmed
  * @param string the optional charlist of additional characters to trim
  * @return string the trimmed string
  * @see http://www.php.net/ltrim
  */
 public static function ltrim($str, $charlist = FALSE)
 {
     jimport('phputf8.trim');
     if ($charlist === FALSE) {
         return utf8_ltrim($str);
     } else {
         return utf8_ltrim($str, $charlist);
     }
 }
コード例 #6
0
/**
 * utf8_trim( )
 * 
 * Strip whitespace or other characters from beginning or end of a UTF-8 string
 * @since 1.3
 * 
 * @param    string $string The string to be trimmed
 * @param    string $chrs Optional characters to be stripped
 * @return   string The trimmed string
 */
function utf8_trim($string = '', $chrs = '')
{
    $string = utf8_ltrim($string, $chrs);
    return utf8_rtrim($string, $chrs);
}
コード例 #7
0
 /**
  * UTF-8 aware replacement for ltrim()
  *
  * Strip whitespace (or other characters) from the beginning of a string
  * You only need to use this if you are supplying the charlist
  * optional arg and it contains UTF-8 characters. Otherwise ltrim will
  * work normally on a UTF-8 string
  *
  * @param   string  $str       The string to be trimmed
  * @param   string  $charlist  The optional charlist of additional characters to trim
  *
  * @return  string  The trimmed string
  *
  * @see     http://www.php.net/ltrim
  * @since   1.0
  */
 public static function ltrim($str, $charlist = false)
 {
     if (empty($charlist) && $charlist !== false) {
         return $str;
     }
     require_once __DIR__ . '/phputf8/trim.php';
     if ($charlist === false) {
         return utf8_ltrim($str);
     }
     return utf8_ltrim($str, $charlist);
 }
コード例 #8
0
/**
 * Unicode aware replacement for trim()
 *
 * @author Andreas Gohr <*****@*****.**>
 * @see    trim()
 * @return string
 */
function utf8_trim($str, $charlist = '')
{
    if ($charlist == '') {
        return trim($str);
    }
    return utf8_ltrim(utf8_rtrim($str));
}
コード例 #9
0
 /**
  * UTF-8 aware replacement for ltrim()
  *
  * Strip whitespace (or other characters) from the beginning of a string. You only need to use this if you are supplying the charlist
  * optional arg and it contains UTF-8 characters. Otherwise ltrim will work normally on a UTF-8 string.
  *
  * @param   string  $str       The string to be trimmed
  * @param   string  $charlist  The optional charlist of additional characters to trim
  *
  * @return  string  The trimmed string
  *
  * @see     http://www.php.net/ltrim
  * @since   1.3.0
  */
 public static function ltrim($str, $charlist = false)
 {
     if (empty($charlist) && $charlist !== false) {
         return $str;
     }
     if ($charlist === false) {
         return utf8_ltrim($str);
     }
     return utf8_ltrim($str, $charlist);
 }
コード例 #10
0
ファイル: utf8_trim.test.php プロジェクト: kidwellj/scuttle
 function testLinefeedMask()
 {
     $str = "ñ\nñtërnâtiônàlizætiøn";
     $trimmed = "tërnâtiônàlizætiøn";
     $this->assertEqual(utf8_ltrim($str, "ñ\n"), $trimmed);
 }
コード例 #11
0
ファイル: text.php プロジェクト: kidaa30/Swevers
/**
 * UTF-8 aware replacement for trim().
 *
 * @author Andreas Gohr <*****@*****.**>
 * @see http://www.php.net/trim
 * @see http://dev.splitbrain.org/view/darcs/dokuwiki/inc/utf8.php
 * @param string $str
 * @param boolean $charlist
 * @return string
 */
function utf8_trim($str, $charlist = '')
{
    if (empty($charlist)) {
        return trim($str);
    }
    return utf8_ltrim(utf8_rtrim($str, $charlist), $charlist);
}
コード例 #12
0
 function utf8_ltrim($str, $charlist = '')
 {
     return utf8_ltrim($str, $charlist);
 }