• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_meta_tags函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_meta_tags函数的典型用法代码示例。如果您正苦于以下问题:PHP get_meta_tags函数的具体用法?PHP get_meta_tags怎么用?PHP get_meta_tags使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_meta_tags函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: retorne_dados_gerais_site

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
    // --------------------------------------------------------------------------------
}
开发者ID:GuilhermeFelipe616,项目名称:Altabusca,代码行数:32,代码来源:retorne_dados_gerais_site.php


示例2: spiderurl

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') . "')";
        }
    }
}
开发者ID:rsemedo,项目名称:Apply-Within,代码行数:30,代码来源:admin.mtree.ajax.php


示例3: themeforest

 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>';
         }
     }
 }
开发者ID:kpiontek,项目名称:thSample,代码行数:33,代码来源:crawl.controller.php


示例4: getDateFormat

/**
* 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)
    }
}
开发者ID:tejdeeps,项目名称:tejcs.com,代码行数:40,代码来源:inc_date_format_functions.php


示例5: parsePage

 function parsePage()
 {
     $tags = get_meta_tags($this->page);
     $this->description = $tags['page-description'];
     $this->image = $tags['page-image'];
     $this->title = $tags['page-title'];
 }
开发者ID:nachovz,项目名称:pollbag-1,代码行数:7,代码来源:Sharer.class.php


示例6: getMetaData

 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;
     }
 }
开发者ID:remithomas,项目名称:rt-extends,代码行数:26,代码来源:MetaData.php


示例7: fetchMeta

/**
* 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);
}
开发者ID:hotarucms,项目名称:hotarucms,代码行数:30,代码来源:funcs.http.php


示例8: kda

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;
    }
}
开发者ID:eosc,项目名称:EosC-2.3,代码行数:59,代码来源:seo_density.php


示例9: getRobotsMetaTag

 /**
  * 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;
 }
开发者ID:platocreative,项目名称:silverstripe-healthcheck,代码行数:12,代码来源:HealthCheck_Controller.php


示例10: getMeta

 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);
 }
开发者ID:apprendiendo,项目名称:apprendiendo,代码行数:8,代码来源:Scrap.php


示例11: checkViewPortTag

 /**
  * 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;
 }
开发者ID:Telemedellin,项目名称:empleados,代码行数:17,代码来源:View.php


示例12: meta

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;
}
开发者ID:masaki4680,项目名称:original-web,代码行数:12,代码来源:function.php


示例13: get_meta_description

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 '';
    }
}
开发者ID:babachir,项目名称:Indexation,代码行数:13,代码来源:bibliotheque.inc.php


示例14: getuserLocation

 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;
 }
开发者ID:kevin000,项目名称:Tarboz,代码行数:51,代码来源:LocationDataAccessor.php


示例15: youtube

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 . '&amp;hl=pt_BR&amp;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/' . $video . '&amp;hl=pt_BR&amp;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;
}
开发者ID:jesobreira,项目名称:soclwap,代码行数:14,代码来源:video.php


示例16: search_unique

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;
}
开发者ID:DylanEHolland,项目名称:ZShrine,代码行数:15,代码来源:search.action.php


示例17: process

 /**
  * @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);
 }
开发者ID:eabay,项目名称:yer,代码行数:18,代码来源:GeobytesLocator.php


示例18: __construct

 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;
 }
开发者ID:mwrouse,项目名称:controlthemusic,代码行数:15,代码来源:Song.php


示例19: socialAction

 /**
  * 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);
 }
开发者ID:serge2300,项目名称:madeheart,代码行数:19,代码来源:GeneralController.php


示例20: synchronize

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
            }
        }
    }
}
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:48,代码来源:phreehelp.php



注:本文中的get_meta_tags函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_metadata函数代码示例发布时间:2022-05-15
下一篇:
PHP get_meta_details函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap