Advertisement
acegiak

Untitled

Oct 2nd, 2015
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.69 KB | None | 0 0
  1.     /**
  2.      * Adds additional meta out of an array of properties.
  3.      *
  4.      * @param array $raw An array of properties
  5.      */
  6.     public function build_meta( $raw ) {
  7.  
  8.         $kind = get_post_kind_slug( $this->post );
  9.  
  10.         foreach($raw as $key=>$value)
  11.         {
  12.             if(is_null($value) || $value == '')
  13.             unset($raw[$key]);
  14.         }
  15.         if ( isset( $raw['url'] ) ) {
  16.             $body = self::fetch( $raw['url'] );
  17.             $data = self::parse( $body );
  18.  
  19.             $data = array_merge($data, $raw  );
  20.  
  21.             $map = Kind_Taxonomy::get_kind_properties();
  22.             if ( array_key_exists( $kind, $map ) ) {
  23.                     $this->meta[ $map[ $kind ] ] = $data['url'];
  24.                     unset( $data['url'] );
  25.             }
  26.  
  27.             $this->meta['cite'] = array_filter( $data );
  28.  
  29.         }
  30.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement