Пример #1
0
 public function getParse($type = null, $url_rss, $params = array())
 {
     $trust_link = array('yahoo' => 'http://vn.yahoo.com/?p=us', 'cnn' => 'http://edition.cnn.com/', 'bbc' => 'http://www.bbc.com/');
     $url_arr = parse_url($url_rss);
     $url_rss = htmlspecialchars_decode($url_rss);
     if (isset($url_arr['scheme']) && $url_arr['scheme'] != 'http') {
         $url_rss = str_replace($url_arr['scheme'] . '://', 'http://', $url_rss);
     }
     $data = array();
     $url_log = "";
     $url_log_tmp = "";
     try {
         if (isset($url_arr['scheme'])) {
             $parent_url = $url_arr['scheme'] . '://' . $url_arr['host'] . '/';
             foreach ($trust_link as $key => $url) {
                 if (strpos($parent_url, $key)) {
                     $parent_url = $url;
                     break;
                 }
             }
             $favicon = new favicon($parent_url, 0);
             $fv = $favicon->get_output_data();
             if ($fv == "" || strpos($fv, 'Request')) {
                 // echo 'x';
                 $url_log_tmp = $favicon->get_ico_url();
             }
             $url_log = $fv;
         }
     } catch (Exception $ex) {
         echo $ex->getMessage();
     }
     if ($type == null) {
         require_once $this->_dirFiles . '/Plugins/base.php';
         $rss = new base();
         $data = $rss->getParse($params, $url_rss);
         $data['logo_ico'] = $url_log;
         $data['logo_ico_url'] = $url_log_tmp;
         return $data;
     }
 }
Пример #2
0
 private function get_favicon_url($url)
 {
     $favicon = new favicon($url, 0);
     $favicon_url = get_option('favicon-' . $favicon->get_site_url());
     if ($favicon_url == null) {
         if ($favicon->is_ico_exists()) {
             $favicon_url = $favicon->get_ico_url();
             update_option('favicon-' . $favicon->get_site_url(), $favicon_url);
         }
     }
     return $favicon_url;
 }