Esempio n. 1
7
function ote_accent($str)
{
    $str = str_replace("'", " ", $str);
    $str = utf8_decode($str);
    $ch = strtr($str, '����������������������������������������������������', 'AAAAAACEEEEIIIIOOOOOUUUUYaaaaaaceeeeiiiioooooouuuuyy');
    return utf8_encode($ch);
}
Esempio n. 2
2
 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;
 }
Esempio n. 3
1
 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);
     }
 }
 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;
 }
Esempio n. 5
0
 /**
  * @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;
 }
Esempio n. 6
0
 /**
  * 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>";
 }
Esempio n. 7
0
 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');
 }
Esempio n. 8
0
 /**
  * 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;
 }
Esempio n. 9
0
 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;
     }
 }
Esempio n. 10
0
 /**
  * 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;
 }
Esempio n. 11
0
 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;
 }
Esempio n. 12
0
 public function convertToDatabaseValue($value, AbstractPlatform $platform)
 {
     if ($value !== null) {
         $value = utf8_decode($value);
     }
     return parent::convertToDatabaseValue($value, $platform);
 }
Esempio n. 13
0
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;
}
Esempio n. 14
0
 /**
  * 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');
     }
 }
Esempio n. 15
0
 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);
     }
 }
Esempio n. 16
0
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;
}
Esempio n. 17
0
 public function process($args)
 {
     $answer = "";
     $args = trim($args);
     if (strlen($args) > 0) {
         $entrada = urlencode($args);
         $url = "https://www.google.com.mx/search?q={$entrada}&oq=200&aqs=chrome.1.69i57j69i59j69i65l2j0l2.3015j0j8&client=ubuntu-browser&sourceid=chrome&es_sm=122&ie=UTF-8";
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/37.0.2062.120 Chrome/37.0.2062.120 Safari/537.36');
         $html = curl_exec($ch);
         $web = new DomDocument();
         @$web->loadHTML($html);
         $nodos = @$web->getElementById('topstuff')->getElementsByTagName('div');
         $answer = "No pude convertir lo que me pides.";
         if ($nodos) {
             $nodos = iterator_to_array($nodos);
             if (count($nodos) === 6) {
                 $answer = utf8_decode($nodos[3]->nodeValue . " " . $nodos[4]->nodeValue);
             }
         }
     } else {
         $answer = "Ingresa una expresion.";
     }
     $this->reply($answer, $this->currentchannel, $this->nick);
 }
Esempio n. 18
0
function imprimer($conn, $id, $titre, $photo)
{
    echo '
  <div class="col-md-3 col-sm-6 hero-feature">
    <div class="thumbnail">
      <img src="' . $photo . '" alt="">
      <div class="caption">
        <h3>' . utf8_decode($titre) . '</h3>
        <p>
        ';
    $res = louerpar($conn, $id);
    $nom = odbc_result($res, 1);
    $prenom = odbc_result($res, 2);
    if ($nom) {
        echo 'Appartement loué par : ' . $prenom . '  ' . $nom;
    } else {
        echo 'Appartement Libre';
        if (isAvailable($conn, $id)) {
            echo '<a class="btn btn-primary" href="proprietaire_fonction.php?a=0&id=' . $id . '" >Rendre Indisponible</a>';
        } else {
            echo '<a class="btn btn-primary" href="proprietaire_fonction.php?a=1&id=' . $id . '" >Rendre Disponible</a>';
        }
    }
    echo '
        </p>
      </div>
    </div>
  </div>
  ';
}
 /**
  * Returns array, containing detailed results for any Google search.
  *
  * @access       private
  * @param        string        $query      String, containing the search query.
  * @param        string        $tld        String, containing the desired Google top level domain.
  * @return       array                     Returns array, containing the keys 'URL', 'Title' and 'Description'.
  */
 public static function googleArray($query)
 {
     $result = array();
     $pages = 1;
     $delay = 0;
     for ($start = 0; $start < $pages; $start++) {
         $url = 'http://www.google.' . GOOGLE_TLD . '/custom?q=' . $query . '&filter=0' . '&num=100' . ($start == 0 ? '' : '&start=' . $start . '00');
         $str = SEOstats::cURL($url);
         if (preg_match("#answer=86640#i", $str)) {
             $e = 'Please read: http://www.google.com/support/websearch/' . 'bin/answer.py?&answer=86640&hl=en';
             throw new SEOstatsException($e);
         } else {
             $html = new DOMDocument();
             @$html->loadHtml($str);
             $xpath = new DOMXPath($html);
             $links = $xpath->query("//div[@class='g']//a");
             $descs = $xpath->query("//td[@class='j']//div[@class='std']");
             $i = 0;
             foreach ($links as $link) {
                 if (!preg_match('#cache#si', $link->textContent) && !preg_match('#similar#si', $link->textContent)) {
                     $result[] = array('url' => $link->getAttribute('href'), 'title' => utf8_decode($link->textContent), 'descr' => utf8_decode($descs->item($i)->textContent));
                     $i++;
                 }
             }
             if (preg_match('#<div id="nn"><\\/div>#i', $str) || preg_match('#<div id=nn><\\/div>#i', $str)) {
                 $pages += 1;
                 $delay += 200000;
                 usleep($delay);
             } else {
                 $pages -= 1;
             }
         }
     }
     return $result;
 }
