Example #1
0
 /**
  * Turkish uppercase function due to "İ" and "i" clash.
  * 
  * @see http://php.net/manual/en/ref.mbstring.php
  * 
  * @param string $str
  * @param string $encoding 
  * @return string
  */
 function strtoupperTR($str, $encoding = null)
 {
     if ($encoding) {
         mb_internal_encoding($encoding);
     }
     return mb_convert_case($str, MB_CASE_UPPER);
 }
Example #2
0
function txp_ucfirst($str)
{
    if (TXP_USE_MBSTRING) {
        return mb_convert_case(mb_substr($str, 0, 1), MB_CASE_UPPER) . mb_convert_case(mb_substr($str, 1), MB_CASE_LOWER);
    }
    return ucfirst($str);
}
Example #3
0
 /**
  * Metodo responsavel em retornar uma expressao no formato de nome proprio.
  *
  * @example \CoreZend\Util\String::beautifulProperName('INSTITUTO NACIONAL DE ESTUDOS E PESQUISAS EDUCACIONAIS ANÍSIO TEIXEIRA') <br /> \CoreZend\Util\String::beautifulProperName('instituto nacional de estudos e pesquisas educacionais anísio teixeira')
  *
  * @param string $strName
  * @param boolean $booSort
  * @return string
  */
 public static function beautifulProperName($strName, $booSort = false)
 {
     $strEncode = 'UTF-8';
     if (function_exists('mb_convert_case')) {
         $strName = mb_convert_case($strName, MB_CASE_TITLE, $strEncode);
     } else {
         $strName = self::utf8Decode($strName);
     }
     $strNameResult = '';
     $arrName = explode(' ', $strName);
     $arrIntersectName = array('da', 'das', 'de', 'des', 'di', 'dis', 'do', 'dos', 'du', 'dus', 'na', 'nas', 'ne', 'nes', 'ni', 'nis', 'no', 'nos', 'nu', 'nus');
     foreach ($arrName as $strBlockName) {
         $strBlockNameLower = mb_strtolower($strBlockName, $strEncode);
         $boolUcfirst = !in_array($strBlockNameLower, $arrIntersectName);
         $strNameResult .= $boolUcfirst ? ucfirst($strBlockNameLower) : $strBlockNameLower;
         $strNameResult .= ' ';
     }
     $strNameResult = trim($strNameResult);
     if ($booSort) {
         $arrNameResult = explode(' ', $strNameResult);
         $arrNameResultShort = array();
         if (isset($arrNameResult[0])) {
             $arrNameResultShort[] = $arrNameResult[0];
         }
         if (isset($arrNameResult[1])) {
             $arrNameResultShort[] = $arrNameResult[1];
         }
         if (in_array(strtolower($arrNameResult[1]), $arrIntersectName) && isset($arrNameResult[2])) {
             $arrNameResultShort[] = $arrNameResult[2];
         }
         $strNameResult = implode(' ', $arrNameResultShort);
     }
     return $strNameResult;
 }
Example #4
0
 /**
  * The Unicode version of ucwords().
  *
  * @param string $string the input string
  * @param string $encoding default null the character encoding, if omitted the the PHP internal encoding is used
  * @return string
  */
 public static function mb_ucwords($string, $encoding = null)
 {
     if ($encoding === null) {
         $encoding = mb_internal_encoding();
     }
     return mb_convert_case($string, MB_CASE_TITLE, $encoding);
 }
 /**
  * Esta funcion permite realizar una busqueda de usuarios que se pueden invitar a un
  * proyecto determinado mediante un autocompletar
  * @param Request $request datos de la solicitud
  * @return JsonResponse
  */
 public function searchUsersAutocompleteAction(Request $request)
 {
     //palabra buscada
     $originalTerm = $request->query->get('term');
     $term = mb_convert_case('%' . $originalTerm . '%', MB_CASE_TITLE, "UTF-8");
     $projectId = null;
     if (!empty($request->get('projectId'))) {
         $projectId = $request->get('projectId');
     }
     $em = $this->getDoctrine()->getManager();
     $users = $em->getRepository('BackendBundle:User')->findUsersAutocomplete($term, $projectId);
     if (empty($users)) {
         if (!$projectId) {
             $noMemberMessage = "* " . $originalTerm . $this->get('translator')->trans('backend.user_project.not_a_member');
         } else {
             $noMemberMessage = "* " . $originalTerm . $this->get('translator')->trans('backend.user_project.not_a_project_member');
         }
         $emptyItem['id'] = 0;
         $emptyItem['label'] = $noMemberMessage;
         $emptyItem['value'] = $noMemberMessage;
         $users[0] = $emptyItem;
     }
     $response = new JsonResponse($users);
     return $response;
 }
Example #6
0
function isPalindrome($str)
{
    $temp = mb_convert_case($str, MB_CASE_LOWER, "UTF-8");
    $temp = preg_replace('/\\s+/', '', $temp);
    $tempRev = utf8_strrev($temp);
    return $tempRev == $temp ? mb_strlen($temp, "UTF-8") : false;
}
Example #7
0
 public function BuildSentence($string)
 {
     $string = mb_convert_case($string, MB_CASE_LOWER, 'UTF-8');
     $string = $this->mb_ucfirst($string);
     $string .= '. ';
     return $string;
 }
Example #8
0
 public function filter(array $terms)
 {
     for ($i = 0, $max = sizeof($terms); $i < $max; $i++) {
         $terms[$i] = mb_convert_case($terms[$i], nc_search::get_setting('FilterStringCase'), 'UTF-8');
     }
     return $terms;
 }
Example #9
0
 function onTicketCreated($answer)
 {
     try {
         global $ost;
         if (!($ticket = Ticket::lookup($answer->object_id))) {
             die('Unknown or invalid ticket ID.');
         }
         //Slack payload
         $payload = array('attachments' => array(array('pretext' => "New Ticket <" . $ost->getConfig()->getUrl() . "scp/tickets.php?id=" . $ticket->getId() . "|#" . $ticket->getId() . "> in " . Format::htmlchars($ticket->getDept() instanceof Dept ? $ticket->getDept()->getName() : '') . " via " . $ticket->getSource() . " (" . Format::db_datetime($ticket->getCreateDate()) . ")", 'fallback' => "New Ticket <" . $ost->getConfig()->getUrl() . "scp/tickets.php?id=" . $ticket->getId() . "|#" . $ticket->getId() . "> in " . Format::htmlchars($ticket->getDept() instanceof Dept ? $ticket->getDept()->getName() : '') . " via " . $ticket->getSource() . " (" . Format::db_datetime($ticket->getCreateDate()) . ")", 'color' => "#D00000", 'fields' => array(array('title' => "From: " . mb_convert_case(Format::htmlchars($ticket->getName()), MB_CASE_TITLE) . " (" . $ticket->getEmail() . ")", 'value' => '', 'short' => false)))));
         //Curl to webhook
         $data_string = utf8_encode(json_encode($payload));
         $url = $this->getConfig()->get('slack-webhook-url');
         if (!function_exists('curl_init')) {
             error_log('osticket slackplugin error: cURL is not installed!');
         }
         $ch = curl_init($url);
         curl_setopt($ch, CURLOPT_POST, true);
         curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
         $result = curl_exec($ch);
         if ($result === false) {
             error_log($url . ' - ' . curl_error($ch));
         } else {
             $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
             if ($statusCode != '200') {
                 error_log($url . ' Http code: ' . $statusCode);
             }
         }
         curl_close($ch);
     } catch (Exception $e) {
         error_log('Error posting to Slack. ' . $e->getMessage());
     }
 }
    public function getByQuery($args)
    {
        $dql = "
            SELECT PARTIAL s.{id, title} FROM n3b\Bundle\Kladr\Entity\KladrStreet s
            JOIN s.parent r WITH r.id = :region
            WHERE s.title LIKE :query
            ORDER BY s.title";
        $count = "
            SELECT COUNT(s) FROM n3b\Bundle\Kladr\Entity\KladrStreet s
            JOIN s.parent r WITH r.id = :region
            WHERE s.title LIKE :query";

        $q = $this->getEntityManager()->createQuery($dql);
        $q->setParameters(array(
            'query' => \mb_convert_case($args['query'], MB_CASE_TITLE, "UTF-8") . '%',
            'region' => $args['region']
        ));
        $qCount = $this->getEntityManager()->createQuery($count);
        $qCount->setParameters(array(
            'query' => \mb_convert_case($args['query'], MB_CASE_TITLE, "UTF-8") . '%',
            'region' => $args['region']
        ));
        
        $q->setMaxResults(10);
        $res['count'] = $qCount->getSingleScalarResult();
        $res['items'] = $q->getArrayResult();

        return $res;
    }
Example #11
0
 function __construct($username)
 {
     $query = mysql_query("SELECT * FROM `users` WHERE `username` = '{$username}'");
     if ($user = mysql_fetch_object($query)) {
         $this->username = $user->username;
         $this->password = $user->password;
         $this->display_name = $user->display_name;
         $this->avatar = $user->avatar;
         $this->active = $user->active;
         $this->timezone = $user->timezone;
         $this->region = $user->region;
         $this->language = $user->language;
         $this->role = $user->role;
         $this->exp = $user->exp;
         $this->gold = $user->gold;
         $this->color = $user->color;
         $this->last_seen = $user->last_seen;
         $this->last_awarded = $user->last_awarded;
         $this->last_activity = $user->last_activity;
         $this->dob = $user->dob;
         $this->email = $user->email;
         $this->address = strtoupper($user->address);
         $this->phone_home = $user->phone_home;
         $this->phone_cell = $user->phone_cell;
         $this->name_last = $user->name_last;
         $this->name_middle = $user->name_middle;
         $this->name_first = $user->name_first;
         $this->you = mb_convert_case($user->you, MB_CASE_TITLE, "UTF-8");
         $this->me = mb_convert_case($user->me, MB_CASE_TITLE, "UTF-8");
         $this->post_you = mb_convert_case($user->you, MB_CASE_TITLE, "UTF-8");
         $this->post_me = mb_convert_case($user->me, MB_CASE_TITLE, "UTF-8");
         list($this->dob_date, $this->dob_time) = explode(" ", $this->dob);
         list($this->dob_year, $this->dob_month, $this->dob_day) = explode("-", $this->dob_date);
         if (isset($_SESSION["user"])) {
             $this->current_user = mysql_fetch_object(mysql_query("SELECT * FROM `users` WHERE `username` = '{$_SESSION["user"]}'"));
         }
         $this->title = "";
         $ignore = array("con", "em", "cháu");
         $title_only = array("ông ngoại", "ông nội", "ba", "bà ngoại", "bà nội", "má");
         if (isset($this->current_user) and $this->current_user->username != $this->username) {
             $select = mysql_query("SELECT * FROM `users_titles_you` WHERE `user` = '{$this->current_user->username}'");
             if ($row = mysql_fetch_assoc($select)) {
                 if (!in_array($row[$this->username], $ignore)) {
                     $this->title = mb_convert_case($row[$this->username], MB_CASE_TITLE, "UTF-8");
                     $this->post_you = mb_convert_case($row[$this->username], MB_CASE_TITLE, "UTF-8");
                 }
             }
             $select = mysql_query("SELECT * FROM `users_titles_me` WHERE `user` = '{$this->current_user->username}'");
             if ($row = mysql_fetch_assoc($select)) {
                 $this->post_me = ucfirst($row[$this->username]);
             }
         }
         $this->name = !empty($this->title) ? !in_array(mb_convert_case($this->title, MB_CASE_LOWER, "UTF-8"), $title_only) ? mb_convert_case($this->title, MB_CASE_TITLE, "UTF-8") . " " . $this->display_name : mb_convert_case($this->title, MB_CASE_TITLE, "UTF-8") : $this->display_name;
         $this->name2 = !empty($this->title) ? !in_array(mb_convert_case($this->title, MB_CASE_LOWER, "UTF-8"), $title_only) ? mb_convert_case($this->title, MB_CASE_TITLE, "UTF-8") . " " . $this->name_first : mb_convert_case($this->title, MB_CASE_TITLE, "UTF-8") : $this->name_first;
         $this->post_name = !empty($this->title) ? !in_array(mb_convert_case($this->title, MB_CASE_LOWER, "UTF-8"), $title_only) ? mb_convert_case($this->post_you, MB_CASE_TITLE, "UTF-8") . " " . $this->display_name : mb_convert_case($this->post_you, MB_CASE_TITLE, "UTF-8") : $this->display_name;
         $this->post_name2 = !empty($this->title) ? !in_array(mb_convert_case($this->title, MB_CASE_LOWER, "UTF-8"), $title_only) ? mb_convert_case($this->post_you, MB_CASE_TITLE, "UTF-8") . " " . $this->name_first : mb_convert_case($this->post_you, MB_CASE_TITLE, "UTF-8") : $this->name_first;
     } else {
         unset($this);
     }
 }
Example #12
0
 public function slugify($name)
 {
     $slug = mb_convert_case($name, MB_CASE_LOWER, mb_detect_encoding($name));
     $slug = str_replace(' ', '-', $slug);
     $slug = str_replace('--', '-', $slug);
     return $slug;
 }
 public function generateSentences()
 {
     for ($i = 0; $i < $this->passwordsCount; $i++) {
         $number = $this->generateNumber();
         $ps_type = $this->getPluralType($number);
         $subject = $this->getSubject($ps_type);
         $words[1] = $subject['word'];
         if ($this->wordsCount == 2 or $this->wordsCount == 4 or $this->wordsCount == 5) {
             $attribute1 = $this->getAttribute1($ps_type, $ps_type == 2 ? "-" : $subject['g']);
             $words[0] = $attribute1['word'];
         }
         if ($this->wordsCount == 3 or $this->wordsCount == 4 or $this->wordsCount == 5) {
             $predicate = $this->getPredicate($subject['ps'], $subject['ps'] == "p" ? "-" : $subject['g']);
             $words[2] = $predicate['word'];
             $object = $this->getObject();
             $words[4] = $object['word'];
         }
         if ($this->wordsCount == 5) {
             $attribute2 = $this->getAttribute2($object['ps'], $object['g'], $object['alt_case']);
             $words[3] = $attribute2['word'];
         }
         ksort($words);
         $sentence = array();
         if ($number > 1) {
             $sentence[] = $number;
         }
         foreach ($words as $word) {
             if ($this->upperCaseLetter) {
                 $word = mb_convert_case($word, MB_CASE_TITLE);
             }
             $sentence[] = $word;
         }
         $this->passwords[]['sentence'] = implode(" ", $sentence);
     }
 }
Example #14
0
 public function parseToTimedSentences($plaintext)
 {
     $srt = $this->parse($plaintext);
     $missingSentenceEnds = count(array_filter($srt, function ($row) {
         return preg_match(self::CHAR_END, $row[2]);
     })) < count($srt) / 6;
     $result = [];
     $sentence = NULL;
     $time = NULL;
     $lastCharEndedSentence = FALSE;
     foreach ($srt as list($start, $end, $text)) {
         if (!$text) {
             continue;
         }
         $text = preg_replace('~\\s+~u', ' ', $text);
         $startsWithUppercase = $text[0] === mb_convert_case($text[0], MB_CASE_UPPER);
         if ($time === NULL) {
             $time = $start;
         }
         if (($lastCharEndedSentence || $missingSentenceEnds) && $startsWithUppercase) {
             $result[] = ['time' => $time, 'sentence' => $sentence];
             $time = NULL;
             $sentence = NULL;
         }
         $sentence = trim("{$sentence} {$text}", ' ');
         $lastCharEndedSentence = (bool) preg_match(self::CHAR_END, $text);
     }
     if ($sentence) {
         $result[] = ['time' => $time, 'sentence' => $sentence];
     }
     return $result;
 }
 /**
  * Format a string data.
  *
  * @param string $str A string.
  *
  * @return string
  */
 protected function formatString($str)
 {
     if (extension_loaded('mbstring')) {
         $originalStr = $str;
         $str = mb_convert_case($str, MB_CASE_TITLE, 'UTF-8');
         // Correct for MB_TITLE_CASE's insistence on uppercasing letters
         // immediately preceded by numerals, eg: 1st -> 1St
         $originalEncoding = mb_regex_encoding();
         mb_regex_encoding('UTF-8');
         // matches an upper case letter character immediately preceded by a numeral
         mb_ereg_search_init($str, '[0-9]\\p{Lu}');
         while ($match = mb_ereg_search_pos()) {
             $charPos = $match[0] + 1;
             // Only swap it back to lowercase if it was lowercase to begin with
             if (mb_ereg_match('\\p{Ll}', $originalStr[$charPos])) {
                 $str[$charPos] = mb_strtolower($str[$charPos]);
             }
         }
         mb_regex_encoding($originalEncoding);
     } else {
         $str = $this->lowerize($str);
         $str = ucwords($str);
     }
     $str = str_replace('-', '- ', $str);
     $str = str_replace('- ', '-', $str);
     return $str;
 }
Example #16
0
 /**
  * Lower case text using mb_string
  *
  * @param string $text
  * @return string
  */
 public function lowerCase($text)
 {
     if (function_exists('mb_convert_case')) {
         $text = mb_convert_case($text, MB_CASE_LOWER, Mage_Core_Helper_String::ICONV_CHARSET);
     }
     return $text;
 }
Example #17
0
 /**
  * @param       $string
  * @param array $delimiters
  * @param array $exceptions
  *
  * @return bool|mixed|string
  */
 public static function titleCase($string, $delimiters = [" ", "-", ".", "'", "O'", "Mc"], $exceptions = ["and", "to", "of", "das", "dos", "I", "II", "III", "IV", "V", "VI"])
 {
     /*
      * Exceptions in lower case are words you don't want converted
      * Exceptions all in upper case are any words you don't want converted to title case
      *   but should be converted to upper case, e.g.:
      *   king henry viii or king henry Viii should be King Henry VIII
      */
     $string = mb_convert_case($string, MB_CASE_TITLE, "UTF-8");
     foreach ($delimiters as $dlnr => $delimiter) {
         $words = explode($delimiter, $string);
         $newwords = [];
         foreach ($words as $wordnr => $word) {
             if (in_array(mb_strtoupper($word, "UTF-8"), $exceptions)) {
                 // check exceptions list for any words that should be in upper case
                 $word = mb_strtoupper($word, "UTF-8");
             } elseif (in_array(mb_strtolower($word, "UTF-8"), $exceptions)) {
                 // check exceptions list for any words that should be in upper case
                 $word = mb_strtolower($word, "UTF-8");
             } elseif (!in_array($word, $exceptions)) {
                 // convert to uppercase (non-utf8 only)
                 $word = ucfirst($word);
             }
             array_push($newwords, $word);
         }
         $string = join($delimiter, $newwords);
     }
     //foreach
     return $string;
 }
Example #18
0
 protected function applyValue($input, Context $ctx)
 {
     $output = $input;
     if (!is_string($input)) {
         goto done;
     }
     $change = Change::User;
     nl2spc:
     if ($this->nl2spc) {
         $output = $this->nl2spcUnicode($input);
         $change = null;
     }
     trim:
     if ($this->trim) {
         $output = $this->trimUnicode($input);
     }
     casing:
     if ($this->casing) {
         if ($this->casing == 'lower') {
             $output = mb_strtolower($input);
         } elseif ($this->casing == 'upper') {
             $output = mb_strtoupper($input);
         } elseif ($this->casing == 'title') {
             $output = mb_convert_case($input, MB_CASE_TITLE);
         }
     }
     done:
     if ($output !== $input && $change !== null) {
         $ctx->setChange($change);
     }
     return $output;
 }
