本文整理汇总了PHP中utf8_decode函数的典型用法代码示例。如果您正苦于以下问题:PHP utf8_decode函数的具体用法?PHP utf8_decode怎么用?PHP utf8_decode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了utf8_decode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addptext
private function addptext($styleconf, $text, $posx = null, $posy = null, $width = 0, $height = 0)
{
static $cfonts = array();
$font = $this->conf[$styleconf . '_font'];
$size = isset($this->conf[$styleconf . '_size']) ? $this->conf[$styleconf . '_size'] : 10;
$style = isset($this->conf[$styleconf . '_style']) ? $this->conf[$styleconf . '_style'] : '';
$color = isset($this->conf[$styleconf . '_color']) ? $this->conf[$styleconf . '_color'] : '#000000';
$height = isset($this->conf[$styleconf . '_height']) ? $this->conf[$styleconf . '_height'] : $height;
$text = utf8_decode($text);
if (!is_file(FPDF_FONTPATH . $font . '.php')) {
ob_start();
MakeFont(FPDF_FONTPATH . $font . '.ttf');
file_put_contents(FPDF_FONTPATH . $font . '.log', ob_get_contents());
ob_end_clean();
}
if (!isset($cfonts[$font])) {
$cfonts[$font] = $this->AddFont($font, $style, $font . '.php');
}
$this->SetFont($font, $style, $size);
$this->colordecode($color, $comp);
$this->SetTextColor($comp[0], $comp[1], $comp[2]);
if ($posx !== null && $posy !== null) {
$this->SetXY($posx, $posy);
$this->Cell($width, $height, $text, $this->border);
} else {
$this->Write($height, $text);
}
}
示例2: generatePDF
function generatePDF()
{
// tempfolder
$tmpBaseFolder = TEMP_FOLDER . '/shopsystem';
$tmpFolder = project() ? "{$tmpBaseFolder}/" . project() : "{$tmpBaseFolder}/site";
if (is_dir($tmpFolder)) {
Filesystem::removeFolder($tmpFolder);
}
if (!file_exists($tmpFolder)) {
Filesystem::makeFolder($tmpFolder);
}
$baseFolderName = basename($tmpFolder);
//Get site
Requirements::clear();
$link = Director::absoluteURL($this->pdfLink() . "/?view=1");
$response = Director::test($link);
$content = $response->getBody();
$content = utf8_decode($content);
$contentfile = "{$tmpFolder}/" . $this->PublicURL . ".html";
if (!file_exists($contentfile)) {
// Write to file
if ($fh = fopen($contentfile, 'w')) {
fwrite($fh, $content);
fclose($fh);
}
}
return $contentfile;
}
示例3: call
public function call($data)
{
$default_parameters = array('USER' => $this->config->get('pp_payflow_iframe_user'), 'VENDOR' => $this->config->get('pp_payflow_iframe_vendor'), 'PWD' => $this->config->get('pp_payflow_iframe_password'), 'PARTNER' => $this->config->get('pp_payflow_iframe_partner'), 'BUTTONSOURCE' => 'OpenCart_Cart_PFP');
$call_parameters = array_merge($data, $default_parameters);
if ($this->config->get('pp_payflow_iframe_test')) {
$url = 'https://pilot-payflowpro.paypal.com';
} else {
$url = 'https://payflowpro.paypal.com';
}
$query_params = array();
foreach ($call_parameters as $key => $value) {
$query_params[] = $key . '=' . utf8_decode($value);
}
$this->log('Call data: ' . implode('&', $query_params));
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, implode('&', $query_params));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($curl);
$this->log('Response data: ' . $response);
$response_params = array();
parse_str($response, $response_params);
return $response_params;
}
示例4: parse
/**
* @param string xml content
* @return true|PEAR_Error
*/
function parse($data)
{
if (!extension_loaded('xml')) {
include_once 'PEAR.php';
return PEAR::raiseError("XML Extension not found", 1);
}
$this->_dataStack = $this->_valStack = array();
$this->_depth = 0;
if (strpos($data, 'encoding="UTF-8"') || strpos($data, 'encoding="utf-8"') || strpos($data, "encoding='UTF-8'") || strpos($data, "encoding='utf-8'")) {
$this->encoding = 'UTF-8';
}
if (version_compare(phpversion(), '5.0.0', 'lt') && $this->encoding == 'UTF-8') {
$data = utf8_decode($data);
$this->encoding = 'ISO-8859-1';
}
$xp = xml_parser_create($this->encoding);
xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, 0);
xml_set_object($xp, $this);
xml_set_element_handler($xp, 'startHandler', 'endHandler');
xml_set_character_data_handler($xp, 'cdataHandler');
if (!xml_parse($xp, $data)) {
$msg = xml_error_string(xml_get_error_code($xp));
$line = xml_get_current_line_number($xp);
xml_parser_free($xp);
include_once 'PEAR.php';
return PEAR::raiseError("XML Error: '{$msg}' on line '{$line}'", 2);
}
xml_parser_free($xp);
return true;
}
示例5: button
/**
* Erzeugt Button
* @param string $type
* @param string $name
* @param string $descr
* @param string $class
*/
public static function button($type, $name, $descr, $class = '', $isNotUtf8 = false)
{
if ($isNotUtf8) {
$descr = utf8_decode($descr);
}
print "<button type=\"{$type}\" class=\"buttons {$class}\" name=\"{$name}\" id=\"{$name}\">{$descr}</button>";
}
示例6: Footer
function Footer()
{
$this->SetY(-15);
$this->SetFont('Arial', '', 8);
$this->SetTextColor(128);
$this->Cell(0, 10, utf8_decode('Centro Paraibano de Quiropraxia'), 0, 0, 'C');
}
示例7: getForm
/**
* Method to get the record form.
*
* @param array $data An optional array of data for the form to interogate.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
*
* @return JForm A JForm object on success, false on failure
*
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_admin.profile', 'profile', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) {
return false;
}
// Check for username compliance and parameter set
$isUsernameCompliant = true;
if ($this->loadFormData()->username) {
$username = $this->loadFormData()->username;
$isUsernameCompliant = !(preg_match('#[<>"\'%;()&\\\\]|\\.\\./#', $username) || strlen(utf8_decode($username)) < 2 || trim($username) != $username);
}
$this->setState('user.username.compliant', $isUsernameCompliant);
if (!JComponentHelper::getParams('com_users')->get('change_login_name') && $isUsernameCompliant) {
$form->setFieldAttribute('username', 'required', 'false');
$form->setFieldAttribute('username', 'readonly', 'true');
$form->setFieldAttribute('username', 'description', 'COM_ADMIN_USER_FIELD_NOCHANGE_USERNAME_DESC');
}
// When multilanguage is set, a user's default site language should also be a Content Language
if (JLanguageMultilang::isEnabled()) {
$form->setFieldAttribute('language', 'type', 'frontend_language', 'params');
}
// If the user needs to change their password, mark the password fields as required
if (JFactory::getUser()->requireReset) {
$form->setFieldAttribute('password', 'required', 'true');
$form->setFieldAttribute('password2', 'required', 'true');
}
return $form;
}
示例8: validar_direccion
function validar_direccion($direccion)
{
//Nos conectamnos a la Api de ggogle maps para validar la dirección. Si es válida, obtendremos las coordenadas y
// podremos mostrar el punto de venta en un mapa.
$base_url = "https://maps.googleapis.com/maps/api/geocode/json?";
$idcomuna = $this->input->post('IdComuna');
$idregion = $this->input->post('IdRegion');
$idprovincia = $this->input->post('IdProvincia');
if ($idcomuna != "" && $idregion != "" && $idprovincia != "") {
$region = $this->common_model->buscar_fila_sql('region', 'IdRegion', $idregion)->Nombre;
$provincia = $this->common_model->buscar_fila_sql('provincia', 'IdProvincia', $idprovincia)->Nombre;
$comuna = $this->common_model->buscar_fila_sql('comuna', 'IdComuna', $idcomuna)->Nombre;
//Buscar coordenadas de la dirección
$address = utf8_decode($direccion . ',' . $comuna . ',' . $provincia . ', Chile');
$request_url = $base_url . "address=" . urlencode($address);
$result = file_get_contents($request_url) or die("url not loading");
$arr = json_decode($result, true);
//resultados en un arreglo.
if ($arr['status'] == "OK") {
$this->latitud = $arr['results'][0]['geometry']['location']['lat'];
$this->longitud = $arr['results'][0]['geometry']['location']['lng'];
return true;
} else {
return false;
}
} else {
return false;
}
}
示例9: fromSong
/**
* Generate the downloadable path for a song.
*
* @param Song $song
*
* @return string
*/
protected function fromSong(Song $song)
{
if ($s3Params = $song->s3_params) {
// The song is hosted on Amazon S3.
// We download it back to our local server first.
$localPath = rtrim(sys_get_temp_dir(), '/') . '/' . basename($s3Params['key']);
$url = $song->getObjectStoragePublicUrl();
abort_unless($url, 404);
// The following function require allow_url_fopen to be ON.
// We're just assuming that to be the case here.
copy($url, $localPath);
} else {
// The song is hosted locally. Make sure the file exists.
abort_unless(file_exists($song->path), 404);
$localPath = $song->path;
}
// The BinaryFileResponse factory only accept ASCII-only file names.
if (ctype_print($localPath)) {
return $localPath;
}
// For those with high-byte characters in names, we copy it into a safe name
// as a workaround.
$newPath = rtrim(sys_get_temp_dir(), '/') . '/' . utf8_decode(basename($song->path));
if ($s3Params) {
// If the file is downloaded from S3, we rename it directly.
// This will save us some disk space.
rename($localPath, $newPath);
} else {
// Else we copy it to another file to not mess up the original one.
copy($localPath, $newPath);
}
return $newPath;
}
示例10: processXML
function processXML($rawXML)
{
//echo '<pre>' . $rawXML . '</pre>';
$rawXML = utf8_decode($rawXML);
$rawXML = iconv("UTF-8", "UTF-8//IGNORE", $rawXML);
//echo '<pre>' . $rawXML . '</pre>';
if (!$this->parse($rawXML)) {
return false;
}
// parse the submitted string, check for errors
//echo 'parsed string = '; print_r($this->arrOutput); echo '<br />';
$this->username = $this->getNodeData(array('ACCESSREQUEST', 'ACCESSUSERID'), $this->arrOutput);
$this->password = $this->getNodeData(array('ACCESSREQUEST', 'ACCESSPASSWORD'), $this->arrOutput);
if (!$this->validateUser($this->username, $this->password)) {
return false;
}
// verify username and password
//echo 'user was validated<br />';
if (!$this->formatArray()) {
return false;
}
// format submitted string into order array, check for errors
//echo 'array was formatted<br />';
if (!$this->buildJournalEntry()) {
return false;
}
//echo 'journal entry was built and posted<br />';
return true;
}
示例11: convertToDatabaseValue
public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
if ($value !== null) {
$value = utf8_decode($value);
}
return parent::convertToDatabaseValue($value, $platform);
}
示例12: parse_path
function parse_path() {
$path = array();
if (isset($_SERVER['REQUEST_URI'])) {
$request_path = explode('?', $_SERVER['REQUEST_URI']);
$path['base'] = rtrim(dirname($_SERVER['SCRIPT_NAME']), '\/');
$path['call_utf8'] = substr(urldecode($request_path[0]), strlen($path['base']) + 1);
$path['call'] = utf8_decode($path['call_utf8']);
if ($path['call'] == basename($_SERVER['PHP_SELF'])) {
$path['call'] = '';
}
$path['call_parts'] = explode('/', $path['call']);
if ($request_path[1]='') {
$path['query_utf8'] = urldecode($request_path[1]);
$path['query'] = utf8_decode(urldecode($request_path[1]));
$vars = explode('&', $path['query']);
foreach ($vars as $var) {
$t = explode('=', $var);
$path['query_vars'][$t[0]] = $t[1];
}
}
}
return $path;
}
示例13: defineFooter
/**
* insere footer na devolutiva
*
* @depends FPDF
*/
public function defineFooter()
{
// printa o protocolo
//print abaixo eh somente para pag. 2 da devolutiva
if ($this->objMakePdf->PageNo() == 2) {
$this->objMakePdf->SetFont('Arial', 'BI', 10);
//printa num. pagina a esquerda da pagina
$this->objMakePdf->SetXY(9, -17);
$numProtocolo = $this->objDevolutive->getProtocolo();
$protocoloCreateAt = $this->objDevolutive->getProtocoloCreateAt();
$textoProtocoloDevolutiva = "(PROTOCOLO " . $numProtocolo . utf8_decode(" às ") . $protocoloCreateAt . ")";
$this->objMakePdf->Cell(8, 10, $textoProtocoloDevolutiva, 0, 0, 'L');
} else {
$this->objMakePdf->SetTextColor(51, 51, 51);
$this->objMakePdf->SetDrawColor(51, 51, 51);
$this->objMakePdf->SetLineWidth(0.2);
$this->objMakePdf->line(10, 279, 200, 279);
#$this->objMakePdf->line(10,280,200,280);
$this->objMakePdf->SetXY(10, -15);
#-15);
$this->objMakePdf->SetFont('Arial', 'BI', 7);
$mm_distancia_da_margem_esquerda_img1 = 102;
$mm_distancia_do_topo_img1 = 280;
$mm_largura_img1 = 100;
$imagemFooter = $this->objMakePdf->public_path . $this->objMakePdf->getImagemFooter();
$this->objMakePdf->Image($imagemFooter, $mm_distancia_da_margem_esquerda_img1, $mm_distancia_do_topo_img1, $mm_largura_img1);
$this->objMakePdf->SetFont('Arial', 'BI', 8);
$this->objMakePdf->SetXY(30, -17);
$this->objMakePdf->Cell(20, 10, utf8_decode("{$this->objMakePdf->getEmissao_data()}"), 0, 0, 'C');
$this->objMakePdf->SetXY(9, -17);
$this->objMakePdf->Cell(8, 10, $this->objMakePdf->PageNo() . '/{nb}', 0, 0, 'C');
}
}
示例14: nsBloggerNewPost
function nsBloggerNewPost($auth, $blogID, $title, $text)
{
$text = str_ireplace('allowfullscreen', '', $text);
$title = utf8_decode(strip_tags($title));
$text = preg_replace('/<object\\b[^>]*>(.*?)<\\/object>/is', "", $text);
$text = preg_replace('/<iframe\\b[^>]*>(.*?)<\\/iframe>/is', "", $text);
$text = utf8_decode($text);
$postText = '<entry xmlns="http://www.w3.org/2005/Atom"><title type="text">' . $title . '</title><content type="xhtml">' . $text . '</content></entry>';
//prr($postText);
$ch = curl_init("https://www.blogger.com/feeds/{$blogID}/posts/default");
$headers = array("Content-type: application/atom+xml", "Content-Length: " . strlen($postText), "Authorization: GoogleLogin auth=" . $auth, $postText);
curl_setopt($ch, CURLOPT_UNRESTRICTED_AUTH, 1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0)");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
global $nxs_skipSSLCheck;
if ($nxs_skipSSLCheck === true) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
}
$result = curl_exec($ch);
curl_close($ch);
if (stripos($result, 'tag:blogger.com') !== false) {
$postID = CutFromTo($result, " rel='alternate' type='text/html' href='", "'");
return array("code" => "OK", "post_id" => $postID);
} else {
return array("code" => "ERR", "error" => $result);
}
}
示例15: normalize
function normalize($text, $separator = "-")
{
$isUTF8 = mb_detect_encoding($text . " ", 'UTF-8,ISO-8859-1') == 'UTF-8';
$text = $isUTF8 ? utf8_decode($text) : $text;
$text = trim($text);
$_a = utf8_decode("ÁÀãâàá");
$_e = utf8_decode("ÉÈéè");
$_i = utf8_decode("ÍÌíì");
$_o = utf8_decode("ÓÒóò");
$_u = utf8_decode("ÚÙúù");
$_n = utf8_decode("Ññ");
$_c = utf8_decode("Çç");
$_b = utf8_decode("ß");
$_dash = "\\.,_ ";
$text = preg_replace("/[{$_a}]/", "a", $text);
$text = preg_replace("/[{$_e}]/", "e", $text);
$text = preg_replace("/[{$_i}]/", "i", $text);
$text = preg_replace("/[{$_o}]/", "o", $text);
$text = preg_replace("/[{$_u}]/", "u", $text);
$text = preg_replace("/[{$_n}]/", "n", $text);
$text = preg_replace("/[{$_c}]/", "c", $text);
$text = preg_replace("/[{$_b}]/", "ss", $text);
$text = preg_replace("/[{$_dash}]/", $separator, $text);
$text = preg_replace("/[^a-zA-Z0-9\\-]/", "", $text);
$text = strtolower($text);
return $isUTF8 ? utf8_encode($text) : $text;
}