Esempio n. 20
0
function ConsultarCEP($cep)
{
    $url = 'http://www.buscacep.correios.com.br/sistemas/buscacep/resultadoBuscaCepEndereco.cfm';
    $fields = array('relaxation' => urlencode(intval($cep)), 'tipoCEP' => urlencode('ALL'), 'semelhante' => urlencode('N'));
    $fields_string = '';
    foreach ($fields as $key => $value) {
        $fields_string .= $key . '=' . $value . '&';
    }
    rtrim($fields_string, '&');
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, count($fields));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    $result = utf8_decode(curl_exec($ch));
    curl_close($ch);
    $doc = new DOMDocument();
    $doc->preserveWhiteSpace = false;
    $doc->strictErrorChecking = false;
    $doc->recover = true;
    $doc->loadHTML(mb_convert_encoding($result, 'HTML-ENTITIES', 'UTF-8'));
    $xpath = new DOMXPath($doc);
    $query = "//table[@class='tmptabela']//td";
    $entries = $xpath->query($query);
    $uf = explode('/', $entries->item(2)->nodeValue)[1];
    $cidade = explode('/', $entries->item(2)->nodeValue)[0];
    $bairro = substr($entries->item(1)->nodeValue, 0, -2);
    $logradouro = substr($entries->item(0)->nodeValue, 0, -2);
    $return = array('uf' => trim($uf), 'cidade' => trim($cidade), 'bairro' => trim($bairro), 'logradouro' => trim($logradouro));
    if (!empty($return)) {
        return $return;
    } else {
        return false;
    }
}
Esempio n. 21
0
 function change($data, $input, $output)
 {
     $input = strtoupper(trim($input));
     $output = strtoupper(trim($output));
     if ($input == $output) {
         return $data;
     }
     if ($input == 'UTF-8' && $output == 'ISO-8859-1') {
         $data = str_replace(array('€', '„', '“'), array('EUR', '"', '"'), $data);
     }
     if (function_exists('iconv')) {
         set_error_handler('acymailing_error_handler_encoding');
         $encodedData = iconv($input, $output . "//IGNORE", $data);
         restore_error_handler();
         if (!empty($encodedData) && !acymailing_error_handler_encoding('result')) {
             return $encodedData;
         }
     }
     if (function_exists('mb_convert_encoding')) {
         return mb_convert_encoding($data, $output, $input);
     }
     if ($input == 'UTF-8' && $output == 'ISO-8859-1') {
         return utf8_decode($data);
     }
     if ($input == 'ISO-8859-1' && $output == 'UTF-8') {
         return utf8_encode($data);
     }
     return $data;
 }
 static function clear_input_ruta($data)
 {
     $data = str_replace('\\', '\\\\', $data);
     $data = str_replace('"', '\\"', $data);
     // $data = self::clear_input($data);
     return utf8_decode($data);
 }