Example #19
0
 function url_title($str, $separator = 'dash', $lowercase = FALSE)
 {
     if ($separator == 'dash') {
         $search = '_';
         $replace = '-';
     } else {
         $search = '-';
         $replace = '_';
     }
     $from = array('ă', 'á', 'à', 'â', 'ã', 'ª', 'Á', 'À', 'Â', 'Ã', 'é', 'è', 'ê', 'É', 'È', 'Ê', 'í', 'ì', 'î', 'Í', 'Ì', 'Î', 'ò', 'ó', 'ô', 'õ', 'º', 'Ó', 'Ò', 'Ô', 'Õ', 'ş', 'Ş', 'ţ', 'Ţ', 'ú', 'ù', 'û', 'Ú', 'Ù', 'Û', 'ç', 'Ç', 'Ñ', 'ñ');
     $to = array('a', 'a', 'a', 'a', 'a', 'a', 'A', 'A', 'A', 'A', 'e', 'e', 'e', 'E', 'E', 'E', 'i', 'i', 'i', 'I', 'I', 'I', 'o', 'o', 'o', 'o', 'o', 'O', 'O', 'O', 'O', 's', 'S', 't', 'T', 'u', 'u', 'u', 'U', 'U', 'U', 'c', 'C', 'N', 'n');
     $str = trim(str_replace($from, $to, $str));
     $trans = array('&\\#\\d+?;' => '', '&\\S+?;' => '', '\\s+' => $replace, '[^a-zАБВГҐДЕЄЁЖЗИІЫЇЙКЛМНОПРСТУФХЦЧШЩэЮЯЬЪабвгґдеєёжзиіыїйклмнопрстуфхцчшщюяьъ0-9\\-\\._]' => '', $replace . '+' => $replace, $replace . '$' => $replace, '^' . $replace => $replace, '\\.+$' => '');
     $str = strip_tags($str);
     foreach ($trans as $key => $val) {
         $str = preg_replace("#" . $key . "#i", $val, $str);
     }
     if ($lowercase === TRUE) {
         if (function_exists('mb_convert_case')) {
             $str = mb_convert_case($str, MB_CASE_LOWER, "UTF-8");
         } else {
             $str = strtolower($str);
         }
     }
     return trim(stripslashes($str));
 }
