コード例 #1
0
ファイル: amber.php プロジェクト: su/amber_wordpress
 public static function extract_links($post_id, $cache_immediately = false)
 {
     $result = array();
     $post = get_post($post_id);
     $text = $post->post_content;
     $re = '/href=["\'](http[^\\v()<>{}\\[\\]"\']+)[\'"]/i';
     $count = preg_match_all($re, $text, $matches);
     $links = Amber::filter_regexp_excluded_links($matches[1]);
     if ($count) {
         $result = Amber::cache_links($links['cache'], $cache_immediately);
     }
     foreach ($links['excluded'] as $key) {
         $result[$key] = "";
     }
     return $result;
 }