Esempio n. 23
0
 public function sortTweets($tweets, $tweetLimit = 100)
 {
     $activity = array();
     foreach ($tweets as $t) {
         $text = $t->text;
         // Convert URLs into hyperlinks
         $text = preg_replace("/(http:\\/\\/)(.*?)\\/([\\w\\.\\/\\&\\=\\?\\-\\,\\:\\;\\#\\_\\~\\%\\+]*)/", "<a href=\"\\0\">\\0</a>", $text);
         // Convert usernames (@) into links
         $text = preg_replace("(@([a-zA-Z0-9\\_]+))", '<a target="_blank" href="http://www.twitter.com/\\1">\\0</a>', $text);
         // Convert hash tags (#) to links
         $text = preg_replace('/(^|\\s)#(\\w+)/', '\\1<a href="http://search.twitter.com/search?q=%23\\2">#\\2</a>', $text);
         //Specifically for non-English tweets, converts UTF-8 into ISO-8859-1
         //$text = iconv("UTF-8", "ISO-8859-1//TRANSLIT", $text);
         $text = utf8_decode($text);
         // get the URL of the status..
         $status = "https://twitter.com/ppi_framework/status/" . (string) $t->id;
         $timestamp = strtotime($t->created_at . ' UTC');
         $propertime = gmdate('F jS Y, H:i', $timestamp);
         //Customize this to your liking
         //Store tweet and time into the array
         $tweet_item = array('title' => $text, 'url' => $status, 'date' => $propertime, 'source' => 'twitter');
         $activity[$timestamp] = $tweet_item;
         if (count($activity) >= $tweetLimit) {
             break;
         }
     }
     krsort($activity);
     return $activity;
 }
Esempio n. 24
0
 function Footer()
 {
     //Position at 1.5 cm from bottom
     //$this->SetY(-45);
     //Arial italic 8
     $y = $this->GetY();
     if ($this->footer) {
         $this->SetY(-22);
         $this->SetFont('helvetica', '', 8);
         $this->Cell(15, 5, '', 0, FALSE, 'L');
         $this->Cell(75, 5, utf8_decode('Responsable de elaboración PAC'), 'T', FALSE, 'C');
         $this->Cell(15, 5, '', 0, FALSE, 'L');
         $this->Cell(75, 5, utf8_decode('Autorización Inmediato Superior'), 'T', FALSE, 'C');
         $this->Ln(8);
     } else {
         $this->SetY(-15);
     }
     $this->SetFont('Arial', 'I', 7);
     //Page number
     // $this->Image('assets/img/quinua.png', 140, 258, 60);
     $this->Cell(150, 5, 'Fecha: ' . date('d/m/Y'), 0, 0, 'L');
     $this->Cell(45, 5, 'Pag.' . $this->PageNo(), 0, 0, 'R');
     $this->Ln();
     $this->Cell(195, 5, utf8_decode('Av. Mariscal Santa Cruz, Edif. Centro de Comunicaciones La Paz 5to Piso - Telefonos: (591)-(2)-2119999-2156600 - www.oopp.gob.bo'), 'T', 0, 'C');
 }
Esempio n. 25
0
 /**
  * Add elements
  */
 public function testAddElements()
 {
     $objectSource = __DIR__ . "/../_files/documents/reader.docx";
     $imageSource = __DIR__ . "/../_files/images/PhpWord.png";
     $imageUrl = 'http://php.net//images/logos/php-med-trans-light.gif';
     $section = new Section(0);
     $section->addText(utf8_decode('ä'));
     $section->addLink(utf8_decode('http://äää.com'), utf8_decode('ä'));
     $section->addTextBreak();
     $section->addPageBreak();
     $section->addTable();
     $section->addListItem(utf8_decode('ä'));
     $section->addObject($objectSource);
     $section->addImage($imageSource);
     $section->addTitle(utf8_decode('ä'), 1);
     $section->addTextRun();
     $section->addFootnote();
     $section->addCheckBox(utf8_decode('chkä'), utf8_decode('Contentä'));
     $section->addTOC();
     $elementCollection = $section->getElements();
     $elementTypes = array('Text', 'Link', 'TextBreak', 'PageBreak', 'Table', 'ListItem', 'Object', 'Image', 'Title', 'TextRun', 'Footnote', 'CheckBox', 'TOC');
     $i = 0;
     foreach ($elementTypes as $elementType) {
         $this->assertInstanceOf("PhpOffice\\PhpWord\\Element\\{$elementType}", $elementCollection[$i]);
         $i++;
     }
 }
Esempio n. 26
0
/**
 * UTF8::strlen
 *
 * @package    Kohana
 * @author     Kohana Team
 * @copyright  (c) 2007-2011 Kohana Team
 * @copyright  (c) 2005 Harry Fuecks
 * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
 */
function _strlen($str)
{
    if (UTF8::is_ascii($str)) {
        return strlen($str);
    }
    return strlen(utf8_decode($str));
}
 function Header()
 {
     $this->AddFont('Amble-Regular', '', 'Amble-Regular.php');
     $this->SetFont('Amble-Regular', '', 10);
     $fecha = date('Y-m-d', time());
     $this->SetX(1);
     $this->SetY(1);
     $this->Cell(20, 5, $fecha, 0, 0, 'C', 0);
     $this->Cell(150, 5, "CLIENTE", 0, 1, 'R', 0);
     $this->SetFont('Arial', 'B', 16);
     $this->Cell(190, 8, $_SESSION['empresa'], 0, 1, 'C', 0);
     $this->Image('../images/logo_empresa.jpg', 5, 8, 35, 28);
     $this->SetFont('Amble-Regular', '', 10);
     $this->Cell(180, 5, "PROPIETARIO: " . utf8_decode($_SESSION['propietario']), 0, 1, 'C', 0);
     $this->Cell(80, 5, "TEL.: " . utf8_decode($_SESSION['telefono']), 0, 0, 'R', 0);
     $this->Cell(80, 5, "CEL.: " . utf8_decode($_SESSION['celular']), 0, 1, 'C', 0);
     $this->Cell(180, 5, "DIR.: " . utf8_decode($_SESSION['direccion']), 0, 1, 'C', 0);
     $this->Cell(180, 5, "SLOGAN.: " . utf8_decode($_SESSION['slogan']), 0, 1, 'C', 0);
     $this->Cell(180, 5, utf8_decode($_SESSION['pais_ciudad']), 0, 1, 'C', 0);
     $this->SetDrawColor(0, 0, 0);
     $this->SetLineWidth(0.5);
     $this->SetFillColor(120, 120, 120);
     $this->Line(1, 50, 210, 50);
     $this->SetFont('Arial', 'B', 12);
     $this->Cell(190, 5, utf8_decode("NÚMEROS DE AUTORIZACIÓN CERCANOS A CADUCAR"), 0, 1, 'C', 0);
     $this->SetFont('Arial', 'B', 10);
     $this->Cell(90, 5, utf8_decode($fecha), 0, 0, 'R', 0);
     $this->Cell(40, 5, utf8_decode($_GET['fin']), 0, 1, 'C', 0);
     $this->Ln(5);
 }
Esempio n. 28
0
 function Footer()
 {
     if ($this->logoUrl != "") {
         $this->Image($this->logoUrl, 10, 8, 20);
     }
     if ($this->header) {
         $this->SetFont('Arial', "", 14);
         $this->Cell(80);
         //Décalage à droite
         $this->Cell(30, 10, $this->header, 0, 'C');
     }
     //si on a un footer spécificique pour la page courante...
     $footer = array();
     if ($this->footers['page' . $this->PageNo()]) {
         $footer = $this->footers['page' . $this->PageNo()];
     } else {
         if ($this->footers['all']) {
             $footer = $this->footers['all'];
         }
     }
     //on applique le footer
     if ($footer['name']) {
         $this->SetY(-15 * $this->h / 297);
         $this->SetX(5 * $this->w / 210);
         //Police Arial italique 8
         $this->SetFont('Arial', 'I', 8 * $this->w / 210);
         if ($footer['link']) {
             $this->Cell(0, 10, utf8_decode($footer['name']), 0, 0, '', false, utf8_decode($footer['link']));
         } else {
             $this->Cell(0, 10, utf8_decode($footer['name']), 0, 0, '', false, '');
         }
     }
 }
