function load_show($title, $page)
{
    $raw = file_get_contents("http://www.oppetarkiv.se/etikett/titel/" . urlencode($title) . "/?sida={$page}&sort=tid_stigande&embed=true");
    $episodeRaw = get_between_all($raw, '<article class="svtUnit', 'article>');
    $return = array('last' => !string_contain($raw, 'Visa fler'), 'episodes' => array());
    foreach ($episodeRaw as $episode) {
        $temp = array();
        $temp['title'] = get_between($episode, 'alt="', '"');
        $temp['cover'] = 'http:' . get_between($episode, 'oaImg" src="', '"');
        $temp['year'] = get_between($episode, 'datetime="', '-');
        $temp['aired'] = get_between($episode, 'datetime="', 'T');
        $temp['url'] = 'http://www.oppetarkiv.se' . get_between($episode, ' href="', '"');
        array_push($return['episodes'], $temp);
    }
    return $return;
}
 function prepare_office_data($office, $type, $parent_id, $no_parent = 'false')
 {
     $office_model = $this->office_model();
     $office_model['id'] = $office['Id'];
     $office_model['name'] = $office['Name'];
     if (strpos($office_model['name'], '(') !== false && strpos($office_model['name'], ')') !== false) {
         $abbreviation = get_between($office_model['name'], '(', ')');
         $office_model['name'] = str_replace('(' . $abbreviation . ')', '', $office_model['name']);
         $office_model['name'] = trim($office_model['name']);
     } else {
         $abbreviation = null;
     }
     if (strpos($office_model['name'], 'U.S. Department') !== false) {
         $office_model['name'] = str_replace('U.S. Department', 'Department', $office_model['name']);
         $office_model['name'] = trim($office_model['name']);
     }
     // see if this is a cfo act agency
     $office_model['cfo_act_agency'] = $this->cfo_act_check($office_model['name']) ? 'true' : 'false';
     $url = !empty($office['Web_Url'][0]['Url']) ? $office['Web_Url'][0]['Url'] : null;
     //if(!empty($url)) {
     //	$url = substr($url, 0, strpos($url, '.gov') + 4);
     //}
     $office_model['abbreviation'] = $abbreviation;
     $office_model['url'] = $url;
     $office_model['parent_office_id'] = $parent_id;
     $office_model['no_parent'] = $no_parent;
     $office_model['reporting_authority_type'] = $type;
     return $office_model;
 }
            </div>


            <?php 