function checkwords($String, $TestOnly, $Charset)
{
    global $Found, $b;
    // You can add the words you don't want users to use in the $BadWords array below. As an eregi
    // function is called to find them in strings, you may use valid POSIX 1003.2 regular expressions
    // (see second line of the array for an example).
    // Note that search is not case sensitive, except for special characters such as accentued ones.
    $BadWords = array("ahole", "anus", "ash0le", "ash0les", "asholes", "^ass\$", "^ass monkey", "^assface", "assh0le", "assh0lez", "asshole", "assholes", "assholz", "^asswipe", "azzhole", "ballz", "my balls", "^badass", "bassterds", "bastard", "bastards", "bastardz", "basterds", "basterdz", "Biatch", "b!tch", "bitch", "biatch", "bayatch", "baytch", "bitches", "blackhole", "blow job", "b*****b", "boffing", "b00bs", "boobs", "butt\$", "butthole", "buttwipe", "c0ck", "c0cks", "c0k", "carpet muncher", "cawk", "cawks", "C**t", "cnts", "cntz", "c0ck", "c0ckhead", "c**k", "cockhead", "c**k-head", "cocks", "c**k-sucker", "c********r", "c**k-sucker", "condom([[:alpha:]]*)", "crap", "^cum", "cumshot", "cum-shot", "cum shot", "c**t\$", "cunts", "cuntz", "deepshit", "dick", "dickhead", "dild0", "dild0s", "d***o", "dildos", "dilld0", "dilld0s", "dipshit", "douche", "douches", "dominatricks", "dominatrics", "dominatrix", "dr_tam(pax)", "dyke", "enema", "f u c k", "f u c k e r", "f*g\$", "fag1t", "faget", "fagg1t", "faggit", "f****t", "fagit", "fags", "fagz", "faig", "faigs", "fart", "flipping the bird", "f**k", "f**k([[:alpha:]]*)", "f****r", "f****n", "f*****g", "f***s", "fudge packer", "fuk", "fukah", "fuken", "fuker", "fukin", "fukk", "fukkah", "fukken", "fukker", "fukkin", "g00k", "gay", "gayboy", "gaygirl", "gays", "gayz", "god-damned", "godamn", "goddamn", "h00r", "h0ar", "h0re", "hells", "hoar", "hoore", "hore", "hump", "jack off", "jackass", "jackoff", "jag off", "jagoff", "jap", "japs", "jerk-off", "jisim", "jiss", "jizm", "j**z", "knob", "knobs", "knobz", "kunt", "kunts", "kuntz", "lesbian", "lezzian", "lipshits", "lipshitz", "m*******t", "masokist", "massterbait ", "masstrbait", "masstrbate", "masterbaiter", "masterbate", "masterbates", "motha f****r", "motha fuker", "motha fukkah", "motha fukker", "mother f****r", "mother fukah", "mother fuker", "mother fukkah", "mother fukker", "mother-f****r", "m**********r", "mutha f****r", "mutha fukah", "mutha fuker", "mutha fukkah", "mutha fukker", "n1gr", "nastt", "nigger", "nigur", "niiger", "niigr", "orafis", "orgasim", "o****m", "orgasum", "oriface", "orifice", "orifiss", "packi", "packie", "packy", "paki", "pakie", "paky", "pecker", "peeenus", "peeenusss", "peenus", "peinus", "pen1s", "penas", "penis", "penis-breath", "penus", "penuus", "phuc", "phuck", "phuk", "phuker", "phukker", "piss", "pissing", "pissed", "polac", "polack", "polak", "poonani", "pr1c", "pr1ck", "pr1k", "p***e", "pussee", "pussy", "puuke", "puuker", "queer", "queers", "queerz", "qweers", "qweerz", "qweir", "rape", "raped", "recktum", "rectum", "retard", "retards", "s****t", "scank", "schlong", "screwing", "scrot([[:alpha:]]*)", "s***n", "sex", "sexy", "sh!t", "sh!t([[:alpha:]]*)", "sh1t", "sh1t([[:alpha:]]*)", "sh1ter", "sh1ts", "sh1tter", "sh1tz", "shit", "shit([[:alpha:]]*)", "shitload", "shits", "shitter", "shitty", "shity", "shitz", "shyt", "shyte", "shyte", "shytty", "shyty", "skanck", "skank", "skankee", "skankey", "skanks", "skanky", "s**t", "s***s", "slutty", "slutz", "son-of-a-bitch", "sonofa([[:alpha:]]*)", "sonofabitch", "sperm([[:alpha:]]*)", "tampax", "testicals", "texticals", "^tit", "t**s", "titty", "tittyfuck", "titts", "titties", "twat", "^turd", "untampaxed", "untampaxxxed", "va1jina", "vag1na", "vagiina", "vagin([[:alpha:]]*)", "vaj1na", "vajina", "vullva", "vulva", "w0p", "wh00r", "wh0re", "w***e", "xrated", "xxx", "merde", "scheisse", "arschloch", "scheize", "scheiz", "ficken", "fick", "kuso", "ketsunoana", "faku", "kutabare", "zakennayo", "chikishou", "baka", "yaro", "merdo", "anusulo", "belest", "beleşt", "boule", "coaie", "n cur", "curva", "curvă", "curul", "te fut", "ti fut", "futut", "futuţ", "futui", "fututi", "futu-te", "futu-ti", "futu-ţi", "lindic", "mortii ma", "morţii mă", "muie", "muist", "pizda", "pizdă", "pula", "pulă", "sugi ", "バカ", "馬鹿", "死ね", "セックス", "ファック", "チンポ", "チンコ", "マンコ", "クソ", "糞");
    $ReplaceString = C_SWEAR_EXPR;
    // String that will replace "swear words"
    // Don't modify lines below
    $Found = false;
    $b = 0;
    for (reset($BadWords); $ToFind = current($BadWords); next($BadWords)) {
        #		$Found = eregi(mb_convert_case(addslashes($ToFind),MB_CASE_LOWER,$Charset), mb_convert_case($String,MB_CASE_LOWER,$Charset));
        $Found = preg_match("/" . mb_convert_case(addslashes($ToFind), MB_CASE_LOWER, $Charset) . "/i", mb_convert_case($String, MB_CASE_LOWER, $Charset));
        if ($Found !== false) {
            if ($TestOnly) {
                break;
            } else {
                $String = str_replace(addslashes($ToFind), $ReplaceString, $String);
                $b++;
            }
        }
    }
    unset($BadWords);
    return $TestOnly ? $Found : $String;
}
Example #21
0
 function get($filename)
 {
     $id = $this->input->get('id');
     $token = $this->input->get('token');
     //Chequeamos permisos del frontend
     $file = Doctrine_Query::create()->from('File f, f.Tramite t, t.Etapas e, e.Usuario u')->where('f.id = ? AND f.llave = ? AND u.id = ?', array($id, $token, UsuarioSesion::usuario()->id))->fetchOne();
     if (!$file) {
         //Chequeamos permisos en el backend
         $file = Doctrine_Query::create()->from('File f, f.Tramite.Proceso.Cuenta.UsuariosBackend u')->where('f.id = ? AND f.llave = ? AND u.id = ? AND (u.rol="super" OR u.rol="operacion" OR u.rol="seguimiento")', array($id, $token, UsuarioBackendSesion::usuario()->id))->fetchOne();
         if (!$file) {
             echo 'Usuario no tiene permisos para ver este archivo.';
             exit;
         }
     }
     $path = 'uploads/documentos/' . $file->filename;
     if (preg_match('/^\\.\\./', $file->filename)) {
         echo 'Archivo invalido';
         exit;
     }
     if (!file_exists($path)) {
         echo 'Archivo no existe';
         exit;
     }
     $friendlyName = str_replace(' ', '-', convert_accented_characters(mb_convert_case($file->Tramite->Proceso->Cuenta->nombre . ' ' . $file->Tramite->Proceso->nombre, MB_CASE_LOWER) . '-' . $file->id)) . '.' . pathinfo($path, PATHINFO_EXTENSION);
     header('Content-Type: ' . get_mime_by_extension($path));
     header('Content-Length: ' . filesize($path));
     header('Content-Disposition: attachment; filename="' . $friendlyName . '"');
     readfile($path);
 }
 /**
  * @inheritdoc
  */
 public function evaluate(array $values)
 {
     if (count($values) != 1) {
         throw new \InvalidArgumentException('StringEqual function must contains only 2 parameters');
     }
     return mb_convert_case($values[0], MB_CASE_LOWER);
 }
Example #23
0
File: MB.php Project: easyconn/atk4
 function mb_str_to_upper_words($a)
 {
     if ($this->is_mb) {
         return mb_convert_case($value, MB_CASE_TITLE, $this->encoding);
     }
     return ucwords(strtolower($value));
 }
Example #24
0
 public function _compareOptions($a, $b)
 {
     if ($a['label'] == $b['label']) {
         return 0;
     }
     return mb_convert_case($a['label'], MB_CASE_UPPER, "UTF-8") < mb_convert_case($b['label'], MB_CASE_UPPER, "UTF-8") ? -1 : 1;
 }
Example #25
0
 public function asHtml(ElementNode $el)
 {
     $content = '';
     foreach ($el->getChildren() as $child) {
         $content .= $child->getAsHTML();
     }
     $param = $el->getAttribute();
     if (is_array($param)) {
         $param = array_shift($param);
     }
     $param = trim($param);
     if ($content == '' and $param == '') {
         return '';
     }
     // Erlaubte Farbnamen
     $allowed_colors = (array) $this->config->get('callbacks.color_param.allowed_colors');
     $color = mb_convert_case($param, MB_CASE_TITLE);
     // Wenn im Parameter keine erlaubte Farbe steht
     if (!in_array($color, $allowed_colors)) {
         // Prüfen, ob eine hexadezimale Farbe angegeben wurde
         if (strlen($param) == 7 && $param[0] == '#' and preg_match('~#[a-f0-9]{6}~i', $param)) {
             $color = $param;
         } else {
             $color = $this->config->get('callbacks.color_param.default_color');
         }
     }
     // Ansonsten ist der Farbnamen gülig
     return Html::span($content, ['style' => 'color:' . $color . ';']);
 }
/**
 * Process the chunks generated by the namecase function.
 *
 * This function should not be called directly.
 *
 * @param string $str
 * @returns string
 * @see name_case
 */
function _process_name_case_chunk($str)
{
    // Surname prefixes
    if (preg_match('/^(van|von|der|la|d[aeio]|d[ao]s|dit)[\\s,]*$/i', $str)) {
        return strtolower($str);
    }
    // Ordinal suffixes (I - VIII only)
    if (preg_match('/^(i{3}|i{1,2}v?|v?i{1,2})[\\s,]*$/i', $str)) {
        return strtoupper($str);
    }
    if (function_exists('mb_convert_case')) {
        $str = mb_convert_case($str, MB_CASE_TITLE, 'UTF-8');
    } else {
        $str = ucfirst(strtolower($str));
    }
    // Second letter capitalized, like D'Angelo, McDonald, St. John, 0'Neil
    if (preg_match('/(^|\\s)+(Mc|[DO]\'|St\\.|St[\\.]?[\\s]|Dewolf)/i', $str)) {
        $str[2] = strtoupper($str[2]);
        return $str;
    }
    // Third letter capitalized, like MacDonald, MacRae
    if (preg_match('/(^|\\s*)(Mac)(allist|arth|b|c(allu|art|ask|l|r|ull)|d|f|g|i(nn|nty|saa|v)|kinn|kn|l(a|ea|eo)|m|na[mu]|n[ei]|ph|q|ra|sw|ta|w)/i', $str)) {
        // not h,
        $str[3] = strtoupper($str[3]);
        return $str;
    }
    return $str;
}
Example #27
0
 /**
  * Apply the text case.
  *
  * @param string $data
  * @return string
  */
 public function render($data)
 {
     switch ($this->textCase) {
         case 'lowercase':
             return $this->keepNoCaseSpan(mb_strtolower($data), $data);
             break;
         case 'uppercase':
             return $this->keepNoCaseSpan(mb_strtoupper($data), $data);
             break;
         case 'capitalize-all':
             return $this->keepNoCaseSpan(mb_convert_case($data, \MB_CASE_TITLE), $data);
             break;
         case 'capitalize-first':
             return $this->capitalizeFirst($data);
             break;
         case 'sentence':
             return $this->renderSentence($data);
             break;
         case 'title':
             return $this->keepNoCaseSpan($this->renderTitle($data), $data);
             break;
         default:
             return $data;
             break;
     }
 }
