/** * build the html for columns of $colTypeCategory category * in form of given $listType in a table * * @param string $db current database * @param string $table current table * @param string $colTypeCategory supported all|Numeric|String|Spatial * |Date and time using the _pgettext() format * @param string $listType type of list to build, supported dropdown|checkbox * * @return string HTML for list of columns in form of given list types */ function PMA_getHtmlForColumnsList($db, $table, $colTypeCategory = 'all', $listType = 'dropdown') { $columnTypeList = array(); if ($colTypeCategory != 'all') { $types = $GLOBALS['PMA_Types']->getColumns(); $columnTypeList = $types[$colTypeCategory]; } $GLOBALS['dbi']->selectDb($db, $GLOBALS['userlink']); $columns = $GLOBALS['dbi']->getColumns($db, $table, null, true, $GLOBALS['userlink']); $type = ""; $selectColHtml = ""; foreach ($columns as $column => $def) { if (isset($def['Type'])) { $extracted_columnspec = Util::extractColumnSpec($def['Type']); $type = $extracted_columnspec['type']; } if (empty($columnTypeList) || in_array(mb_strtoupper($type), $columnTypeList)) { if ($listType == 'checkbox') { $selectColHtml .= '<input type="checkbox" value="' . htmlspecialchars($column) . '"/>' . htmlspecialchars($column) . ' [ ' . htmlspecialchars($def['Type']) . ' ]</br>'; } else { $selectColHtml .= '<option value="' . htmlspecialchars($column) . '' . '">' . htmlspecialchars($column) . ' [ ' . htmlspecialchars($def['Type']) . ' ]' . '</option>'; } } } return $selectColHtml; }
/** * Defined by Zend\Filter\FilterInterface * * Returns the string $value, converting characters to lowercase as necessary * * @param string $value * @return string */ public function filter($value) { if ($this->options['encoding'] !== null) { return mb_strtoupper((string) $value, $this->options['encoding']); } return strtoupper((string) $value); }
/** * Returns class of a type, used for functions available for type * or default values. * * @param string $type The data type to get a class. * * @return string * */ public function getTypeClass($type) { $type = mb_strtoupper($type); switch ($type) { case 'INTEGER': case 'BIGINT': case 'DECIMAL': case 'DOUBLE': case 'BOOLEAN': case 'SERIAL': return 'NUMBER'; case 'DATE': case 'DATETIME': case 'TIMESTAMP': case 'TIME': return 'DATE'; case 'VARCHAR': case 'TEXT': case 'VARBINARY': case 'BLOB': case 'ENUM': return 'CHAR'; case 'UUID': return 'UUID'; } return ''; }
public function postRegistro() { include_once public_path() . '/securimage/securimage.php'; $securimage = new Securimage(); $captcha_sesion = strtoupper($securimage->getCode()); include app_path() . "/include/cifrado.php"; $usuario = new Usuario(); $data = Input::all(); $data['captcha_sesion'] = $captcha_sesion; $data['captcha_code'] = strtoupper($data['captcha_code']); $data['fecha_nacimiento'] = $data['anyo'] . "-" . $data['mes'] . "-" . $data['dia']; foreach ($data as $key => $value) { if ($key != 'password' && $key != 'email') { $data[$key] = mb_strtoupper($value, 'UTF-8'); } } $data['password'] = encriptar($data['password']); $data['cod_verif'] = rand(111111, 999999); if (!$usuario->isValid($data)) { return Redirect::action('Usuario_UsuarioController@getRegistro')->withInput(Input::except('password'))->withErrors($usuario->errors)->with('id_municipio', $data['municipio']); } $usuario->fill($data); $usuario->save(); return Redirect::action('Usuario_UsuarioController@getVerificar', array($usuario->id))->with('message_ok', 'Registro Completado. Por favor, inserte el código de verificación que le hemos enviado a su correo electrónico. Gracias'); }
function printLangPanel($target, $target_id, $field) { if (!$target_id) { return; } $langs = cmsCore::getDirsList('/languages'); if (count($langs) > 1) { foreach ($langs as $lang) { ?> <a class="ajaxlink editfieldlang" href="#" onclick="return editFieldLang('<?php echo $lang; ?> ','<?php echo $target; ?> ','<?php echo $target_id; ?> ','<?php echo $field; ?> ', this);"><strong><?php echo mb_strtoupper($lang); ?> </strong></a> <?php } } }
public static function titleCase($title) { //remove HTML, storing it for later // HTML elements to ignore | tags | entities $regx = '/<(code|var)[^>]*>.*?<\\/\\1>|<[^>]+>|&\\S+;/'; preg_match_all($regx, $title, $html, PREG_OFFSET_CAPTURE); $title = preg_replace($regx, '', $title); //find each word (including punctuation attached) preg_match_all('/[\\w\\p{L}&`\'‘’"“\\.@:\\/\\{\\(\\[<>_]+-? */u', $title, $m1, PREG_OFFSET_CAPTURE); foreach ($m1[0] as &$m2) { //shorthand these- "match" and "index" list($m, $i) = $m2; //correct offsets for multi-byte characters (`PREG_OFFSET_CAPTURE` returns *byte*-offset) //we fix this by recounting the text before the offset using multi-byte aware `strlen` $i = mb_strlen(substr($title, 0, $i), 'UTF-8'); //find words that should always be lowercase… //(never on the first word, and never if preceded by a colon) $m = $i > 0 && mb_substr($title, max(0, $i - 2), 1, 'UTF-8') !== ':' && preg_match('/^(a(nd?|s|t)?|b(ut|y)|en|for|i[fn]|o[fnr]|t(he|o)|vs?\\.?|via)[ \\-]/i', $m) ? mb_strtolower($m, 'UTF-8') : (preg_match('/[\'"_{(\\[‘“]/u', mb_substr($title, max(0, $i - 1), 3, 'UTF-8')) ? mb_substr($m, 0, 1, 'UTF-8') . mb_strtoupper(mb_substr($m, 1, 1, 'UTF-8'), 'UTF-8') . mb_substr($m, 2, mb_strlen($m, 'UTF-8') - 2, 'UTF-8') : (preg_match('/[\\])}]/', mb_substr($title, max(0, $i - 1), 3, 'UTF-8')) || preg_match('/[A-Z]+|&|\\w+[._]\\w+/u', mb_substr($m, 1, mb_strlen($m, 'UTF-8') - 1, 'UTF-8')) ? $m : mb_strtoupper(mb_substr($m, 0, 1, 'UTF-8'), 'UTF-8') . mb_substr($m, 1, mb_strlen($m, 'UTF-8'), 'UTF-8'))); //resplice the title with the change (`substr_replace` is not multi-byte aware) $title = mb_substr($title, 0, $i, 'UTF-8') . $m . mb_substr($title, $i + mb_strlen($m, 'UTF-8'), mb_strlen($title, 'UTF-8'), 'UTF-8'); } //restore the HTML foreach ($html[0] as &$tag) { $title = substr_replace($title, $tag[0], $tag[1], 0); } return $title; }
/** * Get verbose error message by Error Code * @param $errorCode * @return string | false */ public function getErrorMessageByCode($errorCode) { $errorMessages = array('REJECTED_BY_ACQUIRER' => Mage::helper('bankdebit')->__('Your customers bank declined the transaction, your customer can contact their bank for more information'), 'Error_Generic' => Mage::helper('bankdebit')->__('An unhandled exception occurred'), '3DSecureDirectoryServerError' => Mage::helper('bankdebit')->__('A problem with Visa or MasterCards directory server, that communicates transactions for 3D-Secure verification'), 'AcquirerComunicationError' => Mage::helper('bankdebit')->__('Communication error with the acquiring bank'), 'AmountNotEqualOrderLinesTotal' => Mage::helper('bankdebit')->__('The sum of your order lines is not equal to the price set in initialize'), 'CardNotEligible' => Mage::helper('bankdebit')->__('Your customers card is not eligible for this kind of purchase, your customer can contact their bank for more information'), 'CreditCard_Error' => Mage::helper('bankdebit')->__('Some problem occurred with the credit card, your customer can contact their bank for more information'), 'PaymentRefusedByFinancialInstitution' => Mage::helper('bankdebit')->__('Your customers bank declined the transaction, your customer can contact their bank for more information'), 'Merchant_InvalidAccountNumber' => Mage::helper('bankdebit')->__('The merchant account number sent in on request is invalid'), 'Merchant_InvalidIpAddress' => Mage::helper('bankdebit')->__('The IP address the request comes from is not registered in PayEx, you can set it up in PayEx Admin under Merchant profile'), 'Access_MissingAccessProperties' => Mage::helper('bankdebit')->__('The merchant does not have access to requested functionality'), 'Access_DuplicateRequest' => Mage::helper('bankdebit')->__('Your customers bank declined the transaction, your customer can contact their bank for more information'), 'Admin_AccountTerminated' => Mage::helper('bankdebit')->__('The merchant account is not active'), 'Admin_AccountDisabled' => Mage::helper('bankdebit')->__('The merchant account is not active'), 'ValidationError_AccountLockedOut' => Mage::helper('bankdebit')->__('The merchant account is locked out'), 'ValidationError_Generic' => Mage::helper('bankdebit')->__('Generic validation error'), 'ValidationError_HashNotValid' => Mage::helper('bankdebit')->__('The hash on request is not valid, this might be due to the encryption key being incorrect'), 'ValidationError_InvalidParameter' => Mage::helper('bankdebit')->__('One of the input parameters has invalid data. See paramName and description for more information'), 'OperationCancelledbyCustomer' => Mage::helper('bankdebit')->__('The operation was cancelled by the client'), 'PaymentDeclinedDoToUnspecifiedErr' => Mage::helper('bankdebit')->__('Unexpecter error at 3rd party'), 'InvalidAmount' => Mage::helper('bankdebit')->__('The amount is not valid for this operation'), 'NoRecordFound' => Mage::helper('bankdebit')->__('No data found'), 'OperationNotAllowed' => Mage::helper('bankdebit')->__('The operation is not allowed, transaction is in invalid state'), 'ACQUIRER_HOST_OFFLINE' => Mage::helper('bankdebit')->__('Could not get in touch with the card issuer'), 'ARCOT_MERCHANT_PLUGIN_ERROR' => Mage::helper('bankdebit')->__('The card could not be verified'), 'REJECTED_BY_ACQUIRER_CARD_BLACKLISTED' => Mage::helper('bankdebit')->__('There is a problem with this card'), 'REJECTED_BY_ACQUIRER_CARD_EXPIRED' => Mage::helper('bankdebit')->__('The card expired'), 'REJECTED_BY_ACQUIRER_INSUFFICIENT_FUNDS' => Mage::helper('bankdebit')->__('Insufficient funds'), 'REJECTED_BY_ACQUIRER_INVALID_AMOUNT' => Mage::helper('bankdebit')->__('Incorrect amount'), 'USER_CANCELED' => Mage::helper('bankdebit')->__('Payment cancelled'), 'CardNotAcceptedForThisPurchase' => Mage::helper('bankdebit')->__('Your Credit Card not accepted for this purchase')); $errorMessages = array_change_key_case($errorMessages, CASE_UPPER); $errorCode = mb_strtoupper($errorCode); return isset($errorMessages[$errorCode]) ? $errorMessages[$errorCode] : false; }
public static function getAttrbutesListArrayInternal($cacheId, $bOnlySelectable, $firstLetterUppercase) { global $opt; $attributes = array(); $rsAttrGroup = sql("SELECT `attribute_groups`.`id`,\n\t\t IFNULL(`tt1`.`text`, `attribute_groups`.`name`) AS `name`,\n\t\t IFNULL(`tt2`.`text`, `attribute_categories`.`name`) AS `category`,\n\t\t `attribute_categories`.`color`\n\t\t\tFROM `attribute_groups`\n\t\t\tINNER JOIN `attribute_categories` \n\t\t\t ON `attribute_groups`.`category_id`=`attribute_categories`.`id`\n\t\t\tLEFT JOIN `sys_trans` AS `t1` \n\t\t\t ON `attribute_groups`.`trans_id`=`t1`.`id` \n\t\t\t AND `attribute_groups`.`name`=`t1`.`text`\n\t\t\tLEFT JOIN `sys_trans_text` AS `tt1` \n\t\t\t ON `t1`.`id`=`tt1`.`trans_id` \n\t\t\t AND `tt1`.`lang`='&1'\n\t\t\tLEFT JOIN `sys_trans` AS `t2` \n\t\t\t ON `attribute_categories`.`trans_id`=`t2`.`id` \n\t\t\t AND `attribute_categories`.`name`=`t2`.`text`\n\t\t\tLEFT JOIN `sys_trans_text` AS `tt2` \n\t\t\t ON `t2`.`id`=`tt2`.`trans_id` \n\t\t\t AND `tt2`.`lang`='&1'\n\t\t\tORDER BY `attribute_groups`.`id` ASC", $opt['template']['locale']); while ($rAttrGroup = sql_fetch_assoc($rsAttrGroup)) { $attr = array(); $bFirst = true; $bSearchGroupDefault = false; if ($cacheId == 0) { $sAddWhereSql = ''; if ($bOnlySelectable == true) { $sAddWhereSql .= ' AND `cache_attrib`.`selectable`=1'; } $rsAttr = sql("SELECT `cache_attrib`.`id`, \n IFNULL(`tt1`.`text`, `cache_attrib`.`name`) AS `name`,\n\t\t\t\t\t\t\tIFNULL(`tt2`.`text`, `cache_attrib`.`html_desc`) AS `html_desc`,\n\t\t\t\t\t\t\t`cache_attrib`.`icon`, `cache_attrib`.`search_default`\n\t\t\t\t\tFROM `cache_attrib`\n\t\t\t\t\tLEFT JOIN `sys_trans` AS `t1` \n\t\t\t\t\t ON `cache_attrib`.`trans_id`=`t1`.`id` \n\t\t\t\t\t AND `cache_attrib`.`name`=`t1`.`text`\n\t\t\t\t\tLEFT JOIN `sys_trans_text` AS `tt1` \n\t\t\t\t\t ON `t1`.`id`=`tt1`.`trans_id` \n\t\t\t\t\t AND `tt1`.`lang`='&1'\n\t\t\t\t\tLEFT JOIN `sys_trans` AS `t2` \n\t\t\t\t\t ON `cache_attrib`.`html_desc_trans_id`=`t2`.`id`\n\t\t\t\t\tLEFT JOIN `sys_trans_text` AS `tt2` \n\t\t\t\t\t ON `t2`.`id`=`tt2`.`trans_id` \n\t\t\t\t\t AND `tt2`.`lang`='&1'\n\t\t\t\t\tWHERE `cache_attrib`.`group_id`='&2'" . $sAddWhereSql . "\n\t\t\t\t\tAND NOT IFNULL(`cache_attrib`.`hidden`, 0)=1\n\t\t\t\t\tORDER BY `cache_attrib`.`group_id` ASC", $opt['template']['locale'], $rAttrGroup['id']); } else { $rsAttr = sql("SELECT `cache_attrib`.`id`, \n IFNULL(`tt1`.`text`, `cache_attrib`.`name`) AS `name`,\n\t\t\t\t\t\t\tIFNULL(`tt2`.`text`, `cache_attrib`.`html_desc`) AS `html_desc`,\n\t\t\t\t\t\t\t`cache_attrib`.`icon`, `cache_attrib`.`search_default`\n\t\t\t\t\tFROM `caches_attributes`\n\t\t\t\t\tINNER JOIN `cache_attrib` \n\t\t\t\t\t ON `caches_attributes`.`attrib_id`=`cache_attrib`.`id`\n\t\t\t\t\tLEFT JOIN `sys_trans` AS `t1` \n\t\t\t\t\t ON `cache_attrib`.`trans_id`=`t1`.`id` \n\t\t\t\t\t AND `cache_attrib`.`name`=`t1`.`text`\n\t\t\t\t\tLEFT JOIN `sys_trans_text` AS `tt1` \n\t\t\t\t\t ON `t1`.`id`=`tt1`.`trans_id` \n\t\t\t\t\t AND `tt1`.`lang`='&2'\n\t\t\t\t\tLEFT JOIN `sys_trans` AS `t2` \n\t\t\t\t\t ON `cache_attrib`.`html_desc_trans_id`=`t2`.`id`\n\t\t\t\t\tLEFT JOIN `sys_trans_text` AS `tt2` \n\t\t\t\t\t ON `t2`.`id`=`tt2`.`trans_id`\n\t\t\t\t\t AND `tt2`.`lang`='&2'\n\t\t\t\t\tWHERE `caches_attributes`.`cache_id`='&1' \n\t\t\t\t\tAND `cache_attrib`.`group_id`='&3'\n\t\t\t\t\tAND NOT IFNULL(`cache_attrib`.`hidden`, 0)=1\n\t\t\t\t\tORDER BY `cache_attrib`.`group_id` ASC", $cacheId, $opt['template']['locale'], $rAttrGroup['id']); } while ($rAttr = sql_fetch_assoc($rsAttr)) { if ($firstLetterUppercase) { $rAttr['name'] = mb_strtoupper(mb_substr($rAttr['name'], 0, 1)) . mb_substr($rAttr['name'], 1); } $attr[] = $rAttr; if ($rAttr['search_default']) { $bSearchGroupDefault = true; } } sql_free_result($rsAttr); if (count($attr) > 0) { $attributes[] = array('id' => $rAttrGroup['id'], 'name' => $rAttrGroup['name'], 'color' => $rAttrGroup['color'], 'category' => $rAttrGroup['category'], 'search_default' => $bSearchGroupDefault, 'attr' => $attr); } } sql_free_result($rsAttrGroup); return $attributes; }
/** * @return string|null */ private function upperize($str) { if (null !== ($str = $this->valueOrNull($str))) { return extension_loaded('mbstring') ? mb_strtoupper($str, 'UTF-8') : strtoupper($str); } return null; }
/** * Defined by Zend\Filter\Filter * * @param string $value * @return string */ public function filter($value) { // a unicode safe way of converting characters to \x00\x00 notation $pregQuotedSeparator = preg_quote($this->separator, '#'); if (StringUtils::hasPcreUnicodeSupport()) { $patterns = array('#(' . $pregQuotedSeparator . ')(\\p{L}{1})#u', '#(^\\p{Ll}{1})#u'); if (!extension_loaded('mbstring')) { $replacements = array(function ($matches) { return strtoupper($matches[2]); }, function ($matches) { return strtoupper($matches[1]); }); } else { $replacements = array(function ($matches) { return mb_strtoupper($matches[2], 'UTF-8'); }, function ($matches) { return mb_strtoupper($matches[1], 'UTF-8'); }); } } else { $patterns = array('#(' . $pregQuotedSeparator . ')([A-Za-z]{1})#', '#(^[A-Za-z]{1})#'); $replacements = array(function ($matches) { return strtoupper($matches[2]); }, function ($matches) { return strtoupper($matches[1]); }); } $filtered = $value; foreach ($patterns as $index => $pattern) { $filtered = preg_replace_callback($pattern, $replacements[$index], $filtered); } return $filtered; }
function txp_strtoupper($str) { if (TXP_USE_MBSTRING) { return mb_strtoupper($str); } return strtoupper($str); }
function utf8Upper($text) { return str_replace( array(chr(195).chr(182),chr(195).chr(164),chr(195).chr(165)) ,array(chr(195).chr(150),chr(195).chr(132),chr(195).chr(133)) ,mb_strtoupper($text) ); }
/** * Reads all plugin information from directory $plugins_dir * * @param string $plugin_type the type of the plugin (import, export, etc) * @param string $plugins_dir directrory with plugins * @param mixed $plugin_param parameter to plugin by which they can * decide whether they can work * * @return array list of plugin instances */ function PMA_getPlugins($plugin_type, $plugins_dir, $plugin_param) { $GLOBALS['plugin_param'] = $plugin_param; /* Scan for plugins */ $plugin_list = array(); if ($handle = @opendir($plugins_dir)) { while ($file = @readdir($handle)) { // In some situations, Mac OS creates a new file for each file // (for example ._csv.php) so the following regexp // matches a file which does not start with a dot but ends // with ".php" $class_type = mb_strtoupper($plugin_type[0], 'UTF-8') . mb_strtolower(substr($plugin_type, 1), 'UTF-8'); if (is_file($plugins_dir . $file) && preg_match('@^' . $class_type . '(.+)\\.class\\.php$@i', $file, $matches)) { $GLOBALS['skip_import'] = false; include_once $plugins_dir . $file; if (!$GLOBALS['skip_import']) { $class_name = $class_type . $matches[1]; $plugin_list[] = new $class_name(); } } } } ksort($plugin_list); return $plugin_list; }
private function parseParams() { global $_LANG; // подключим LANG файл cmsCore::loadLanguage('admin/' . (string) $this->xml->info->type . 's/' . (string) $this->xml->info->id); $pref = mb_strtoupper(substr($this->xml->info->type, 0, 3)); foreach ($this->xml->params->param as $p) { $param = array(); // заполняем атрибутами массив и приводим к строке значения foreach ($p->attributes() as $key => $value) { $param[$key] = (string) $value; } if ($param['name'] == 'tpl') { continue; } // Если есть элементы списка if (isset($p->option)) { foreach ($p->option as $o) { $opt = array(); foreach ($o->attributes() as $k => $v) { $opt[$k] = (string) $v; } $tolk = $pref . '_' . mb_strtoupper($param['name'] . '_OPT' . ($opt['value'] ? '_' . $opt['value'] : '')); $opt['title'] = isset($_LANG[$tolk]) ? $_LANG[$tolk] : (isset($opt['title']) ? $opt['title'] : ''); if (!$opt['title']) { $opt['title'] = $opt['value']; } $param['tag_option'][] = $opt; } } // Возможные lang ключи для параметров // если ключ для поля есть, то возвращается его значение // $param['name'] считается уникальным для каждого параметра xml // на его основе и строим ключи // если таких элеменов в массиве $_LANG нет, предполагаем, что соответствующие элементы // title, hint и units заданы в xml и используем их $ulk = $pref . '_' . mb_strtoupper($param['name']) . '_UNITS'; $tlk = $pref . '_' . mb_strtoupper($param['name']); $hlk = $pref . '_' . mb_strtoupper($param['name']) . '_HINT'; $param['title'] = isset($_LANG[$tlk]) ? $_LANG[$tlk] : $param['title']; if (!$param['title']) { $param['title'] = $param['name']; } $param['hint'] = isset($_LANG[$hlk]) ? $_LANG[$hlk] : (isset($param['hint']) ? $param['hint'] : ''); $param['units'] = isset($_LANG[$ulk]) ? $_LANG[$ulk] : (isset($param['units']) ? $param['units'] : ''); //получаем значение параметра $value = $this->getParamValue($param['name'], isset($param['default']) ? $param['default'] : ''); //если это массив, склеиваем в строку if (is_array($value)) { $value = implode('|', $value); } $param['value'] = $value; $param['html'] = $this->getParamHTML($param); $this->params[] = $param; } $param = array('type' => 'string', 'title' => $_LANG['AD_MODULE_TEMPLATE'], 'name' => 'tpl', 'value' => $this->getParamValue('tpl', '')); $param['html'] = $this->getParamHTML($param); $this->params[] = $param; return; }
function __mnwswitch_char2num($month) { if (mb_strtoupper($month) == 'JAN') { $out = "01"; } elseif (mb_strtoupper($month) == 'FEB') { $out = "02"; } elseif (mb_strtoupper($month) == 'MAR') { $out = "03"; } elseif (mb_strtoupper($month) == 'APR') { $out = "04"; } elseif (mb_strtoupper($month) == 'MAY') { $out = "05"; } elseif (mb_strtoupper($month) == 'JUN') { $out = "06"; } elseif (mb_strtoupper($month) == 'JUL') { $out = "07"; } elseif (mb_strtoupper($month) == 'AUG') { $out = "08"; } elseif (mb_strtoupper($month) == 'SEP') { $out = "09"; } elseif (mb_strtoupper($month) == 'OCT') { $out = "10"; } elseif (mb_strtoupper($month) == 'NOV') { $out = "11"; } elseif (mb_strtoupper($month) == 'DEC') { $out = "12"; } else { $out = $month; } return $out; }
public static function run(Requesting $requesting) { $controller = $requesting->getController(); $action = $requesting->getAction(); //$params = $requesting->getParams(); $first = mb_substr($controller, 0, 1); $last = mb_substr($controller, 1); $first = mb_strtoupper($first); $last = mb_strtolower($last); $nameController = $first . $last . "Controller"; $action = $action . "Action"; $filePath = "user/Controller/" . $nameController . ".php"; $className = $nameController; if (file_exists($filePath)) { require_once $filePath; $controller = new $nameController($requesting); if (class_exists($className)) { if (method_exists($controller, $action)) { call_user_func(array($controller, $action)); } else { var_dump("Данного метода не существует"); } } else { var_dump("Класс задан неверно"); } } else { var_dump("Файла не существует"); } }
function mb_ucfirst($string) { $strlen = mb_strlen($string, "utf8"); $firstChar = mb_substr($string, 0, 1, "utf8"); $then = mb_substr($string, 1, $strlen - 1, "utf8"); return mb_strtoupper($firstChar, "utf8") . $then; }
public function beforeSave($insert) { $this->motivo = mb_strtoupper($this->motivo); $this->control = mb_strtoupper($this->control); parent::beforeSave($insert); return true; }
/** * Draws text within a box defined by width = w, height = h, and aligns * the text vertically within the box ($valign = M/B/T for middle, bottom, or top) * Also, aligns the text horizontally ($align = L/C/R/J for left, centered, right or justified) * drawTextBox uses drawRows * * This function is provided by TUFaT.com */ function drawTextBox($strText, $w, $h, $align = 'L', $valign = 'T', $border = 1) { $xi = $this->GetX(); $yi = $this->GetY(); $hrow = $this->FontSize; $textrows = $this->drawRows($w, $hrow, $strText, 0, $align, 0, 0, 0); $maxrows = floor($h / $this->FontSize); $rows = min($textrows, $maxrows); if ($border == 1) { $this->Rect($xi, $yi, $w, $h, 'D'); } if ($border == 2) { $this->Rect($xi, $yi, $w, $h, 'DF'); } $dy = 0; if (mb_strtoupper($valign) == 'M') { $dy = ($h - $rows * $this->FontSize) / 2; } if (mb_strtoupper($valign) == 'B') { $dy = $h - $rows * $this->FontSize; } $this->SetY($yi + $dy); $this->SetX($xi); $this->drawRows($w, $hrow, $strText, 0, $align, 0, $rows, 1); }
function mb_ucfirst($string, $encoding = 'UTF-8') { $strlen = mb_strlen($string, $encoding); $firstChar = mb_substr($string, 0, 1, $encoding); $then = mb_substr($string, 1, $strlen - 1, $encoding); return mb_strtoupper($firstChar, $encoding) . $then; }
/** * Checks if a needle occurs in a haystack ;) * * @param string $haystack * @param string $needle * @param string $collation * @param string $matchType * @return bool */ public static function textMatch($haystack, $needle, $collation, $matchType = 'contains') { switch ($collation) { case 'i;ascii-casemap': // default strtolower takes locale into consideration // we don't want this. $haystack = str_replace(range('a', 'z'), range('A', 'Z'), $haystack); $needle = str_replace(range('a', 'z'), range('A', 'Z'), $needle); break; case 'i;octet': // Do nothing break; case 'i;unicode-casemap': $haystack = mb_strtoupper($haystack, 'UTF-8'); $needle = mb_strtoupper($needle, 'UTF-8'); break; default: throw new Sabre_DAV_Exception_BadRequest('Collation type: ' . $collation . ' is not supported'); } switch ($matchType) { case 'contains': return strpos($haystack, $needle) !== false; case 'equals': return $haystack === $needle; case 'starts-with': return strpos($haystack, $needle) === 0; case 'ends-with': return strrpos($haystack, $needle) === strlen($haystack) - strlen($needle); default: throw new Sabre_DAV_Exception_BadRequest('Match-type: ' . $matchType . ' is not supported'); } }
public function load1A($manager) { $test_password = '******'; $factory = $this->container->get('security.encoder_factory'); $finder = new Finder(); $finder = Finder::create()->name('liste_1a_2015-2016.csv')->in(__DIR__ . '/../data/files'); $rows = $this->parseCSV($finder); foreach ($rows as $key => $student) { /** @var $user \Application\Sonata\UserBundle\Entity\User */ $user = new Student(); $user->setSchoolClass($this->getReference('schoolClass.1A_' . mb_strtoupper($student[4]))); $user->setUsername($student[1] . '.' . $student[2]); $user->setPlainPassword($test_password); $user->setEmail($student[5]); $user->setFirstname($student[1]); $user->setLastname($student[2]); // $user->setRoles(array('ROLE_USER')); $user->addGroup($this->getReference('schoolClass.1A_' . mb_strtoupper($student[4]))); $user->setEnabled(true); $encoder = $factory->getEncoder($user); $password = $encoder->encodePassword($user->getPlainPassword(), $user->getSalt()); $user->setPassword($password); $manager->updateUser($user); } }
function __construct($nNewPodcastId = ID_NEW) { global $opt; $this->rePodcast = new rowEditor('mp3'); $this->rePodcast->addPKInt('id', null, false, RE_INSERT_AUTOINCREMENT); $this->rePodcast->addString('uuid', '', false); $this->rePodcast->addInt('node', 0, false); $this->rePodcast->addDate('date_created', time(), true, RE_INSERT_IGNORE); $this->rePodcast->addDate('last_modified', time(), true, RE_INSERT_IGNORE); $this->rePodcast->addString('url', '', false); $this->rePodcast->addString('title', '', false); $this->rePodcast->addDate('last_url_check', 0, true); $this->rePodcast->addInt('object_id', null, false); $this->rePodcast->addInt('local', 0, false); $this->rePodcast->addInt('unknown_format', 0, false); $this->nPodcastId = $nNewPodcastId + 0; if ($nNewPodcastId == ID_NEW) { $this->rePodcast->addNew(null); $sUUID = mb_strtoupper(sql_value("SELECT UUID()", '')); $this->rePodcast->setValue('uuid', $sUUID); $this->rePodcast->setValue('node', $opt['logic']['node']['id']); } else { $this->rePodcast->load($this->nPodcastId); $sFilename = $this->getFilename(); $fna = mb_split('\\.', $sFilename); $this->sFileExtension = mb_strtolower($fna[count($fna) - 1]); $this->bFilenamesSet = true; } }
/** * Normalize reference label * * This enables case-insensitive label matching * * @param string $string * * @return string */ public static function normalizeReference($string) { // Collapse internal whitespace to single space and remove // leading/trailing whitespace $string = preg_replace('/\\s+/', '', trim($string)); return mb_strtoupper($string, 'UTF-8'); }
/** * Reads all plugin information from directory $plugins_dir * * @param string $plugin_type the type of the plugin (import, export, etc) * @param string $plugins_dir directory with plugins * @param mixed $plugin_param parameter to plugin by which they can * decide whether they can work * * @return array list of plugin instances */ function PMA_getPlugins($plugin_type, $plugins_dir, $plugin_param) { $GLOBALS['plugin_param'] = $plugin_param; /* Scan for plugins */ $plugin_list = array(); if (!($handle = @opendir($plugins_dir))) { return $plugin_list; } $namespace = 'PMA\\' . str_replace('/', '\\', $plugins_dir); $class_type = mb_strtoupper($plugin_type[0], 'UTF-8') . mb_strtolower(mb_substr($plugin_type, 1), 'UTF-8'); $prefix_class_name = $namespace . $class_type; while ($file = @readdir($handle)) { // In some situations, Mac OS creates a new file for each file // (for example ._csv.php) so the following regexp // matches a file which does not start with a dot but ends // with ".php" if (is_file($plugins_dir . $file) && preg_match('@^' . $class_type . '([^\\.]+)\\.php$@i', $file, $matches)) { $GLOBALS['skip_import'] = false; include_once $plugins_dir . $file; if (!$GLOBALS['skip_import']) { $class_name = $prefix_class_name . $matches[1]; $plugin = new $class_name(); if (null !== $plugin->getProperties()) { $plugin_list[] = $plugin; } } } } ksort($plugin_list); return $plugin_list; }
/** * Defined by Zend_Filter_Interface * * Returns the string $value, converting characters to uppercase as necessary * * @param string $value * @return string */ public function filter($value) { if ($this->_encoding) { return mb_strtoupper((string) $value, $this->_encoding); } return strtoupper((string) $value); }
private static function toTitleCase($str) { if (mb_strlen($str) === 0) { return $str; } return mb_strtoupper(mb_substr($str, 0, 1)) . mb_strtolower(mb_substr($str, 1)); }
public function normalize($text, $source_unless_normalized = false) { $normal_text = array(); if (!$this->morphy) { return $normal_text; } $text = trim($text); $text = preg_replace('/[^A-Za-zА-Яа-яЁё\']/u', ' ', $text); $text = preg_replace('/\\s+/', ' ', $text); $text = mb_strtoupper($text, 'UTF-8'); $text = trim($text); $text = explode(' ', $text); if (empty($text)) { return $normal_text; } $normal_text = array(); $result = $this->morphy->lemmatize($text); if (is_array($result)) { $stopwords = $this->stopwords(); foreach ($result as $source => $word) { if (is_array($word)) { foreach ($word as $form) { if (!in_array($form, $stopwords)) { $normal_text[$form] = $form; } } } else { if ($source_unless_normalized && !in_array($source, $stopwords)) { $normal_text[$source] = $source; } } } } return $normal_text; }
/** * Convert a string to * uppercase and remove * accents * * NOTE: Avoid passing in HTML * This method will dumbly * transform HTML tags and * attributes to uppercase * HTML entities eg: " " * are OK * * @param string $str * * @return string */ public static function get_upper($str) { $all_uppercase = mb_strtoupper(self::remove_accents($str), 'UTF-8'); return preg_replace_callback('/&([a-z\\d]+);/i', function ($matches) { return strtolower($matches[0]); }, $all_uppercase); }
function escribe($x, $y, $t, $tam = 12) { global $pdf; $pdf->SetFont('Arial', '', $tam); $pdf->SetXY($x, $y); $pdf->Cell(5, 4, utf8_decode(mb_strtoupper($t, "utf8")), 0, 0, "C"); }