if (!empty($validation['errors'])) {
    if (array_key_exists("catalog", $validation['errors'])) {
        $validation['catalog'] = clone $validation['source'];
        $validation['catalog']->dataset = "...truncated to display here...";
    }
    if (isset($validation['source']->conformsTo)) {
        $validation['source'] = $validation['source']->dataset;
    }
    $key_count = array();
    foreach ($validation['errors'] as $key => $error) {
        $source_key = strpos($key, '[') !== false ? get_between($key, '[', ']') : $key;
        if ($source_key === "catalog") {
            $validation['source'][$source_key] = $validation['catalog'];
        }
        ?>

                        <?php 
        if (!empty($key_count)) {
            ?>
                            </div>
                          </div>
                        <?php 
        }
        ?>

                    <?php 
function bypassyourdog($domain, $useragent, $proxy)
{
    $cURL = curl_init();
    curl_setopt($cURL, CURLOPT_URL, $domain);
    curl_setopt($cURL, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($cURL, CURLOPT_HEADER, 1);
    curl_setopt($cURL, CURLOPT_USERAGENT, $useragent);
    curl_setopt($cURL, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($cURL, CURLOPT_PROXY, $proxy);
    curl_setopt($cURL, CURLOPT_COOKIEFILE, "cookie.txt");
    $string = curl_exec($cURL);
    curl_close($cURL);
    $domain = get_between($string, '</span> ', '.</h1>');
    $jschl_vc = get_between($string, '"jschl_vc" value="', '"/>');
    $pass = get_between($string, '"pass" value="', '"/>');
    $settimeout = get_between($string, 'setTimeout(function(){', 'f.submit()');
    $mathvariables = get_between($settimeout, 'var t,r,a,f, ', ';');
    $mathvariable = explode('=', $mathvariables);
    $mathvariable1 = get_between($mathvariables, '{"', '":');
    $mathvariable2 = $mathvariable[0] . "." . $mathvariable1;
    $math1 = get_between($mathvariables, '":', '}');
    $math2 = $mathvariable[0] . get_between($settimeout, ";" . $mathvariable[0], ';a.value');
    $f**k = 0;
    $math2s = explode(';', $math2);
    $mathtotal = 0;
    $answers = array();
    $totalformath1 = 0;
    //echo "Domain: $domain\nJSCHL_VC: $jschl_vc\nPASS: $pass\nSet Timeout: $settimeout\n";
    if ($pass == NULL) {
        //file_put_contents('log.txt', $string, FILE_APPEND);
        return 'Bypass failed';
    }
    if (get_between($math1, '((', '))') != NULL) {
        $dog311 = get_between($math1, '((', '))');
        $math1ss = explode(')', $dog311);
        $math1sss = explode('+', $math1ss[0]);
        $math1ssss = explode('(', $dog311);
        $math1sssss = explode('+', $math1ssss[1]);
        $ifuckdog = 0;
        $ufuckdog = 0;
        foreach ($math1sss as $imoutofvars2) {
            if ($imoutofvars2 == "!" || $imoutofvars2 == "!![]" || $imoutofvars2 == "![]") {
                $ifuckdog++;
            }
        }
        foreach ($math1sssss as $imoutofvars3) {
            if ($imoutofvars3 == "!" || $imoutofvars3 == "!![]" || $imoutofvars3 == "![]") {
                $ufuckdog++;
            }
        }
        $totalformath1 = $ifuckdog . $ufuckdog;
        array_push($answers, $totalformath1 . " +");
    } else {
        $math1ss = explode('+', $math1);
        foreach ($math1ss as $fuckmydog) {
            if ($fuckmydog == "!" || $fuckmydog == "!![]" || $fuckmydog == "![]") {
                $totalformath1++;
            }
        }
        array_push($answers, $totalformath1 . " +");
    }
    foreach ($math2s as $dog123) {
        $typeofmath = substr($dog123, strlen($mathvariable2), 1);
        if (get_between($dog123, '((', '))') != NULL) {
            $dog321 = get_between($dog123, '((', '))');
            $poop = 0;
            $shit = 0;
            $mathss = explode(')', $dog321);
            $mathsss = explode('+', $mathss[0]);
            $mathssss = explode('(', $dog321);
            $mathsssss = explode('+', $mathssss[1]);
            foreach ($mathsss as $imoutofvars) {
                if ($imoutofvars == "!" || $imoutofvars == "!![]" || $imoutofvars == "![]") {
                    $poop++;
                }
            }
            foreach ($mathsssss as $imoutofvars1) {
                if ($imoutofvars1 == "!" || $imoutofvars1 == "!![]" || $imoutofvars1 == "![]") {
                    $shit++;
                }
            }
            $f**k = $poop . $shit;
            array_push($answers, $f**k . " " . $typeofmath);
            $f**k = 0;
        } else {
            $fuckingdogs = explode('=', $dog123);
            $fuckingcats = explode('+', $fuckingdogs[1]);
            foreach ($fuckingcats as $idinglecats) {
                if ($idinglecats == "!" || $idinglecats == "!![]" || $idinglecats == "![]") {
                    $f**k++;
                }
            }
            array_push($answers, $f**k . " " . $typeofmath);
            $f**k = 0;
        }
    }
    foreach ($answers as $answer) {
        $ilikedogs = explode(' ', $answer);
        switch ($ilikedogs[1]) {
            case "+":
                $mathtotal = $mathtotal + $ilikedogs[0];
                break;
            case "-":
                $mathtotal = $mathtotal - $ilikedogs[0];
                break;
            case "*":
                $mathtotal = $mathtotal * $ilikedogs[0];
                break;
        }
    }
    $jschl_answer = strlen($domain) + $mathtotal;
    $domain1 = $domain . "/cdn-cgi/l/chk_jschl?jschl_vc={$jschl_vc}&pass={$pass}&jschl_answer={$jschl_answer}";
    usleep(3000000);
    $cURL1 = curl_init();
    curl_setopt($cURL1, CURLOPT_URL, $domain1);
    curl_setopt($cURL1, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($cURL1, CURLOPT_HEADER, 1);
    curl_setopt($cURL1, CURLOPT_USERAGENT, $useragent);
    curl_setopt($cURL1, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($cURL1, CURLOPT_PROXY, $proxy);
    curl_setopt($cURL1, CURLOPT_COOKIEFILE, "cookie.txt");
    $test = curl_exec($cURL1);
    $cfuid = get_between($test, '__cfduid=', '; expires');
    $cf_clearance = get_between($test, 'cf_clearance=', '; expires');
    //echo '__cfduid='.$cfuid.'; cf_clearance='.$cf_clearance."\n";
    return '__cfduid=' . $cfuid . '; cf_clearance=' . $cf_clearance;
}
 public function process_validation_errors($errors, $offset = null)
 {
     $output = array();
     foreach ($errors as $error) {
         if (!is_numeric($error['property']) and $error['property'] === '' or $error['property'] === '@context' or $error['property'] === '@type' or $error['property'] === '@id' or $error['property'] === 'describedBy' or $error['property'] === 'conformsTo') {
             $error['property'] = 'catalog.' . $error['property'];
         }
         if (is_numeric($error['property']) or strpos($error['property'], '.') === false or $error['property'] === 'catalog.') {
             $key = $error['property'] === 'catalog.' ? 'catalog' : $error['property'];
             $field = 'ALL';
         } else {
             if (strpos($error['property'], 'dataset[') !== false) {
                 $dataset_key = substr($error['property'], 0, strpos($error['property'], '.'));
                 $key = get_between($dataset_key, '[', ']');
                 $full_field = substr($error['property'], strpos($error['property'], '.') + 1);
             } else {
                 $key = substr($error['property'], 0, strpos($error['property'], '.'));
                 $full_field = substr($error['property'], strpos($error['property'], '.') + 1);
             }
             if (strpos($full_field, '[')) {
                 $field = substr($full_field, 0, strpos($full_field, '['));
                 $subfield = 'child-' . get_between($full_field, '[', ']');
             } else {
                 $field = $full_field;
             }
         }
         if ($offset) {
             $key = $key + $offset;
         }
         if (isset($subfield)) {
             $output[$key][$field]['sub_fields'][$subfield][] = $error['message'];
         } else {
             $output[$key][$field]['errors'][] = $error['message'];
         }
         unset($subfield);
     }
     return $output;
 }
function get_cb_data($name, $url)
{
    global $run_environment;
    global $max_records;
    $html = scraperWiki::scrape($url);
    $dom = new simple_html_dom();
    $dom->load($html);
    $count = 1;
    foreach ($dom->find("table[class=cb_table]") as $board) {
        $cb = null;
        $cb['source'] = $url;
        $cb['borough'] = $name;
        $cb['community_board'] = trim($board->find("td[class=cb_title]", 0)->plaintext);
        $cb['community_board_number'] = trim(substr($cb['community_board'], strlen('Community Board ')));
        $cb['city_id'] = get_city_id($cb['borough'], $cb['community_board_number']);
        $cb['neighborhoods'] = trim($board->find("tr", 1)->find("td", 2)->plaintext);
        $cb['precincts'] = trim($board->find("tr", 4)->find("td", 1)->plaintext);
        $cb['precinct_phones'] = trim($board->find("tr", 5)->find("td", 1)->plaintext);
        // Try to parse the unstructured contact info text
        $cb_info = trim($board->find("tr", 3)->find("td", 1)->innertext);
        $cb_info = str_replace('<strong>', '<b>', $cb_info);
        $cb_info = str_replace('</strong>', '</b>', $cb_info);
        $contacts = explode("<b>", $cb_info);
        foreach ($contacts as $val) {
            $val = str_replace("<br />", ",", $val);
            $val = trim($val);
            $val = explode("</b>", $val);
            array_walk($val, create_function('&$val', '$val = trim($val);'));
            if (!empty($val[1])) {
                $heading = trim($val[0], ",");
                $heading = trim($heading, ":");
                $heading = strtolower(str_replace(' ', '_', $heading));
                // Clean up stray html tags
                if (stripos($val[1], '<span>')) {
                    $val[1] = get_between($val[1], '<span>', '</span>');
                }
                $val[1] = trim($val[1], '</p>');
                $val[1] = trim($val[1], ',');
                $val[1] = trim($val[1], ',');
                $cb[$heading] = $val[1];
            }
        }
        // check if we have data in the email field that needs to be parsed like the website url
        if (!empty($cb['address'])) {
            $cb['address'] = trim($cb['address']);
            $cb['address'] = trim($cb['address'], ',');
            $cb['address'] = str_replace(",,", ",", $cb['address']);
            $cb['address'] = trim($cb['address']);
            $lines = explode(',', $cb['address']);
            $line_num = count($lines) - 1;
            if ($line_num >= 4) {
                $cb['address_title'] = $lines[$line_num - 4];
            } else {
                $cb['address_title'] = $cb['borough'] . ' ' . $cb['community_board'];
            }
            if ($cb['address_title'] == $lines[$line_num - 3]) {
                $cb['address_1'] = $lines[$line_num - 2];
                $cb['address_2'] = null;
            } else {
                $cb['address_1'] = $lines[$line_num - 3];
                $cb['address_2'] = $lines[$line_num - 2];
            }
            $zip = trim($lines[$line_num], ', NY ');
            $cb['address_zip'] = $zip;
            $cb['address_city'] = $lines[$line_num - 1];
            $cb['address_state'] = 'NY';
        }
        // check if we have data in the email field that needs to be parsed like the website url
        if (!empty($cb['email'])) {
            $snippet = new simple_html_dom();
            $snippet->load($cb['email']);
            if ($snippet->find('a', 0)) {
                // Isolate the email address from the other html
                if (stripos($cb['email'], '<a') > 0) {
                    $cb['email'] = trim(substr($cb['email'], 0, stripos($cb['email'], '<a')));
                    if (count($emails = explode(',', $cb['email'])) > 1) {
                        $cb['all_email'] = $cb['email'];
                        $cb['email'] = trim($emails[0]);
                        $cb['email'] = trim($cb['email'], '&#160;');
                    }
                } else {
                    $cb['email'] = null;
                    $cb['website'] = null;
                }
                $cb['website'] = $snippet->find('a', 0)->href;
                // External URLs have a proxy URL on nyc.gov, let's parse that off
                if (stripos($cb['website'], 'exit.pl')) {
                    $cb['website'] = substr($cb['website'], stripos($cb['website'], 'exit.pl?') + 12);
                }
            } else {
                $cb['website'] = null;
            }
        } else {
            $cb['email'] = null;
        }
        // Make this field universal, even if we don't have any data
        if (empty($cb['all_email'])) {
            $cb['all_email'] = null;
        }
        // verify we didn't mix up website and email
        if (!empty($cb['website']) && stripos($cb['website'], 'mailto') !== FALSE) {
            $cb['email'] = substr($cb['website'], stripos($cb['website'], 'mailto:') + 7);
            $cb['website'] = null;
        }
        // Be sure to clear any stray commas
        if (!empty($cb['email'])) {
            $cb['email'] = trim($cb['email'], ',');
        }
        // normalize field names
        if (!empty($cb['chairperson'])) {
            $cb['chair'] = $cb['chairperson'];
            unset($cb['chairperson']);
        }
        if ($run_environment == 'dev') {
            $cbs[] = $cb;
        } else {
            scraperwiki::save_sqlite(array('source', 'borough', 'community_board_number'), $cb, $table_name = 'community_board');
        }
        $count++;
        //if ($run_environment == 'dev' && $count > $max_records) break;
        // Clear memory
        $board->__destruct();
    }
    // Clear memory
    $dom->__destruct();
    if ($run_environment == 'dev') {
        return $cbs;
    } else {
        return true;
    }
}
Beispiel #7
0
$total = substr_count ( $HTML, 'class="menu_fix">' );
$atual = 0;

$novoHTML = '';

for($i = 0; $i < $total; $i ++) {
	$pos = strpos ( $HTML, 'class="menu_fix">' );
	$HTML = substr_replace ( $HTML, 'class="menu_fix_' . $i . '">', $pos, 17 );
	$pos = strpos ( $HTML, '</a></td>', $pos );
	$HTML = substr_replace ( $HTML, '</a' . $i . '></td>', $pos, 9 );
}

for($i = 0; $i < $total; $i ++) {
	$s1 = 'class="menu_fix_' . $i . '">';
	$s2 = '</a' . $i . '></td>';
	$dados = get_between ( $HTML, $s1, $s2 );
	
	if (strpos ( $dados, ',' ) > 0) {
		$dados = explode ( ',', $dados );
		$nome = $dados [0];
		$dados = explode ( '&lt;', $dados [1] );
		$sobrenome = $dados [0];
		$email = str_replace ( '&gt;', '', $dados [1] );
	} else if (strpos ( $dados, ',' ) == 0 && strpos ( $dados, '&lt;' ) > 0) {
		
		$sobrenome = '';
		$dados = explode ( '&lt;', $dados );
		$nome = $dados [0];
		$email = str_replace ( '&gt;', '', $dados [1] );
	
	} else {
         $Cadena = $reg[119];
         // Almacenamos el Número de Documento del Usuario
         $CodigoUsuario = $reg[4];
         // Almacenamos en la variable $AfiliadoNoExiste La Cadena que nos indica que el Afiliado no Existe
         $AfiliadoNoExiste = 'El afiliado no existe en la base de datos o sus datos no concuerdan con BDUA';
         // Almacenamos en la variable $AfiliadoValoresDiferentes La Cadena que indica que Los Valores Son Diferentes
         $AfiliadoValoresDiferentes = 'Afiliado con valores en Nombres y/o Apellidos y/o Fecha de nacimiento diferentes a BDUA';
         $pos = strpos($Cadena, $AfiliadoNoExiste);
         $posdos = strpos($Cadena, $AfiliadoValoresDiferentes);
         if ($pos !== false && $posdos !== false) {
             $Bandera = 1;
             // Si Bandera es 1 Se Encontraron Ambas Cadenas
             //"Ambas cadenas Fueron Encontradas";
             $TipoError = 2;
             $Cadena = utf8_encode($Cadena);
             $Cadena = get_between($Cadena, '(', ')');
             $ObjErrores->insertErroresEcoopsos(null, $CodigoUsuario, $CodigoEntidad, $TipoError, $Periodo, $CodigoMunicipio, $IdUsuario, $Cadena);
         } else {
             if ($pos !== false && $posdos === false) {
                 //"Se Econtró la Primera y La Segunda No";
                 $Bandera = 2;
                 // Si Bandera es 2 Se Encontro Una Cadena
                 $TipoError = 1;
                 if ($Bandera === 2 && $CodigoUsuario != '' && $CodigoEntidad != '') {
                     $ObjErrores->insertErroresEcoopsos(null, $CodigoUsuario, $CodigoEntidad, $TipoError, $Periodo, $CodigoMunicipio, $IdUsuario, $Cadena);
                 }
             }
         }
     }
 }
 fclose($fp);
    curl_setopt_array($ch, array(CURLOPT_URL => $url, CURLOPT_FOLLOWLOCATION => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 15));
    $data = curl_exec($ch);
    curl_close($ch);
    if (!empty($data)) {
        $getVars = get_between($data, '</script><script type="text/javascript">', "</script>");
        $getVars = trim(substr($getVars, 0, -1));
        $getVars = explode(";", $getVars);
        $variables = array();
        foreach ($getVars as $var) {
            $var = explode("=", $var);
            $variables[$var[0]] = $var[1];
        }
        preg_match_all('/onclick="choice\\(\\)" \\/><\\/td>(.*?)<\\/script><\\/td>/si', $data, $getProxies);
        foreach ($getProxies[1] as $proxyRaw) {
            $proxyIP = get_between($proxyRaw, "<td>", "<script type");
            $proxyPort = str_replace("+", "", get_between($proxyRaw, 'document.write(":"+', ")"));
            $proxyPort = strtr($proxyPort, $variables);
            $proxies[] = $proxyIP . ":" . $proxyPort;
        }
    }
    _log("Finished scraping proxies on page: " . $page);
    _log("Current total proxy count: " . count($proxies));
}
$saveFile = time() . "_proxies.txt";
file_put_contents($saveFile, implode("\n", $proxies));
_log("Proxies saved to: " . $saveFile);
function get_between($content, $start, $end)
{
    $r = explode($start, $content);
    if (isset($r[1])) {
        $r = explode($end, $r[1]);
            return $substr;
        }
        $fe_map_width = '100%';
        $be_lat = get_between($vm2geo_params, 'default_lat="', '"|default_lng');
        if (!$be_lat) {
            $be_lat = '0';
        }
        $be_lng = get_between($vm2geo_params, 'default_lng="', '"|default_zoom');
        if (!$be_lng) {
            $be_lng = '0';
        }
        $be_zoom = get_between($vm2geo_params, 'default_zoom="', '"|default_maptype');
        if (!$be_zoom) {
            $be_zoom = '1';
        }
        $be_maptype = get_between($vm2geo_params, 'default_maptype="', '"|stylez');
        if (!$be_maptype) {
            $be_maptype = 'ROADMAP';
        }
        $doc->addScript("//maps.googleapis.com/maps/api/js?sensor=true&libraries=places");
        $mapscript = "function add_Event(obj_, evType_, fn_){ \r\r\n\t\t\t\t\t\tif (obj_.addEventListener)\r\r\n\t\t\t\t\t\t\tobj_.addEventListener(evType_, fn_, false); \r\r\n\t\t\t\t\t\telse\r\r\n\t\t\t\t\t\t\tobj_.attachEvent('on'+evType_, fn_); \r\r\n\t\t\t\t\t};\r\r\n\t\t\t\t\tfunction initializemap(){\r\r\n\t\t\t\t\t\tdirectionsDisplay = new google.maps.DirectionsRenderer();\r\r\n\t\t\t\t\t\tvar latlng = new google.maps.LatLng(" . $be_lat . "," . $be_lng . ");\r\r\n\t\t\t\t\t\tvar myOptions = {\r\r\n\t\t\t\t\t\t\tzoom: " . $be_zoom . ",\r\r\n\t\t\t\t\t\t\tcenter: latlng,\r\r\n\t\t\t\t\t\t\tmapTypeId: google.maps.MapTypeId." . $be_maptype . ",\r\r\n\t\t\t\t\t\t\tscrollwheel: false,\r\r\n\t\t\t\t\t\t\tnavigationControl: true,\r\r\n\t\t\t\t\t\t\tscaleControl: true,\r\r\n\t\t\t\t\t\t\tmapTypeControl: true,\r\r\n\t\t\t\t\t\t\toverviewMapControl:true,\r\r\n\t\t\t\t\t\t\tstreetViewControl: true\r\r\n\t\t\t\t\t\t}\r\r\n\t\t\t\t\t\tvar map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);\t\t\t\t\t\r\r\n\t\t\t\t\t\tvar input = document.getElementById('searchTextField');\r\r\n\t\t\t\t\t\tvar autocomplete = new google.maps.places.Autocomplete(input);\r\r\n\t\t\t\t\t\t\tautocomplete.bindTo('bounds', map);\r\r\n\t\t\t\t\t\t\tvar place_infowindow = new google.maps.InfoWindow();\r\r\n\t\t\t\t\t\t\tvar place_marker = new google.maps.Marker({\r\r\n\t\t\t\t\t\t\t map: map\r\r\n\t\t\t\t\t\t\t});\r\r\n\t\t\t\t\t\t\tgoogle.maps.event.addListener(autocomplete, 'place_changed', function() {\r\r\n\t\t\t\t\t\t\t  place_infowindow.close();\r\r\n\t\t\t\t\t\t\t var place = autocomplete.getPlace();\r\r\n\t\t\t\t\t\t\t if (place.geometry.viewport) {\r\r\n\t\t\t\t\t\t\t\tmap.fitBounds(place.geometry.viewport);\r\r\n\t\t\t\t\t\t\t } else {\r\r\n\t\t\t\t\t\t\t\tmap.setCenter(place.geometry.location);\r\r\n\t\t\t\t\t\t\t\tmap.setZoom(17); // Why 17? Because it looks good.\r\r\n\t\t\t\t\t\t\t }\t\t\t\t\r\r\n\t\t\t\t\t\t\t \r\r\n\t\t\t\t\t\t\t});\r\r\n\t\t\t\t\t\t\tvar marker = new google.maps.Marker({\t\t\t\t\t\t\r\r\n\t\t\t\t\t\t\t\tmap: map,\r\r\n\t\t\t\t\t\t\t\tclickable: false,\t\t\t\t\t\r\r\n\t\t\t\t\t\t\t\ttitle:'" . JText::_('VMCUSTOM_VM2GEOLOCATOR_PRODUCTLOCATION') . "'\r\r\n\t\t\t\t\t\t\t});\r\r\n\t\t\t\t\t\t\tgoogle.maps.event.addListener(map, 'click', function(event) {\r\r\n\t\t\t\t\t\t\t\tplace_infowindow.close();\r\r\n\t\t\t\t\t\t\t\tvar PointTmp2 = event.latLng;\r\r\n\t\t\t\t\t\t\t\tmarker.setPosition(PointTmp2);\r\r\n\t\t\t\t\t\t\t\tdocument.getElementById('latitude').value = PointTmp2.lat();\r\r\n\t\t\t\t\t\t\t\tdocument.getElementById('longitude').value = PointTmp2.lng();\r\r\n\t\t\t\t\t\t\t\tdocument.getElementById('latitude').style.backgroundColor = '';\r\r\n\t\t\t\t\t\t\t\tdocument.getElementById('longitude').style.backgroundColor = '';\r\r\n\t\t\t\t\t\t\t});\t\r\r\n\t\t\t\t\t\t\tgoogle.maps.event.addListener(map, 'zoom_changed', function(event) {\r\r\n\t\t\t\t\t\t  \tdocument.getElementById('zoom').value = map.getZoom();\r\r\n\t\t\t\t\t\t \t});\r\r\n\t\t\t\t\t\t\tgoogle.maps.event.addListener(map, 'maptypeid_changed', function(event) {\r\r\n\t\t\t\t\t\t\t\tvar mapTypeID = map.getMapTypeId();\r\r\n\t\t\t\t\t\t\t\tdocument.getElementById('maptype').value = mapTypeID.toUpperCase();\r\r\n\t\t\t\t\t\t \t});\r\r\n\t\t\t\t\t}\r\r\n\t\t\t\t\t\tfunction initgmap() {\r\r\n   \t\t\t\t\t//if (arguments.callee.done) GUnload();\r\r\n\t\t\t\t\t\tdocument.getElementById('latitude').value ='';\r\r\n\t\t\t\t\t\tdocument.getElementById('longitude').value ='';\r\r\n\t\t\t\t\t\t\targuments.callee.done = true;\r\r\n\t\t\t\t\t\t\tinitializemap();\r\r\n\t\t\t\t\t\t};\r\r\n\t\t\t\t\t\tadd_Event(window, 'load', initgmap);";
        $doc->addScriptDeclaration($mapscript);
        echo '<div id="map_canvas" style="height:300px;">#dev<div>
				<div style="clear:both;position:absolute;"></div>';
        echo '</dd>';
        //echo '<tr class="geolocator" style="background-color:#f7f7f7;">';
        echo '<div class="form-inline">';
        echo '<div style="padding-bottom:3px;"><input id="searchTextField" type="text" size="50" placeholder="' . JText::_('COM_VMVENDOR_VMVENADD_FORM_PLACE_SEARCH') . '" class="form-control "></div>';
        echo '<div class=" form-group col-lg-3">
			<label class="sr-only" for="latitude">latitude</label>
			<input title="' . JText::_('COM_VMVENDOR_VMVENADD_FORM_LAT') . '" type="text" value="" size="10" name="latitude" id="latitude" class="form-control" readonly> </div>';
function get_council_twitter($url)
{
    global $run_environment;
    global $max_records;
    $html = scraperWiki::scrape($url);
    $dom = new simple_html_dom();
    $dom->load($html);
    // See if we can get the cursor for the next page of html
    $cursor = $dom->find("div[class=stream-container]", 0)->outertext;
    $cursor = get_between($cursor, 'class="stream-container "', '<div class="stream list-stream">');
    $cursor = substr($cursor, strpos($cursor, 'data-cursor="') + 13);
    $cursor = substr($cursor, 0, strpos($cursor, '"'));
    $next_page = "https://twitter.com/NYCCouncil/nyccouncilmembers/members/timeline?cursor={$cursor}&include_available_features=1&include_entities=1&is_forward=true";
    $next_page = scraperWiki::scrape($next_page);
    $next_page = json_decode($next_page, true);
    //$next_page = curl_to_json($next_page);
    // Get the first page of html
    $content = $dom->find("ol[id=stream-items-id]", 0);
    // Combine it with the second page
    $content = $content->innertext . $next_page["items_html"];
    $dom = new simple_html_dom();
    $dom->load($content);
    $count = 1;
    foreach ($dom->find("li") as $row) {
        $councilmember['name'] = $row->find("div[class=stream-item-header]", 0)->find("strong[class=fullname]", 0)->plaintext;
        $councilmember['username'] = $row->find("div[class=stream-item-header]", 0)->find("span[class=username]", 0)->plaintext;
        $council[] = $councilmember;
        $count++;
    }
    return $council;
}
             $moznosti[$xxx] = traducirHTML($moznosti[$xxx]);
             $moznostix = explode("|", $moznosti[$xxx]);
             //print $moznostix[2] . "\n";
             $ulozm[$f] = $moznosti[$xxx];
             $f++;
         }
     }
 }
 //postual end
 $a = "// Combinations";
 $b = "// Colors";
 $go = get_between($html, $a, $b);
 $gox = explode(";", $go);
 $nr = count(explode(";", $go));
 for ($gox_pom = 0; $gox_pom < $nr - 1; $gox_pom++) {
     $medzikus = get_between($gox[$gox_pom], "('", "')") . "|" . get_between2($gox[$gox_pom], "'), 1, ", ",");
     $medzikus = str_replace("'", "", $medzikus);
     //print $nr ."\n";
     $medzikus = explode("|", $medzikus);
     $cena_zaklad = str_replace(",", ".", $cena_zaklad);
     $cena = $cena_zaklad + $medzikus[1];
     $cena = number_format($cena, 2, ',', '');
     //zaciatok if
     for ($d = 0; $d < $f; $d++) {
         $moznostix = explode("|", $ulozm[$d]);
         $medzifinal = explode(",", $medzikus[0]);
         if ($medzifinal[0] == $moznostix[0]) {
             $prvy = str_replace($moznostix[0], $moznostix[1], $medzifinal[0]);
             $zhoda1 = $moznostix[2];
         }
         if ($medzifinal[1] == $moznostix[0]) {
            if (strpos($summary, ' to ') > 0) {
                $summary = substr($summary, 0, strpos($summary, ' to '));
            }
            // At this oint it should be ddd mmm, yyyy
            $epochtime = strtotime($summary);
            $printtime = date("M j Y", $epochtime);
            $summary = $printtime;
            if ($epochtime > $today) {
                $event[$epochtime][] = array('title' => $title, 'date' => $summary, 'link' => $link);
            }
        }
        // Handle recurring events
        if (preg_match('/First start:/', $summary)) {
            $summary = preg_replace('/Recurring Event\\| /', '', $summary);
            $summary = preg_replace('/ Duration: 86400 \\|/', '', $summary);
            $summary = get_between($summary, 'First start:', '|');
            $summary = preg_replace('/[CST|CDT]/', '', $summary);
            $summary = trim($summary);
            // At this point it should be yyyy-mm-dd
            $epochtime = strtotime($summary);
            $printtime = date("M j Y", $epochtime);
            $summary = $printtime;
            if ($epochtime > $today) {
                $event[$epochtime][] = array('title' => $title, 'date' => $summary, 'link' => $link);
            }
        }
    }
}
ksort($event);
echo '<ul class="unList">' . "\n";
foreach ($event as $k => $v) {
Beispiel #14
0
            $arr[] = $ul;
        }
    }
}
//print_r($arr);
if (count($arr) != 0) {
    // print_r ($arr);
    $resultt = multihttpget($arr);
    //file_put_contents("loc.htm",$resultt[0]);
    $imgs = array('<img src="/common_files/images/address.jpg" width="22" height="18">', '<img src="/common_files/images/person.jpg" width="17" height="25">', '<img src="/common_files/images/mobile.jpg" width="14" height="22">', '<img src="/common_files/images/phone.jpg" width="20" height="14">', 'N/A', 'Get Mobile', 'X Close', 'Save To Mobile | Rate it', 'Rate it');
    $start = '<table width="100%" border="0" align="right" cellpadding="0" cellspacing="0">';
    $end = '<img src="/common_files/images/fax.jpg" width="21" height="18">';
    $re = array();
    foreach ($resultt as $result) {
        $temp = get_between($result, $start, $end);
        $tem = get_between($temp, '<script type="text/javascript">', '</script>');
        $temp = str_ireplace($tem, "", $temp);
        $r = '<img src="/common_files/images/phone.jpg" width="20" height="14">';
        $temp = str_ireplace($r, "`", $temp);
        $temp = strip_tags($temp);
        $temp = str_ireplace("&nbsp;", " ", $temp);
        foreach ($imgs as $pk) {
            $temp = str_ireplace($pk, "\n", $temp);
        }
        while (stripos($temp, "\t") !== false) {
            $temp = str_replace("\t", "", $temp);
        }
        $temp = str_replace("\r\n", "", $temp);
        while (stripos($temp, "  ") !== false) {
            $temp = str_replace("  ", "", $temp);
        }