Example #28
0
 function readContent()
 {
     $data = read_xml_file($this->server, $this->port, $this->url);
     if (strlen($data) > 0) {
         $dom = new domDocument();
         $dom->loadXML(substr($data, 0, strrpos($data, '>') + 1));
         $arrFeeds = array();
         $count = 0;
         foreach ($dom->getElementsByTagName('item') as $node) {
             if (function_exists('date_parse')) {
                 $date_raw = date_parse($node->getElementsByTagName('pubDate')->item(0)->nodeValue);
                 //$date = date('H:i j.m.Y', mktime($date_raw['hour'], $date_raw['minute'], $date_raw['second'], $date_raw['month'], $date_raw['day'], $date_raw['year']));
                 $date = date('j.m', mktime($date_raw['hour'], $date_raw['minute'], $date_raw['second'], $date_raw['month'], $date_raw['day'], $date_raw['year']));
             } else {
                 $date1 = explode(' ', $node->getElementsByTagName('pubDate')->item(0)->nodeValue);
                 $months = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
                 $months_n = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');
                 $time = explode(':', $date1[4]);
                 //$date = $time[0] . ':' . $time[1] . ' ' . intval($date1[1]) . '.' . str_replace($months, $months_n, $date1[2]) . '.' . $date1[3];
                 $date = intval($date1[1]) . '.' . str_replace($months, $months_n, $date1[2]);
             }
             $itemRSS = array('title' => mb_convert_case(!$this->decodeUTF ? utf8_decode($node->getElementsByTagName('title')->item(0)->nodeValue) : $node->getElementsByTagName('title')->item(0)->nodeValue, MB_CASE_UPPER, "UTF-8"), 'description' => substr(!$this->decodeUTF ? utf8_decode($node->getElementsByTagName('description')->item(0)->nodeValue) : $node->getElementsByTagName('description')->item(0)->nodeValue, 0, 60), 'link' => $node->getElementsByTagName('link')->item(0)->nodeValue);
             $itemRSS['date'] = $date;
             array_push($arrFeeds, $itemRSS);
             $count++;
             if ($count == $this->nr_of_posts) {
                 break;
             }
         }
         return $arrFeeds;
     }
     return null;
 }
Example #29
0
function changeTitle($str)
{
    $str = stripUnicode($str);
    $str = str_replace("?", "", $str);
    $str = str_replace("&", "", $str);
    $str = str_replace("'", "", $str);
    $str = str_replace("  ", " ", $str);
    $str = trim($str);
    $str = mb_convert_case($str, MB_CASE_LOWER, 'utf-8');
    // MB_CASE_UPPER/MB_CASE_TITLE/MB_CASE_LOWER
    $str = str_replace(" ", "-", $str);
    $str = str_replace("---", "-", $str);
    $str = str_replace("--", "-", $str);
    $str = str_replace('"', '', $str);
    $str = str_replace('"', "", $str);
    $str = str_replace(":", "", $str);
    $str = str_replace("(", "", $str);
    $str = str_replace(")", "", $str);
    $str = str_replace(",", "", $str);
    $str = str_replace(".", "", $str);
    $str = str_replace(".", "", $str);
    $str = str_replace(".", "", $str);
    $str = str_replace("%", "", $str);
    return $str;
}
Example #30
0
function changeTitle($str)
{
    $str = trim($str);
    if ($str == "") {
        return "";
    }
    $str = str_replace('"', '', $str);
    $str = str_replace("'", '', $str);
    $str = str_replace(":", '', $str);
    $str = str_replace("%", '', $str);
    $str = str_replace("?", '', $str);
    $str = str_replace("–", '', $str);
    $str = str_replace("-", '', $str);
    $str = str_replace("_", '', $str);
    $str = str_replace(".", '', $str);
    $str = str_replace(",", '', $str);
    $str = str_replace("“", '', $str);
    $str = str_replace("”", '', $str);
    $str = str_replace("(", '', $str);
    $str = str_replace(")", '', $str);
    $str = str_replace("&", '', $str);
    $str = str_replace("*", '', $str);
    $str = str_replace("+", '', $str);
    $str = str_replace("  ", ' ', $str);
    $str = stripUnicode($str);
    $str = mb_convert_case($str, MB_CASE_TITLE, 'utf-8');
    // MB_CASE_UPPER / MB_CASE_TITLE / MB_CASE_LOWER
    //$str = str_replace(' ','-',$str);
    return $str;
}