Esempio n. 29
0
 function Header()
 {
     $this->AddFont('Amble-Regular', '', 'Amble-Regular.php');
     $this->SetFont('Amble-Regular', '', 10);
     $fecha = date('Y-m-d', time());
     $this->SetX(1);
     $this->SetY(1);
     $this->Cell(20, 5, $fecha, 0, 0, 'C', 0);
     $this->Cell(150, 5, "CLIENTE", 0, 1, 'R', 0);
     $this->SetFont('Arial', 'B', 16);
     $this->Cell(190, 8, $_SESSION['empresa'], 0, 1, 'C', 0);
     $this->Image('../images/logo_empresa.jpg', 5, 8, 35, 30);
     $this->SetFont('Amble-Regular', '', 10);
     $this->Cell(180, 5, "PROPIETARIO: " . utf8_decode($_SESSION['propietario']), 0, 1, 'C', 0);
     $this->Cell(80, 5, "TEL.: " . utf8_decode($_SESSION['telefono']), 0, 0, 'R', 0);
     $this->Cell(80, 5, "CEL.: " . utf8_decode($_SESSION['celular']), 0, 1, 'C', 0);
     $this->Cell(180, 5, "DIR.: " . utf8_decode($_SESSION['direccion']), 0, 1, 'C', 0);
     $this->Cell(180, 5, "SLOGAN.: " . utf8_decode($_SESSION['slogan']), 0, 1, 'C', 0);
     $this->Cell(180, 5, utf8_decode($_SESSION['pais_ciudad']), 0, 1, 'C', 0);
     $this->SetDrawColor(0, 0, 0);
     $this->SetLineWidth(0.4);
     $this->Line(1, 46, 210, 46);
     $this->SetFont('Arial', 'B', 12);
     $this->Cell(190, 5, utf8_decode("CONSULTA DE LA SERIE " . $_GET['id']), 0, 1, 'C', 0);
     $this->SetFont('Amble-Regular', '', 10);
     $this->Ln(3);
     $this->SetFillColor(255, 255, 225);
     $this->SetLineWidth(0.2);
 }
Esempio n. 30
0
 public function load($key, $language_code = null, $use_cache = true)
 {
     global $lC_Database, $lC_Addons;
     if (is_null($language_code)) {
         $language_code = $this->_code;
     }
     if ($this->_languages[$language_code]['parent_id'] > 0) {
         $this->load($key, $this->getCodeFromID($this->_languages[$language_code]['parent_id']));
     }
     $Qdef = $lC_Database->query('select * from :table_languages_definitions where languages_id = :languages_id and content_group = :content_group');
     $Qdef->bindTable(':table_languages_definitions', TABLE_LANGUAGES_DEFINITIONS);
     $Qdef->bindInt(':languages_id', $this->getData('id', $language_code));
     $Qdef->bindValue(':content_group', $key);
     if ($use_cache) {
         $Qdef->setCache('languages-' . $language_code . '-' . $key);
     }
     $Qdef->execute();
     while ($Qdef->next()) {
         $this->_definitions[$Qdef->value('definition_key')] = utf8_decode($Qdef->value('definition_value'));
     }
     $Qdef->freeResult();
     // inject the addons language defines
     if (isset($lC_Addons)) {
         $aoArr = $lC_Addons->getAddons('enabled');
         if (is_array($aoArr)) {
             foreach ($aoArr as $ao => $aoData) {
                 $file = DIR_FS_CATALOG . 'addons/' . $ao . '/languages/' . $language_code . '.xml';
                 if (file_exists($file)) {
                     $this->injectAddonDefinitions($file, $language_code);
                 }
             }
         }
     }
 }