function retorne_dados_gerais_site($codigo_html_site, $endereco_url_site) { // tipos de retorno -------------------------------------------------------------------- // title // keywords // description // ---------------------------------------------------------------------------------------------- // meta tags do site -------------------------------------------------------- $meta_tags = get_meta_tags($endereco_url_site); // meta tags do site // -------------------------------------------------------------------------------- // codigo html de pagina ------------------------------------------------ $pagina = $codigo_html_site; // codigo html de pagina // -------------------------------------------------------------------------------- // incio de titulo ------------------------------------------------------------ $titulo_inicio = strpos($pagina, '<title>') + 7; // incio de titulo // -------------------------------------------------------------------------------- // tamanho de titulo -------------------------------------------------------- $tamanho_titulo = strpos($pagina, '</title>') - $titulo_inicio; // tamanho de titulo // -------------------------------------------------------------------------------- // obtem titulo completo -------------------------------------------------- $meta_tags['title'] = substr($pagina, $titulo_inicio, $tamanho_titulo); // obtem titulo completo // -------------------------------------------------------------------------------- // retorno ---------------------------------------------------------------------- return $meta_tags; // retorno // -------------------------------------------------------------------------------- }
function spiderurl($option) { global $database; $url = JRequest::getVar('url', ''); $start = JRequest::getVar('start', 0); $error = 0; if (substr($url, 0, 7) != "http://") { $url = "http://" . $url; } if (empty($url) || $start) { echo "jQuery('#spiderwebsite').html('<img src=\"../components/com_mtree/img/exclamation.png\" style=\"position:relative;top:3px\" /> " . JText::_('Unable to get metatags') . "')"; } else { if (ini_get('allow_url_fopen')) { $metatags = get_meta_tags($url) or $error = 1; } else { $error = 1; } if (!$error) { if (!empty($metatags['keywords'])) { echo "document.getElementById('publishingmetakey').value='" . htmlspecialchars($metatags['keywords'], ENT_QUOTES) . "'; \n"; } if (!empty($metatags['description'])) { echo "document.getElementById('publishingmetadesc').value='" . htmlspecialchars($metatags['description'], ENT_QUOTES) . "';"; } echo "jQuery('#spiderwebsite').html('<img src=\"../components/com_mtree/img/accept.png\" style=\"position:relative;top:3px\" /> " . JText::_('Spider has been updated') . "')"; } else { echo "jQuery('#spiderwebsite').html('<img src=\"../components/com_mtree/img/exclamation.png\" style=\"position:relative;top:3px\" /> " . JText::_('Unable to get metatags') . "')"; } } }
private function themeforest($feeds) { include './includes/simple_html_dom.php'; foreach ($feeds as $feed) { echo '<pre>'; print_r($feed); echo '</pre>'; $html = file_get_html($feed['feed_url']); foreach ($html->find('.item-list', 0)->children() as $entry) { $title = trim($entry->find('h3', 0)->plaintext); $url = 'http://themeforest.net' . $entry->find('h3', 0)->find('a', 0)->href . '?ref=theme-hub'; $website_id = $feed['website_id']; $category_id = $feed['category_id']; $thumbnail = $entry->find('.item-thumbnail__image', 0)->find('img', 0)->src; $tags = get_meta_tags($url); $description = htmlentities(trim($tags['description'])); $price = filter_var($entry->find('.price', 0)->plaintext, FILTER_SANITIZE_NUMBER_INT); echo $title; echo '<br>' . $url; echo '<br>' . $thumbnail; echo '<br>' . $description; echo '<br>' . $price; $theme_id = $this->model->add_theme($title, $website_id, $category_id, $url, $description, $price); if (is_numeric($theme_id)) { copy($thumbnail, '/var/www/themehub/assets/img/thumbnails/theme' . $theme_id . '.jpg'); echo 'theme added successfully'; } else { echo 'error'; } echo '<hr>'; } } }
/** * getDateFormat gets the date format stored in the databank * if unsuccesful, it will get the default from the defaults.ini * param $link = receives the link created by the db connection routine * param $DBLink_OK = receives the tag created by the db connection routine * return = the date format */ function getDateFormat() { global $root_path, $db, $dblink_ok; $errFormat = 0; /* If no link to db, make own link*/ if (!isset($db) || !$db) { include_once $root_path . 'include/inc_db_makelink.php'; } if ($dblink_ok) { $sql = "SELECT value AS date_format FROM care_config_global WHERE type='date_format'"; if ($result = $db->Execute($sql)) { if ($result->RecordCount()) { $df = $result->FetchRow(); return $df['date_format']; } else { $errFormat = 1; } } else { $errFormat = 1; } } else { $errFormat = 1; } if ($errFormat) { $df = get_meta_tags($root_path . 'global_conf/format_date_default.pid'); if ($df['date_format'] != '') { return $df['date_format']; } else { return 'dd.MM.yyyy'; } // this is the last alternative format (german traditional) } }
function parsePage() { $tags = get_meta_tags($this->page); $this->description = $tags['page-description']; $this->image = $tags['page-image']; $this->title = $tags['page-title']; }
public function getMetaData($uri) { $validator = new \Zend\Validator\Uri(array('allowRelative' => false)); if ($validator->isValid($uri)) { $return = array('title' => $uri, 'description' => ''); $metaData = array_merge(array(), get_meta_tags($uri)); if (!key_exists('title', $metaData)) { $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $uri); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $data = curl_exec($ch); curl_close($ch); $doc = new \DOMDocument(); @$doc->loadHTML($data); $nodes = $doc->getElementsByTagName('title'); if (isset($nodes->item(0)->nodeValue)) { $metaData['title'] = $nodes->item(0)->nodeValue; } } return array_merge($return, $metaData); } else { return false; } }
/** * gets the meta data from a website */ function fetchMeta($url = '') { if (!$url) { return false; } // check whether we have http at the zero position of the string if (strpos($url, 'http://') !== 0 && strpos($url, 'https://') !== 0) { $url = 'http://' . $url; } $fp = @fopen($url, 'r'); if (!$fp) { return false; } $content = ''; while (!feof($fp)) { $buffer = trim(fgets($fp, 4096)); $content .= $buffer; } $start = '<title>'; $end = '<\\/title>'; preg_match("/{$start}(.*){$end}/s", $content, $match); $title = isset($match) ? $match[1] : ''; $metatagarray = get_meta_tags($url); $keywords = isset($metatagarray["keywords"]) ? $metatagarray["keywords"] : ''; $description = isset($metatagarray["description"]) ? $metatagarray["description"] : ''; return array('title' => $title, 'keywords' => $keywords, 'description' => $description); }
function kda($url, &$total, $use_meta_tags, $use_partial_total) { if (!stristr($url, 'http://')) { $url = 'http://' . $url; } if ($html = @file_get_contents($url)) { $html = html_entity_decode(file_get_contents($url)); //preg_match('/(?<=<title>).*?(?=<\\/title>)/is', $html, $matches); //$title = array_shift($matches); $meta_tags = $use_meta_tags ? get_meta_tags($url) : ''; $html = kda_strip_tag_script($html); $no_html = strip_tags($html); $tag_info = $meta_tags['description'] . " " . $meta_tags['keywords']; $text .= $tag_info . " " . $no_html; $total = count(explode(' ', $text)); $text = kda_clean(kda_stopWords($text)); $words = explode(' ', $text); $total = count($words); for ($x = 0; $x < $total; $x++) { $words[$x] = trim($words[$x]); if ($words[$x] != '') { $ws[$words[$x]]++; if (trim($words[$x + 1]) != '') { $phrase2 = $words[$x] . " " . trim($words[$x + 1]); $ws[$phrase2]++; if (trim($words[$x + 2]) != '') { $phrase3 = $words[$x] . " " . trim($words[$x + 1]) . " " . trim($words[$x + 2]); $ws[$phrase3]++; } } } } foreach ($ws as $word => $count) { if ($count > 1 and strlen($word) > 2) { $phrase_size = count(explode(' ', $word)); $occurances[$phrase_size] = $occurances[$phrase_size] + $count; } } foreach ($ws as $word => $count) { if ($count > 1 and strlen($word) > 2) { $phrase_size = count(explode(' ', $word)); $ttlWords = $use_partial_total ? $occurances[$phrase_size] : $total; $density = round($count / $ttlWords * 100, 2); $dens[$phrase_size][$word] = $density; $dens[$word] = $count; } } arsort($dens[1]); if ($dens[2]) { arsort($dens[2]); } if ($dens[3]) { arsort($dens[3]); } return $dens; } else { return false; } }
/** * Use PHP to check for robots meta tag * NOTE this doesn't work locally (dev mode) */ public function getRobotsMetaTag() { if (!Director::isDev()) { $metatags = get_meta_tags(Director::absoluteBaseURL()); $robots = empty($metatags['robots']) ? false : true; } return false; }
public static function getMeta($attr = null) { if ($attr) { $meta = get_meta_tags(self::$url); return isset($meta[$attr]) ? $meta[$attr] : 'No meta found'; } return get_meta_tags(self::$url); }
/** * Function to Check the current View Port Tag on the site * * @return string * @added 2.0 */ static function checkViewPortTag($url) { if ($metaTags = @get_meta_tags($url)) { if (isset($metaTags['viewport'])) { return $metaTags['viewport']; } else { return false; } } return false; }
function meta($url) { //metaタグ調査 $tags = get_meta_tags($url); mb_language('japanese'); $keywords = mb_convert_encoding($tags['keywords'], "UTF-8", "auto"); $viewport = mb_convert_encoding($tags['viewport'], "UTF-8", "auto"); $description = mb_convert_encoding($tags['description'], "UTF-8", "auto"); $twitter = mb_convert_encoding($tags['twitter:card'], "UTF-8", "auto"); $meta = array($keywords, $viewport, $description, $twitter); return $meta; }
function get_meta_description($file) { $tab_metas = get_meta_tags($file); if (isset($tab_metas['description'])) { if ($tab_metas['description'] != null) { return $tab_metas['description']; } else { return ''; } } else { return ''; } }
public function getuserLocation() { $ip = ""; //Retrieving user ip $client = @$_SERVER['HTTP_CLIENT_IP']; $forward = @$_SERVER['HTTP_X_FORWARDED_FOR']; $remote = $_SERVER['REMOTE_ADDR']; if (filter_var($client, FILTER_VALIDATE_IP)) { $ip = $client; } elseif (filter_var($forward, FILTER_VALIDATE_IP)) { $ip = $forward; } else { $ip = $remote; } //$tags = $this->getLocationByIp($ip); $tags = get_meta_tags('http://www.geobytes.com/IpLocator.htm?GetLocation&template=php3.txt&IpAddress=' . $ip); $location = new Location(); $city_id = ""; //getting the values from the tags $location->setCountryName($tags['country']); $location->setProvinceName($tags['region']); $location->setCityName($tags['city']); //passing the values to the variables $countryname = $location->getCountryName(); $provincename = $location->getProvinceName(); $cityname = $location->getCityName(); //Finding if the countries, and cities already exist $country_res = $this->getCountryByName($countryname); $province_res = $this->getProvinceByName($provincename); $city_res = $this->getCityByName($cityname); //If the information is not in the databse, then add it if ($country_res->getCountryName() == "" && $province_res->getProvinceName() == "" && $city_res->getCityName() == "") { $city_id = $this->addLocation($location); echo "All Empty Result"; } else { if ($country_res->getCountryName() != "" && $province_res->getProvinceName() == "" && $city_res->getCityName() == "") { $provinceid = addProvince($provincename, $country_res->getCountryId()); addCity($cityname, $provinceid); } else { if ($country_res->getCountryName() != "" && $province_res->getProvinceName() != "" && $city_res->getCityName() == "") { $provinceid = addProvince($provincename, $country_res->getCountryId()); $city_id = addCity($cityname); } else { $cityres = $this->getCityByName($cityname); $city_id = $cityres->getCityId(); } } } //Return city Id at the end return $city_id; }
function youtube($videourl) { $ret = array(); $video = explode("=", $videourl); $video = $video[1]; $video = explode("&", $video); $video = $video[0]; $video = str_replace("?v=", null, $video); $ret['code'] = '<object width="320" height="180"><param name="movie" value="http://www.youtube.com/v/' . $video . '&hl=pt_BR&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/' . $video . '&hl=pt_BR&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="320" height="180"></embed></object>'; $meta = get_meta_tags($videourl); $ret['title'] = protect($meta['title']); $ret['desc'] = protect($meta['description']); return $ret; }
function search_unique($search_array) { // returns only unique matches and requests file info into array global $GLOBAL; $result_array = array(); $title_array = array(); foreach ($search_array as $file_array) { $result_meta = get_meta_tags($file_array[0]); if (!in_array($result_meta['search'], $title_array)) { $result_array[] = array("title" => $result_meta['search'], "adress" => $result_meta['file'], "file" => str_replace($_SERVER['DOCUMENT_ROOT'], "http://" . $_SERVER['HTTP_HOST'], array_shift($file_array)), "keywords" => array_slice($file_array, 0, min(5, count($file_array)))); $title_array[] = $result_meta['search']; } } return $result_array; }
/** * @see AbstractLocator::process() */ protected function process() { $uri = ($this->ssl ? 'https://' : 'http://') . 'www.geobytes.com/IpLocator.htm?GetLocation&'; $query = array('template' => 'php3.txt', 'IpAddress' => $this->ip); if ($this->email && $this->password) { $query = array_merge($query, array('pt_email' => $this->email, 'pt_password' => $this->password)); } $response = get_meta_tags($uri . http_build_query($query)); if ('Limit Exceeded' == $response['locationcode']) { throw new \Exception('Limit exceeded'); } $location = new Location(); $location->setServiceResponse($response)->setCountryCode($response['iso2'])->setCountryName($response['country'])->setCityName($response['region'])->setLatitude($response['latitude'])->setLongitude($response['longitude']); $this->setLocation($location); }
public function __construct($details = []) { $this->errorState = false; $this->values = $details; // fill in extra details $tags = get_meta_tags("https://www.youtube.com/watch?v=" . $this->values['url']); if (empty($tags)) { $this->errorState = true; } else { // Pull some data from the tags $this->values['title'] = $tags['title']; $this->values['embed'] = $tags['twitter:player']; } $this->values['tags'] = $tags; }
/** * Get social networks likes/followers count * @Get("/social") */ public function socialAction() { $this->view->disable(); // Facebook likes $fb = file_get_contents("https://graph.facebook.com/{$this->config->facebook->id}?access_token={$this->config->facebook->appid}|{$this->config->facebook->appsecret}&fields=likes"); // Pinterest followers $pinterest = get_meta_tags('https://www.pinterest.com/made_heart/'); // Google+ followers $ch = curl_init(); curl_setopt_array($ch, [CURLOPT_URL => "https://www.googleapis.com/plus/v1/people/{$this->config->googleplus->id}?key={$this->config->googleplus->key}", CURLOPT_REFERER => "http://www.madeheart.com", CURLOPT_RETURNTRANSFER => true]); $googleplus = curl_exec($ch); curl_close($ch); $social = ['facebook' => (int) json_decode($fb)->likes, 'pinterest' => (int) $pinterest['pinterestapp:followers'], 'googleplus' => (int) json_decode($googleplus)->circledByCount]; echo json_encode($social); }
function synchronize() { global $db; $config = $db->Execute('TRUNCATE ' . TABLE_PHREEHELP); // recursively read file and store in db $extensions = explode(',', VALID_EXTENSIONS); $file_list = array(); $modules = scandir(DIR_FS_MODULES); foreach ($modules as $module) { if ($module != '.' && $module != '..') { if (file_exists(DIR_WS_MODULES . $module . '/language/' . $_SESSION['language'] . '/manual')) { $file_list = array_merge($file_list, directory_to_array(DIR_WS_MODULES . $module . '/language/' . $_SESSION['language'] . '/manual', $extensions)); } elseif (file_exists(DIR_WS_MODULES . $module . '/language/en_us/manual')) { $file_list = array_merge($file_list, directory_to_array(DIR_WS_MODULES . $module . '/language/en_us/manual', $extensions)); } } } $toc = array(); foreach ($file_list as $file_name) { $file_name = str_replace(DOC_REL_PATH, DOC_ROOT_URL, $file_name); // convert to url to read script generated filenames $tags = get_meta_tags($file_name); $doc_html = file_get_contents($file_name); preg_match('/<title>([^>]*)<\\/title>/si', $doc_html, $match); $doc_title = isset($match) && is_array($match) && count($match) > 0 ? strip_tags($match[1]) : TEXT_NO_TITLE; $doc_text = trim(strip_tags($doc_html)); $doc_text = str_replace(chr(10), ' ', $doc_text); // process out special characters $sql = "insert into " . TABLE_PHREEHELP . " (doc_url, doc_pos, doc_index, doc_title, doc_text)\n\t values ('" . $file_name . "', '" . $tags['doc_pos'] . "', '" . $tags['doc_index_1'] . "', '" . $doc_title . "', '" . addslashes($doc_text) . "')"; $row = $db->Execute($sql); $id = db_insert_id(); $toc[$id] = $tags['doc_pos']; } foreach ($toc as $id => $value) { if (strrpos($value, '.') === false) { $parent = '0'; } else { $parent = substr($value, 0, strrpos($value, '.')); $key = array_search($parent, $toc); if ($key !== false) { // if no parent found, default to root $db->Execute("update " . TABLE_PHREEHELP . " set parent_id = " . $key . " where id = " . $id); $db->Execute("update " . TABLE_PHREEHELP . " set doc_type = '0' where id = " . $key); // set parent to type folder } } } }
public function getMetas($url) { $content = fgc($url); if ($content) { $array = array('title' => '', 'description' => ''); $pattern = "|<[\\s]*title[\\s]*>([^<]+)<[\\s]*/[\\s]*title[\\s]*>|Ui"; if (preg_match($pattern, $content, $match)) { $array['title'] = $match[1]; } $data = get_meta_tags($url); unset($content); unset($match); return $data + $array; } return null; }
/** * Request user validation email. * Send email out to the address and request a confirmation. * * @param int $user_guid The user's GUID * @param bool $admin_requested Was it requested by admin * @return mixed */ function uservalidationbyadmin_request_validation($user_guid, $admin_requested = FALSE) { $site = elgg_get_site_entity(); $user_guid = (int) $user_guid; $user = get_entity($user_guid); /* if (($user) && ($user instanceof ElggUser)) { // Work out validate link $code = uservalidationbyadmin_generate_code($user_guid, $user->email); $link = "{$site->url}uservalidationbyadmin/confirm?u=$user_guid&c=$code"; // Send validation email $subject = elgg_echo('email:validate:subject', array($user->name, $site->name)); $body = elgg_echo('email:validate:body', array($user->name, $site->name, $link, $site->name, $site->url)); $result = notify_user($user->guid, $site->guid, $subject, $body, NULL, 'email'); if ($result && !$admin_requested) { system_message(elgg_echo('uservalidationbyadmin:registerok')); } return $result; } */ //notify admin if ($user && $user instanceof ElggUser) { $admin = get_admin_user_details(); // Work out validate link $code = uservalidationbyadmin_generate_code($user_guid, $user->email); $link = "{$site->url}uservalidationbyadmin/confirm?u={$user_guid}&c={$code}"; // IP detection $ip_address = $_SERVER['REMOTE_ADDR']; $geoloc = "https://secure.geobytes.com/IpLocator.htm?GetLocation&template=php3.txt&IpAddress=" . $ip_address; $geotags = get_meta_tags($geoloc); $geocountry = $geotags['country']; $georegion = $geotags['region']; $geocity = $geotags['city']; $geocertainty = $geotags['certainty']; $geostring = $ip_address . " ; " . $geocountry . " ; " . $georegion . " ; " . $geocity . " ; " . $geocertainty; // Send validation email $subject = elgg_echo('email:validate:subject', array($user->name, $site->name)); $body = elgg_echo('email:validate:body', array($admin->name, $user->name, $ip_address, $geostring, $link, $site->name, $site->url)); $result = notify_user($admin->guid, $site->guid, $subject, $body, NULL, 'email'); if ($result && !$admin_requested) { system_message(elgg_echo('uservalidationbyadmin:registerok')); } return $result; } return FALSE; }
public function up_photo() { $url = $_REQUEST['url']; $string = $this->fetch_record($url); /// fecth title $title_regex = "/<title>(.+)<\\/title>/i"; preg_match_all($title_regex, $string, $title, PREG_PATTERN_ORDER); $url_title = $title[1]; /// fecth decription $tags = get_meta_tags($url); // fetch images $image_regex = '/<img[^>]*' . 'src=[\\"|\'](.*)[\\"|\']/Ui'; preg_match_all($image_regex, $string, $img, PREG_PATTERN_ORDER); $images_array = $img[1]; $im = "<img src='" . @$images_array[1] . "' width='100'>"; $data = array('title' => $url_title[0], 'url' => substr($url, 0, 35), 'desc' => $tags['description'], 'img' => $im); echo json_encode($data); }
function fetchNewsFromurl() { $this->autoRender = false; if (!empty($this->data)) { $titleFound = false; $bandNews = $this->BandNews->create(); $newsURL = $this->data['newsurl']; $pageContent = file_get_contents($newsURL); $titles = array(); $pattern = '|<title>(.*?)</title>|si'; preg_match_all($pattern, $pageContent, $titles); foreach ($titles as $title) { foreach ($title as $match) { $match = strip_tags($match); //$match = str_replace('<title>', '', $match); //$match = str_replace('</title>', '', $match); $bandNews['BandNews']['title'] = $match; $titleFound = true; break 2; } } $tags = get_meta_tags($newsURL); if (array_key_exists('description', $tags)) { $description = $tags['description']; $bandNews['BandNews']['description'] = $description; } else { $pattern = '|<p[^<][^a][^A][^r][^R]*?>(.*?)</p>|si'; preg_match_all($pattern, $pageContent, $descriptions); foreach ($descriptions as $desc) { foreach ($desc as $description) { $description = strip_tags($description); $bandNews['BandNews']['description'] = $description; break 2; } } } if (!$titleFound && empty($description)) { $bandNews['BandNews']['returnCode'] = '1'; $bandNews['BandNews']['errorMsg'] = 'Description not found.'; } } return json_encode($bandNews); }
function getDescription($url) { $description = ''; // Gets all meta tags from site. // $tags['author']; // $tags['keywords']; // $tags['description']; // $tags['title']; // $tags['geo_position']; try { $tags = get_meta_tags($url); } catch (ErrorException $e) { } // At this version we only need description. if (isset($tags['description'])) { $description = $tags['description']; } return $description; }
function get_site_meta_tags($url) { $site_title = array(); $fp = @file_get_contents($url); if ($fp) { $res = preg_match("/<title>(.*)<\\/title>/siU", $fp, $title_matches); if ($res) { $site_title = preg_replace('/\\s+/', ' ', $title_matches[1]); $site_title = trim($site_title); } $site_meta_tags = get_meta_tags($url); $site_meta_tags['title'] = $site_title; foreach ($site_meta_tags as $key => $value) { if (!isUTF8($value)) { $site_meta_tags[$key] = utf8_encode($value); } } } return $site_meta_tags; }
public function generate($longUrl) { // Create crawler $client = new Client(); $crawler = $client->request('GET', $longUrl); // Initialisation $this->setLink(' ' . $this->bitlyShorter->short($longUrl)); $recognized = false; // Checking for nodes website list recognized $host = parse_url($longUrl, PHP_URL_HOST); if (isset($this->websites[$host])) { $nodes = $this->websites[$host]; $recognized = true; } // If website is recognized getting title and tags if ($recognized) { if (isset($nodes['title_node']) && $nodes['title_node'] && $crawler->filter($nodes['title_node'])->count()) { // If h1 node exist and not empty we use it $this->setTitle($crawler->filter($nodes['title_node'])->text()); } if (isset($nodes['hashtags_node']) && $nodes['hashtags_node'] && $crawler->filter($nodes['hashtags_node'])->count()) { // If hashtags node exist and not empty we use it $this->setHashtags($this->getHashtagsByNodes($crawler, $nodes)); } } else { // if website not recognized getting hashtags from meta keywords if exist $this->setHashtags($this->getHashtagsByKeywords(get_meta_tags($longUrl))); } // If still no hashtags we use fallback if (empty($this->getHashtags())) { $this->setHashtags($this->getHashtagFallback($host)); } // If still no title we use fallback if (empty($this->getTitle())) { $this->setTitle($this->getTitleFallback($crawler)); } $this->setContent($this->getTitle() . $this->getLink() . $this->getHashtags()); return $this; }
function synchronize($file_version) { global $db; // Clean the databases $config = $db->Execute('delete from ' . DB_PREFIX . 'zh_search'); $config = $db->Execute('delete from ' . DB_PREFIX . 'zh_index'); $config = $db->Execute('delete from ' . DB_PREFIX . 'zh_glossary'); // recursively read file and store in db $extensions = explode(',', VALID_EXTENSIONS); $file_list = directory_to_array(DOC_REL_PATH, $extensions); foreach ($file_list as $file_name) { $file_name = str_replace(DOC_REL_PATH, DOC_ROOT_URL, $file_name); // convert to url to read script generated filenames $tags = get_meta_tags($file_name); // error check tags $doc_text = trim(strip_tags(file_get_contents($file_name))); // process out special characters $doc_text = str_replace(chr(10), ' ', $doc_text); // $doc_text = str_replace(chr(13), '', $doc_text); $sql = "insert into " . DB_PREFIX . "zh_search (doc_url, doc_pos, doc_title, doc_text)\r\n\t\t\tvalues ('" . $file_name . "', '" . $tags['doc_pos'] . "', '" . $tags['doc_title'] . "', '" . addslashes($doc_text) . "')"; $row = $db->Execute($sql); // process index $x = 1; while (true) { if (isset($tags['doc_index_' . $x])) { $sql = "insert into " . DB_PREFIX . "zh_index (doc_url, doc_index) \r\n\t\t\t\t\tvalues ('" . $file_name . "', '" . $tags['doc_index_' . $x] . "')"; $row = $db->Execute($sql); } else { break; } $x++; } // process glossary } // Build glossary // add glossary processing // update db version field to newly loaded version $success = $db->Execute("update " . DB_PREFIX . "zh_config set db_version = '" . $file_version . "'"); }
function GetAllH($path, $db) { $CurrentD = $path; chdir($CurrentD); if (false !== ($handle = opendir($CurrentD))) { while (false !== ($Name = readdir($handle))) { if ($Name != "." && $Name != "..") { if (is_dir($CurrentD . "\\" . $Name)) { $New_dir = $CurrentD . "\\" . $Name; GetAllH($New_dir, $db); } else { $i = strrpos($Name, "."); $extension = strtoupper(substr($Name, $i)); if ($extension == ".HTML" || $extension == ".HTM") { //echo $Name."<br>"; $url = $CurrentD . "\\" . $Name; $id = $db->InsertFilename($Name, $url); WordIntoDB($url, $id, $db); if (-1 == $id) { echo $Name . " exists.<br>"; } else { if ($tags = get_meta_tags($url, false)) { foreach ($tags as $name => $content) { $db->insertMeta($id, $name, $content); } echo $Name . "'s Metatag information added.<br>"; } else { echo "No metatag information.<br>"; } } } } } } } }
function ipinfo($tpl = null) { $ip = JRequest::getVar('ip', '127.0.0.1'); $ipInfo = get_meta_tags('http://www.geobytes.com/IpLocator.htm?GetLocation&template=php3.txt&IpAddress=' . $ip); $this->assignref('ipInfo', $ipInfo); parent::display($tpl); }